repa-3.1.4.2: High performance, regular, shape polymorphic parallel arrays.

Data.Array.Repa.Operators.Reduction

Synopsis

# Documentation

foldS :: (Shape sh, Elt a, Unbox a, Repr r a) => (a -> a -> a) -> a -> Array r (sh :. Int) a -> Array U sh aSource

Sequential reduction of the innermost dimension of an arbitrary rank array.

Combine this with transpose to fold any other dimension.

foldP :: (Shape sh, Elt a, Unbox a, Repr r a, Monad m) => (a -> a -> a) -> a -> Array r (sh :. Int) a -> m (Array U sh a)Source

Parallel reduction of the innermost dimension of an arbitray rank array.

The first argument needs to be an associative sequential operator. The starting element must be neutral with respect to the operator, for example 0 is neutral with respect to (+) as 0 + a = a. These restrictions are required to support parallel evaluation, as the starting element may be used multiple times depending on the number of threads.

foldAllS :: (Shape sh, Elt a, Unbox a, Repr r a) => (a -> a -> a) -> a -> Array r sh a -> aSource

Sequential reduction of an array of arbitrary rank to a single scalar value.

foldAllP :: (Shape sh, Elt a, Unbox a, Repr r a, Monad m) => (a -> a -> a) -> a -> Array r sh a -> m aSource

Parallel reduction of an array of arbitrary rank to a single scalar value.

The first argument needs to be an associative sequential operator. The starting element must be neutral with respect to the operator, for example 0 is neutral with respect to (+) as 0 + a = a. These restrictions are required to support parallel evaluation, as the starting element may be used multiple times depending on the number of threads.

sumS :: (Shape sh, Num a, Elt a, Unbox a, Repr r a) => Array r (sh :. Int) a -> Array U sh aSource

Sequential sum the innermost dimension of an array.

sumP :: (Shape sh, Num a, Elt a, Unbox a, Repr r a, Monad m) => Array r (sh :. Int) a -> m (Array U sh a)Source

Parallel sum the innermost dimension of an array.

sumAllS :: (Shape sh, Elt a, Unbox a, Num a, Repr r a) => Array r sh a -> aSource

Sequential sum of all the elements of an array.

sumAllP :: (Shape sh, Elt a, Unbox a, Num a, Repr r a, Monad m) => Array r sh a -> m aSource

Parallel sum all the elements of an array.

equalsS :: (Shape sh, Repr r1 e, Repr r2 e, Eq e) => Array r1 sh e -> Array r2 sh e -> BoolSource

Check whether two arrays have the same shape and contain equal elements, sequentially.

equalsP :: (Shape sh, Repr r1 e, Repr r2 e, Eq e, Monad m) => Array r1 sh e -> Array r2 sh e -> m BoolSource

Check whether two arrays have the same shape and contain equal elements, in parallel.