repa 3.2.5.1 → 3.3.1.1
raw patch · 3 files changed
+30/−5 lines, 3 files
Files
- Data/Array/Repa/Eval/Reduction.hs +4/−4
- Data/Array/Repa/Operators/Reduction.hs +25/−0
- repa.cabal +1/−1
Data/Array/Repa/Eval/Reduction.hs view
@@ -153,7 +153,7 @@ {-# INLINE iter #-} iter !i !z | 1# <- i >=# end = z - | otherwise = iter (i +# 1#) (f i `c` z)+ | otherwise = iter (i +# 1#) (z `c` f i) {-# INLINE [0] reduceInt #-}@@ -170,7 +170,7 @@ {-# INLINE iter #-} iter !i !z | 1# <- i >=# end = z - | otherwise = iter (i +# 1#) (f i `c` z)+ | otherwise = iter (i +# 1#) (z `c` f i) {-# INLINE [0] reduceFloat #-}@@ -187,7 +187,7 @@ {-# INLINE iter #-} iter !i !z | 1# <- i >=# end = z - | otherwise = iter (i +# 1#) (f i `c` z)+ | otherwise = iter (i +# 1#) (z `c` f i) {-# INLINE [0] reduceDouble #-}@@ -204,7 +204,7 @@ {-# INLINE iter #-} iter !i !z | 1# <- i >=# end = z - | otherwise = iter (i +# 1#) (f i `c` z)+ | otherwise = iter (i +# 1#) (z `c` f i) {-# INLINE unboxInt #-}
Data/Array/Repa/Operators/Reduction.hs view
@@ -24,6 +24,15 @@ -- | Sequential reduction of the innermost dimension of an arbitrary rank array. -- -- Combine this with `transpose` to fold any other dimension.+--+-- Elements are reduced in the order of their indices, from lowest to highest.+-- Applications of the operator are associatied arbitrarily.+--+-- >>> let c 0 x = x; c x 0 = x; c x y = y+-- >>> let a = fromListUnboxed (Z :. 2 :. 2) [1,2,3,4] :: Array U (Z :. Int :. Int) Int+-- >>> foldS c 0 a+-- AUnboxed (Z :. 2) (fromList [2,4])+-- foldS :: (Shape sh, Source r a, Elt a, Unbox a) => (a -> a -> a) -> a@@ -49,6 +58,15 @@ -- 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.+--+-- Elements are reduced in the order of their indices, from lowest to highest.+-- Applications of the operator are associatied arbitrarily.+--+-- >>> let c 0 x = x; c x 0 = x; c x y = y+-- >>> let a = fromListUnboxed (Z :. 2 :. 2) [1,2,3,4] :: Array U (Z :. Int :. Int) Int+-- >>> foldP c 0 a+-- AUnboxed (Z :. 2) (fromList [2,4])+-- foldP :: (Shape sh, Source r a, Elt a, Unbox a, Monad m) => (a -> a -> a) -> a@@ -79,6 +97,9 @@ -- foldAll -------------------------------------------------------------------- -- | Sequential reduction of an array of arbitrary rank to a single scalar value. --+-- Elements are reduced in row-major order. Applications of the operator are+-- associated arbitrarily.+-- foldAllS :: (Shape sh, Source r a, Elt a, Unbox a) => (a -> a -> a) -> a@@ -102,6 +123,10 @@ -- 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.+--+-- Elements are reduced in row-major order. Applications of the operator are+-- associated arbitrarily.+-- foldAllP :: (Shape sh, Source r a, Elt a, Unbox a, Monad m) => (a -> a -> a)
repa.cabal view
@@ -1,5 +1,5 @@ Name: repa-Version: 3.2.5.1+Version: 3.3.1.1 License: BSD3 License-file: LICENSE Author: The DPH Team