feldspar-language-0.6.0.2: A functional embedded language for DSP and parallelism

Safe Haskell | None

Feldspar.Vector.Internal

Contents

- Types
- Construction/conversion
- Operations

Synopsis

- data Vector a
  - = Empty
  - | Indexed {
    - segmentLength :: Data Length
    - segmentIndex :: Data Index -> a
    - continuation :: Vector a
    }
- type Vector1 a = Vector (Data a)
- type Vector2 a = Vector (Vector (Data a))
- indexed :: Data Length -> (Data Index -> a) -> Vector a
- segments :: Vector a -> [Vector a]
- length :: Vector a -> Data Length
- mergeSegments :: Syntax a => Vector a -> Vector a
- freezeVector :: Type a => Vector (Data a) -> Data [a]
- thawVector :: Type a => Data [a] -> Vector (Data a)
- thawVector' :: Type a => Length -> Data [a] -> Vector (Data a)
- newLen :: Syntax a => Data Length -> Vector a -> Vector a
- (++) :: Vector a -> Vector a -> Vector a
- take :: Data Length -> Vector a -> Vector a
- drop :: Data Length -> Vector a -> Vector a
- splitAt :: Data Index -> Vector a -> (Vector a, Vector a)
- head :: Syntax a => Vector a -> a
- last :: Syntax a => Vector a -> a
- tail :: Vector a -> Vector a
- init :: Vector a -> Vector a
- tails :: Vector a -> Vector (Vector a)
- inits :: Vector a -> Vector (Vector a)
- inits1 :: Vector a -> Vector (Vector a)
- permute' :: (Data Length -> Data Index -> Data Index) -> Vector a -> Vector a
- permute :: Syntax a => (Data Length -> Data Index -> Data Index) -> Vector a -> Vector a
- reverse :: Syntax a => Vector a -> Vector a
- rotateVecL :: Syntax a => Data Index -> Vector a -> Vector a
- rotateVecR :: Syntax a => Data Index -> Vector a -> Vector a
- replicate :: Data Length -> a -> Vector a
- enumFromTo :: forall a. Integral a => Data a -> Data a -> Vector (Data a)
- enumFrom :: Integral a => Data a -> Vector (Data a)
- (...) :: Integral a => Data a -> Data a -> Vector (Data a)
- map :: (a -> b) -> Vector a -> Vector b
- zip :: (Syntax a, Syntax b) => Vector a -> Vector b -> Vector (a, b)
- zip3 :: (Syntax a, Syntax b, Syntax c) => Vector a -> Vector b -> Vector c -> Vector (a, b, c)
- zip4 :: (Syntax a, Syntax b, Syntax c, Syntax d) => Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d)
- zip5 :: (Syntax a, Syntax b, Syntax c, Syntax d, Syntax e) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e)
- unzip :: Vector (a, b) -> (Vector a, Vector b)
- unzip3 :: Vector (a, b, c) -> (Vector a, Vector b, Vector c)
- unzip4 :: Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)
- unzip5 :: Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e)
- zipWith :: (Syntax a, Syntax b) => (a -> b -> c) -> Vector a -> Vector b -> Vector c
- zipWith3 :: (Syntax a, Syntax b, Syntax c) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
- zipWith4 :: (Syntax a, Syntax b, Syntax c, Syntax d) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
- zipWith5 :: (Syntax a, Syntax b, Syntax c, Syntax d, Syntax e) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
- fold :: Syntax a => (a -> b -> a) -> a -> Vector b -> a
- fold1 :: Syntax a => (a -> a -> a) -> Vector a -> a
- sum :: (Syntax a, Num a) => Vector a -> a
- maximum :: Ord a => Vector (Data a) -> Data a
- minimum :: Ord a => Vector (Data a) -> Data a
- scalarProd :: (Syntax a, Num a) => Vector a -> Vector a -> a
- tVec :: Patch a a -> Patch (Vector a) (Vector a)
- tVec1 :: Patch a a -> Patch (Vector (Data a)) (Vector (Data a))
- tVec2 :: Patch a a -> Patch (Vector (Vector (Data a))) (Vector (Vector (Data a)))

# Types

data Vector a

Symbolic vector

Constructors

Empty |
Indexed |
Fields segmentLength :: Data Length segmentIndex :: Data Index -> a continuation :: Vector a

Instances

Len Vector |
Ixmap Vector |
Pushy Vector |
(Syntax a, Show (Internal a)) => Show (Vector a) |
Annotatable a => Annotatable (Vector a) |
(Arbitrary (Internal a), Syntax a) => Arbitrary (Vector a) |
Syntax a => Syntactic (Vector a) |
Syntax a => Sized (Vector a) |
Syntax a => Indexed (Vector a) |
Syntax a => Syntax (Vector a) |
(ElemWise a, Syntax (Vector a)) => ElemWise (Vector a) |
CollMap (Vector a) (Vector b) |
Type a => Wrap (Vector (Data a)) (Data [a]) |
Type a => Wrap (Matrix a) (Data [[a]]) |
Numeric a => Mul (Data a) (Matrix a) |
Numeric a => Mul (Data a) (Vector1 a) |
Numeric a => Mul (Vector1 a) (Matrix a) |
Numeric a => Mul (Vector1 a) (Vector1 a) |
Numeric a => Mul (Vector1 a) (Data a) |
Numeric a => Mul (Matrix a) (Matrix a) |
Numeric a => Mul (Matrix a) (Vector1 a) |
Numeric a => Mul (Matrix a) (Data a) |
(Wrap t u, Type a, Nat s) => Wrap (Vector1 a -> t) (Data' s [a] -> u) |
(Wrap t u, Type a, Nat row, Nat col) => Wrap (Matrix a -> t) (Data' (row, col) [[a]] -> u) |

type Vector1 a = Vector (Data a)

Non-nested vector

type Vector2 a = Vector (Vector (Data a))

Two-level nested vector

# Construction/conversion

indexed :: Data Length -> (Data Index -> a) -> Vector a

segments :: Vector a -> [Vector a]

Breaks up a segmented vector into a list of single-segment vectors.

length :: Vector a -> Data Length

mergeSegments :: Syntax a => Vector a -> Vector a

Converts a segmented vector to a vector with a single segment.

freezeVector :: Type a => Vector (Data a) -> Data [a]

Converts a non-nested vector to a core vector.

thawVector :: Type a => Data [a] -> Vector (Data a)

Converts a non-nested core array to a vector.

thawVector' :: Type a => Length -> Data [a] -> Vector (Data a)

# Operations

newLen :: Syntax a => Data Length -> Vector a -> Vector a

Change the length of the vector to the supplied value. If the supplied length is greater than the old length, the new elements will have undefined value. The resulting vector has only one segment.

(++) :: Vector a -> Vector a -> Vector a

take :: Data Length -> Vector a -> Vector a

drop :: Data Length -> Vector a -> Vector a

splitAt :: Data Index -> Vector a -> (Vector a, Vector a)

head :: Syntax a => Vector a -> a

last :: Syntax a => Vector a -> a

tail :: Vector a -> Vector a

init :: Vector a -> Vector a

tails :: Vector a -> Vector (Vector a)

inits :: Vector a -> Vector (Vector a)

inits1 :: Vector a -> Vector (Vector a)

permute' :: (Data Length -> Data Index -> Data Index) -> Vector a -> Vector a

Permute a single-segment vector

permute :: Syntax a => (Data Length -> Data Index -> Data Index) -> Vector a -> Vector a

Permute a vector

reverse :: Syntax a => Vector a -> Vector a

rotateVecL :: Syntax a => Data Index -> Vector a -> Vector a

rotateVecR :: Syntax a => Data Index -> Vector a -> Vector a

replicate :: Data Length -> a -> Vector a

enumFromTo :: forall a. Integral a => Data a -> Data a -> Vector (Data a)

`enumFromTo m n`: Enumerate the integers from `m` to `n`

enumFrom :: Integral a => Data a -> Vector (Data a)

`enumFrom m`: Enumerate the indexes from `m` to `maxBound`

(...) :: Integral a => Data a -> Data a -> Vector (Data a)

See `enumFromTo`

map :: (a -> b) -> Vector a -> Vector b

`map` `f v` is the `Vector` obtained by applying f to each element of `f`.

zip :: (Syntax a, Syntax b) => Vector a -> Vector b -> Vector (a, b)

Zipping two `Vector`s

zip3 :: (Syntax a, Syntax b, Syntax c) => Vector a -> Vector b -> Vector c -> Vector (a, b, c)

Zipping three `Vector`s

zip4 :: (Syntax a, Syntax b, Syntax c, Syntax d) => Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d)

Zipping four `Vector`s

zip5 :: (Syntax a, Syntax b, Syntax c, Syntax d, Syntax e) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e)

Zipping five `Vector`s

unzip :: Vector (a, b) -> (Vector a, Vector b)

Unzip to two `Vector`s

unzip3 :: Vector (a, b, c) -> (Vector a, Vector b, Vector c)

Unzip to three `Vector`s

unzip4 :: Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)

Unzip to four `Vector`s

unzip5 :: Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e)

Unzip to five `Vector`s

zipWith :: (Syntax a, Syntax b) => (a -> b -> c) -> Vector a -> Vector b -> Vector c

Generalization of `zip` using the supplied function instead of tupling to combine the elements

zipWith3 :: (Syntax a, Syntax b, Syntax c) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d

Generalization of `zip3` using the supplied function instead of tupling to combine the elements

zipWith4 :: (Syntax a, Syntax b, Syntax c, Syntax d) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e

Generalization of `zip4` using the supplied function instead of tupling to combine the elements

zipWith5 :: (Syntax a, Syntax b, Syntax c, Syntax d, Syntax e) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f

Generalization of `zip5` using the supplied function instead of tupling to combine the elements

fold :: Syntax a => (a -> b -> a) -> a -> Vector b -> a

Corresponds to the standard `foldl`.

fold1 :: Syntax a => (a -> a -> a) -> Vector a -> a

Corresponds to the standard `foldl1`.

sum :: (Syntax a, Num a) => Vector a -> a

maximum :: Ord a => Vector (Data a) -> Data a

minimum :: Ord a => Vector (Data a) -> Data a

scalarProd :: (Syntax a, Num a) => Vector a -> Vector a -> a

Scalar product of two vectors

tVec :: Patch a a -> Patch (Vector a) (Vector a)

tVec1 :: Patch a a -> Patch (Vector (Data a)) (Vector (Data a))

tVec2 :: Patch a a -> Patch (Vector (Vector (Data a))) (Vector (Vector (Data a)))