-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An embedded language for accelerated array processing -- -- This library defines an embedded language for regular, -- multi-dimensional array computations with multiple backends to -- facilitate high-performance implementations. Currently, there are two -- backends: (1) an interpreter that serves as a reference implementation -- of the intended semantics of the language and (2) a CUDA backend -- generating code for CUDA-capable NVIDIA GPUs. -- -- To use the CUDA backend, you need to have CUDA version 3.x installed. -- The CUDA backend still misses some features of the full language; in -- particular, the array operations replicate, slice, and -- foldSeg are not yet supported. -- -- Known bugs in this version: -- http:trac.haskell.orgacceleratequery?status=new&status=assigned&status=reopened&status=closed&version=0.7.1.0&order=priority -- --
-- precondition: size dim == size dim' --reshape :: (Ix dim, Ix dim', Elem e) => Exp dim -> Acc (Array dim' e) -> Acc (Array dim e) -- | Index an array with a *generalised* array index (supplied as the -- second argument). The result is a new array (possibly a singleton) -- containing all dimensions in their entirety. slice :: (SliceIx slix, Elem e) => Acc (Array (SliceDim slix) e) -> Exp slix -> Acc (Array (Slice slix) e) -- | Replicate an array across one or more dimensions as specified by the -- *generalised* array index provided as the first argument. -- -- For example, assuming arr is a vector (one-dimensional -- array), -- --
-- replicate (2, All, 3) arr ---- -- yields a three dimensional array, where arr is replicated -- twice across the first and three times across the third dimension. replicate :: (SliceIx slix, Elem e) => Exp slix -> Acc (Array (Slice slix) e) -> Acc (Array (SliceDim slix) e) -- | Combine the elements of two arrays pairwise. The shape of the result -- is the intersection of the two argument shapes. zip :: (Ix dim, Elem a, Elem b) => Acc (Array dim a) -> Acc (Array dim b) -> Acc (Array dim (a, b)) -- | The converse of zip, but the shape of the two results is -- identical to the shape of the argument. unzip :: (Ix dim, Elem a, Elem b) => Acc (Array dim (a, b)) -> (Acc (Array dim a), Acc (Array dim b)) -- | Apply the given function elementwise to the given array. map :: (Ix dim, Elem a, Elem b) => (Exp a -> Exp b) -> Acc (Array dim a) -> Acc (Array dim b) -- | Apply the given binary function elementwise to the two arrays. zipWith :: (Ix dim, Elem a, Elem b, Elem c) => (Exp a -> Exp b -> Exp c) -> Acc (Array dim a) -> Acc (Array dim b) -> Acc (Array dim c) -- | Prescan of a vector. The type 'a' together with the binary function -- (first argument) and value (second argument) must form a monoid; i.e., -- the function must be associative and the value must be its -- neutral element. -- -- The resulting vector of prescan values has the same size as the -- argument vector. The resulting scalar is the reduction value. scanl :: (Elem a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Vector a) -> (Acc (Vector a), Acc (Scalar a)) -- | The right-to-left dual of scanl. scanr :: (Elem a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Vector a) -> (Acc (Vector a), Acc (Scalar a)) -- | Reduction of an array. The type a together with the binary -- function (first argument) and value (second argument) must form a -- monoid; i.e., the function must be associative and the value -- must be its neutral element. fold :: (Ix dim, Elem a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Array dim a) -> Acc (Scalar a) -- | Segmented reduction. foldSeg :: (Elem a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Vector a) -> Acc Segments -> Acc (Vector a) -- | Forward permutation specified by an index mapping. The result array is -- initialised with the given defaults and any further values that are -- permuted into the result array are added to the current value using -- the given combination function. -- -- The combination function must be associative. Elements that are -- mapped to the magic value ignore by the permutation function -- are being dropped. permute :: (Ix dim, Ix dim', Elem a) => (Exp a -> Exp a -> Exp a) -> Acc (Array dim' a) -> (Exp dim -> Exp dim') -> Acc (Array dim a) -> Acc (Array dim' a) -- | Backward permutation backpermute :: (Ix dim, Ix dim', Elem a) => Exp dim' -> (Exp dim' -> Exp dim) -> Acc (Array dim a) -> Acc (Array dim' a) class Tuple tup where { type family TupleT tup; } tuple :: (Tuple tup) => tup -> TupleT tup untuple :: (Tuple tup) => TupleT tup -> tup -- | Extract the first component of a pair fst :: (Elem a, Elem b) => Exp (a, b) -> Exp a -- | Extract the second component of a pair snd :: (Elem a, Elem b) => Exp (a, b) -> Exp b -- | Converts an uncurried function to a curried function curry :: (Elem a, Elem b) => (Exp (a, b) -> Exp c) -> Exp a -> Exp b -> Exp c -- | Converts a curried function to a function on pairs uncurry :: (Elem a, Elem b) => (Exp a -> Exp b -> Exp c) -> Exp (a, b) -> Exp c -- | Conditional expression. (?) :: (Elem t) => Exp Bool -> (Exp t, Exp t) -> Exp t -- | Expression form that extracts a scalar from an array. (!) :: (Ix dim, Elem e) => Acc (Array dim e) -> Exp dim -> Exp e shape :: (Ix dim, Elem dim) => Acc (Array dim e) -> Exp dim -- | Equality lifted into Accelerate expressions. (==*) :: (Elem t, IsScalar t) => Exp t -> Exp t -> Exp Bool -- | Inequality lifted into Accelerate expressions. (/=*) :: (Elem t, IsScalar t) => Exp t -> Exp t -> Exp Bool -- | Smaller-than lifted into Accelerate expressions. (<*) :: (Elem t, IsScalar t) => Exp t -> Exp t -> Exp Bool -- | Smaller-or-equal lifted into Accelerate expressions. (<=*) :: (Elem t, IsScalar t) => Exp t -> Exp t -> Exp Bool -- | Greater-than lifted into Accelerate expressions. (>*) :: (Elem t, IsScalar t) => Exp t -> Exp t -> Exp Bool -- | Greater-or-equal lifted into Accelerate expressions. (>=*) :: (Elem t, IsScalar t) => Exp t -> Exp t -> Exp Bool -- | Determine the maximum of two scalars. max :: (Elem t, IsScalar t) => Exp t -> Exp t -> Exp t -- | Determine the minimum of two scalars. min :: (Elem t, IsScalar t) => Exp t -> Exp t -> Exp t bit :: (Elem t, IsIntegral t) => Exp Int -> Exp t setBit :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t clearBit :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t complementBit :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t testBit :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp Bool shift :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t shiftL :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t shiftR :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t rotate :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t rotateL :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t rotateR :: (Elem t, IsIntegral t) => Exp t -> Exp Int -> Exp t -- | Conjunction (&&*) :: Exp Bool -> Exp Bool -> Exp Bool -- | Disjunction (||*) :: Exp Bool -> Exp Bool -> Exp Bool -- | Negation not :: Exp Bool -> Exp Bool -- | Convert a Boolean value to an Int, where False turns -- into '0' and True into '1'. boolToInt :: Exp Bool -> Exp Int -- | Convert an Int to a Float intToFloat :: Exp Int -> Exp Float -- | Round Float to Int roundFloatToInt :: Exp Float -> Exp Int -- | Truncate Float to Int truncateFloatToInt :: Exp Float -> Exp Int -- | Magic value identifying elements that are ignored in a forward -- permutation ignore :: (Ix dim) => Exp dim