Portability | non-portable (GHC extensions) |
---|---|
Stability | experimental |
Maintainer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> |
Safe Haskell | None |
- data Array sh e where
- type Scalar e = Array DIM0 e
- type Vector e = Array DIM1 e
- type Segments = Vector Int
- class (Show a, Typeable a, Typeable (EltRepr a), Typeable (EltRepr' a), ArrayElt (EltRepr a), ArrayElt (EltRepr' a)) => Elt a where
- type family EltRepr a :: *
- type family EltRepr' a :: *
- liftToElt :: (Elt a, Elt b) => (EltRepr a -> EltRepr b) -> a -> b
- liftToElt2 :: (Elt a, Elt b, Elt c) => (EltRepr a -> EltRepr b -> EltRepr c) -> a -> b -> c
- sinkFromElt :: (Elt a, Elt b) => (a -> b) -> EltRepr a -> EltRepr b
- sinkFromElt2 :: (Elt a, Elt b, Elt c) => (a -> b -> c) -> EltRepr a -> EltRepr b -> EltRepr c
- type DIM0 = Z
- type DIM1 = DIM0 :. Int
- type DIM2 = DIM1 :. Int
- type DIM3 = DIM2 :. Int
- type DIM4 = DIM3 :. Int
- type DIM5 = DIM4 :. Int
- type DIM6 = DIM5 :. Int
- type DIM7 = DIM6 :. Int
- type DIM8 = DIM7 :. Int
- type DIM9 = DIM8 :. Int
- data Z = Z
- data tail :. head = tail :. head
- data All = All
- data Any sh = Any
- class (Elt sh, Elt (Any sh), Shape (EltRepr sh)) => Shape sh where
- dim :: sh -> Int
- size :: sh -> Int
- ignore :: sh
- index :: sh -> sh -> Int
- bound :: sh -> sh -> Boundary a -> Either a sh
- iter :: sh -> (sh -> a) -> (a -> a -> a) -> a -> a
- rangeToShape :: (sh, sh) -> sh
- shapeToRange :: sh -> (sh, sh)
- shapeToList :: sh -> [Int]
- listToShape :: [Int] -> sh
- sliceAnyIndex :: sh -> SliceIndex (EltRepr (Any sh)) (EltRepr sh) () (EltRepr sh)
- class (Elt sl, Shape (SliceShape sl), Shape (CoSliceShape sl), Shape (FullShape sl)) => Slice sl where
- type SliceShape sl :: *
- type CoSliceShape sl :: *
- type FullShape sl :: *
- sliceIndex :: sl -> SliceIndex (EltRepr sl) (EltRepr (SliceShape sl)) (EltRepr (CoSliceShape sl)) (EltRepr (FullShape sl))
- shape :: Shape sh => Array sh e -> sh
- (!) :: Array sh e -> sh -> e
- newArray :: (Shape sh, Elt e) => sh -> (sh -> e) -> Array sh e
- allocateArray :: (Shape sh, Elt e) => sh -> Array sh e
- fromIArray :: (EltRepr ix ~ EltRepr sh, IArray a e, Ix ix, Shape sh, Elt ix, Elt e) => a ix e -> Array sh e
- toIArray :: (EltRepr ix ~ EltRepr sh, IArray a e, Ix ix, Shape sh, Elt ix, Elt e) => Array sh e -> a ix e
- fromList :: (Shape sh, Elt e) => sh -> [e] -> Array sh e
- toList :: forall sh e. Array sh e -> [e]
Array representation
Multi-dimensional arrays for array processing
- If device and host memory are separate, arrays will be transferred to the device when necessary (if possible asynchronously and in parallel with other tasks) and cached on the device if sufficient memory is available.
Class of supported surface element types and their mapping to representation types
class (Show a, Typeable a, Typeable (EltRepr a), Typeable (EltRepr' a), ArrayElt (EltRepr a), ArrayElt (EltRepr' a)) => Elt a whereSource
Class that characterises the types of values that can be array elements, and hence, appear in scalar Accelerate expressions.
eltType :: a -> TupleType (EltRepr a)Source
fromElt :: a -> EltRepr aSource
eltType' :: a -> TupleType (EltRepr' a)Source
Elt Bool | |
Elt Char | |
Elt Double | |
Elt Float | |
Elt Int | |
Elt Int8 | |
Elt Int16 | |
Elt Int32 | |
Elt Int64 | |
Elt Word | |
Elt Word8 | |
Elt Word16 | |
Elt Word32 | |
Elt Word64 | |
Elt () | |
Elt All | |
Elt Z | |
Shape sh => Elt (Any (:. sh Int)) | |
Elt (Any Z) | |
(Elt a, Elt b) => Elt (a, b) | |
(Elt t, Elt h) => Elt (:. t h) | |
(Elt a, Elt b, Elt c) => Elt (a, b, c) | |
(Elt a, Elt b, Elt c, Elt d) => Elt (a, b, c, d) | |
(Elt a, Elt b, Elt c, Elt d, Elt e) => Elt (a, b, c, d, e) | |
(Elt a, Elt b, Elt c, Elt d, Elt e, Elt f) => Elt (a, b, c, d, e, f) | |
(Elt a, Elt b, Elt c, Elt d, Elt e, Elt f, Elt g) => Elt (a, b, c, d, e, f, g) | |
(Elt a, Elt b, Elt c, Elt d, Elt e, Elt f, Elt g, Elt h) => Elt (a, b, c, d, e, f, g, h) | |
(Elt a, Elt b, Elt c, Elt d, Elt e, Elt f, Elt g, Elt h, Elt i) => Elt (a, b, c, d, e, f, g, h, i) |
type family EltRepr a :: *Source
Representation change for array element types ----------------------------------------------
Type representation mapping
We represent tuples by using '()' and '(,)' as type-level nil and snoc to construct snoc-lists of types.
Derived functions
Array shapes
Array indexing and slicing
Surface types representing array indices and slices ----------------------------------------------------
Array indices are snoc type lists
For example, the type of a rank-2 array index is 'Z :.Int :. Int'.
Rank-0 index
Show Z | |
Typeable Z | |
Slice Z | |
Shape Z | |
Elt Z | |
Unlift Z | |
Lift Z | |
Elt e => Stencil DIM1 e (e, e, e) | |
Elt e => Stencil DIM1 e (Exp e, Exp e, Exp e) | |
Elt e => Stencil DIM1 e (e, e, e, e, e) | |
Elt e => Stencil DIM1 e (Exp e, Exp e, Exp e, Exp e, Exp e) | |
Elt e => Stencil DIM1 e (e, e, e, e, e, e, e) | |
Elt e => Stencil DIM1 e (Exp e, Exp e, Exp e, Exp e, Exp e, Exp e, Exp e) | |
Elt e => Stencil DIM1 e (e, e, e, e, e, e, e, e, e) | |
Elt e => Stencil DIM1 e (Exp e, Exp e, Exp e, Exp e, Exp e, Exp e, Exp e, Exp e, Exp e) | |
Elt (Any Z) |
Increase an index rank by one dimension
tail :. head |
Typeable2 :. | |
Elt e => Stencil DIM1 e (e, e, e) | |
Elt e => Stencil DIM1 e (Exp e, Exp e, Exp e) | |
Elt e => Stencil DIM1 e (e, e, e, e, e) | |
Elt e => Stencil DIM1 e (Exp e, Exp e, Exp e, Exp e, Exp e) | |
Elt e => Stencil DIM1 e (e, e, e, e, e, e, e) | |
Elt e => Stencil DIM1 e (Exp e, Exp e, Exp e, Exp e, Exp e, Exp e, Exp e) | |
Elt e => Stencil DIM1 e (e, e, e, e, e, e, e, e, e) | |
Elt e => Stencil DIM1 e (Exp e, Exp e, Exp e, Exp e, Exp e, Exp e, Exp e, Exp e, Exp e) | |
Shape sh => Elt (Any (:. sh Int)) | |
(Show tail, Show head) => Show (:. tail head) | |
Slice sl => Slice (:. sl Int) | |
Slice sl => Slice (:. sl All) | |
Shape sh => Shape (:. sh Int) | |
(Elt t, Elt h) => Elt (:. t h) | |
(Elt e, Slice (Plain ix), Unlift ix) => Unlift (:. ix (Exp e)) | |
(Elt e, Slice (Plain ix), Lift ix) => Lift (:. ix (Exp e)) | |
(Slice (Plain ix), Lift ix) => Lift (:. ix All) | |
(Slice (Plain ix), Lift ix) => Lift (:. ix Int) | |
(Stencil (:. sh Int) a row1, Stencil (:. sh Int) a row2, Stencil (:. sh Int) a row3) => Stencil (:. (:. sh Int) Int) a (row1, row2, row3) | |
(Stencil (:. sh Int) a row2, Stencil (:. sh Int) a row1, Stencil (:. sh Int) a row0) => Stencil (:. (:. sh Int) Int) a (row2, row1, row0) | |
(Stencil (:. sh Int) a row1, Stencil (:. sh Int) a row2, Stencil (:. sh Int) a row3, Stencil (:. sh Int) a row4, Stencil (:. sh Int) a row5) => Stencil (:. (:. sh Int) Int) a (row1, row2, row3, row4, row5) | |
(Stencil (:. sh Int) a row1, Stencil (:. sh Int) a row2, Stencil (:. sh Int) a row3, Stencil (:. sh Int) a row4, Stencil (:. sh Int) a row5) => Stencil (:. (:. sh Int) Int) a (row1, row2, row3, row4, row5) | |
(Stencil (:. sh Int) a row1, Stencil (:. sh Int) a row2, Stencil (:. sh Int) a row3, Stencil (:. sh Int) a row4, Stencil (:. sh Int) a row5, Stencil (:. sh Int) a row6, Stencil (:. sh Int) a row7) => Stencil (:. (:. sh Int) Int) a (row1, row2, row3, row4, row5, row6, row7) | |
(Stencil (:. sh Int) a row1, Stencil (:. sh Int) a row2, Stencil (:. sh Int) a row3, Stencil (:. sh Int) a row4, Stencil (:. sh Int) a row5, Stencil (:. sh Int) a row6, Stencil (:. sh Int) a row7) => Stencil (:. (:. sh Int) Int) a (row1, row2, row3, row4, row5, row6, row7) | |
(Stencil (:. sh Int) a row1, Stencil (:. sh Int) a row2, Stencil (:. sh Int) a row3, Stencil (:. sh Int) a row4, Stencil (:. sh Int) a row5, Stencil (:. sh Int) a row6, Stencil (:. sh Int) a row7, Stencil (:. sh Int) a row8, Stencil (:. sh Int) a row9) => Stencil (:. (:. sh Int) Int) a (row1, row2, row3, row4, row5, row6, row7, row8, row9) | |
(Stencil (:. sh Int) a row1, Stencil (:. sh Int) a row2, Stencil (:. sh Int) a row3, Stencil (:. sh Int) a row4, Stencil (:. sh Int) a row5, Stencil (:. sh Int) a row6, Stencil (:. sh Int) a row7, Stencil (:. sh Int) a row8, Stencil (:. sh Int) a row9) => Stencil (:. (:. sh Int) Int) a (row1, row2, row3, row4, row5, row6, row7, row8, row9) |
Marker for entire dimensions in slice descriptors
Marker for arbitrary shapes in slice descriptors
class (Elt sh, Elt (Any sh), Shape (EltRepr sh)) => Shape sh whereSource
Shapes and indices of multi-dimensional arrays
Number of dimensions of a shape or index (>= 0).
Total number of elements in an array of the given shape.
Magic value identifying elements ignored in permute
.
index :: sh -> sh -> IntSource
Map a multi-dimensional index into one in a linear, row-major representation of the array (first argument is the shape, second argument is the index).
bound :: sh -> sh -> Boundary a -> Either a shSource
Apply a boundary condition to an index.
iter :: sh -> (sh -> a) -> (a -> a -> a) -> a -> aSource
Iterate through the entire shape, applying the function; third argument combines results and fourth is returned in case of an empty iteration space; the index space is traversed in row-major order.
rangeToShape :: (sh, sh) -> shSource
Convert a minpoint-maxpoint index into a shape.
shapeToRange :: sh -> (sh, sh)Source
Convert a shape into a minpoint-maxpoint index.
shapeToList :: sh -> [Int]Source
Convert a shape to a list of dimensions.
listToShape :: [Int] -> shSource
Convert a list of dimensions into a shape.
sliceAnyIndex :: sh -> SliceIndex (EltRepr (Any sh)) (EltRepr sh) () (EltRepr sh)Source
The slice index for slice specifier 'Any sh'
class (Elt sl, Shape (SliceShape sl), Shape (CoSliceShape sl), Shape (FullShape sl)) => Slice sl whereSource
Slices -aka generalised indices- as n-tuples and mappings of slice indicies to slices, co-slices, and slice dimensions
sliceIndex :: sl -> SliceIndex (EltRepr sl) (EltRepr (SliceShape sl)) (EltRepr (CoSliceShape sl)) (EltRepr (FullShape sl))Source
Array shape query, indexing, and conversions
newArray :: (Shape sh, Elt e) => sh -> (sh -> e) -> Array sh eSource
Create an array from its representation function
allocateArray :: (Shape sh, Elt e) => sh -> Array sh eSource
Creates a new, uninitialized Accelerate array.
fromIArray :: (EltRepr ix ~ EltRepr sh, IArray a e, Ix ix, Shape sh, Elt ix, Elt e) => a ix e -> Array sh eSource
Convert an IArray
to an accelerated array.
toIArray :: (EltRepr ix ~ EltRepr sh, IArray a e, Ix ix, Shape sh, Elt ix, Elt e) => Array sh e -> a ix eSource
Convert an accelerated array to an IArray