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

Safe HaskellNone

Data.Array.Repa.Operators.Reduction

Synopsis

Documentation

foldS :: (Shape sh, Source r a, Elt a, Unbox 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, Source r a, Elt a, Unbox 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, Source r a, Elt a, Unbox 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, Source r a, Elt a, Unbox 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, Source r a, Num a, Elt a, Unbox a) => Array r (sh :. Int) a -> Array U sh aSource

Sequential sum the innermost dimension of an array.

sumP :: (Shape sh, Source r a, Num a, Elt a, Unbox 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, Source r a, Elt a, Unbox a, Num a) => Array r sh a -> aSource

Sequential sum of all the elements of an array.

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

Parallel sum all the elements of an array.

equalsS :: (Shape sh, Eq sh, Source r1 a, Source r2 a, Eq a) => Array r1 sh a -> Array r2 sh a -> BoolSource

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

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

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