repa-3.0.0.1: 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) => (a -> a -> a) -> a -> Array r (sh :. Int) a -> Array U sh aSource

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) => (a -> a -> a) -> a -> Array r sh a -> 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) => Array r (sh :. Int) a -> Array U sh aSource

Sequential 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) => Array r sh a -> aSource

Parallel sum all the elements of an array.