repa 3.4.1.1 → 3.4.1.2
raw patch · 11 files changed
+37/−48 lines, 11 filesdep ~QuickCheckdep ~basedep ~vector
Dependency ranges changed: QuickCheck, base, vector
Files
- Data/Array/Repa/Arbitrary.hs +3/−2
- Data/Array/Repa/Eval/Reduction.hs +5/−6
- Data/Array/Repa/Operators/IndexSpace.hs +1/−3
- Data/Array/Repa/Operators/Reduction.hs +10/−10
- Data/Array/Repa/Operators/Traversal.hs +4/−4
- Data/Array/Repa/Repr/ByteString.hs +1/−2
- Data/Array/Repa/Repr/Unboxed.hs +4/−10
- Data/Array/Repa/Repr/Undefined.hs +1/−1
- Data/Array/Repa/Repr/Vector.hs +4/−6
- Data/Array/Repa/Stencil/Template.hs +2/−2
- repa.cabal +2/−2
Data/Array/Repa/Arbitrary.hs view
@@ -38,7 +38,8 @@ -- Note: this is a shape that is "sized", and then random array for a given -- shape is generated.-instance (Shape a, Arbitrary a) => Arbitrary (a :. Int) where+instance Arbitrary a + => Arbitrary (a :. Int) where arbitrary = sized (\n -> do b <- choose (1, n)@@ -70,7 +71,7 @@ instance CoArbitrary Z where coarbitrary _ = id -instance (Shape a, CoArbitrary a) +instance (CoArbitrary a) => CoArbitrary (a :. Int) where coarbitrary (a :. b) = coarbitrary a . coarbitrary b
Data/Array/Repa/Eval/Reduction.hs view
@@ -3,15 +3,15 @@ ( foldS, foldP , foldAllS, foldAllP) where-import Data.Array.Repa.Eval.Elt import Data.Array.Repa.Eval.Gang import qualified Data.Vector.Unboxed as V import qualified Data.Vector.Unboxed.Mutable as M import GHC.Base ( quotInt, divInt ) import GHC.Exts + -- | Sequential reduction of a multidimensional array along the innermost dimension.-foldS :: (Elt a, V.Unbox a)+foldS :: V.Unbox a => M.IOVector a -- ^ vector to write elements into -> (Int# -> a) -- ^ function to get an element from the given index -> (a -> a -> a) -- ^ binary associative combination function@@ -38,7 +38,7 @@ -- | Parallel reduction of a multidimensional array along the innermost dimension. -- Each output value is computed by a single thread, with the output values -- distributed evenly amongst the available threads.-foldP :: (Elt a, V.Unbox a)+foldP :: V.Unbox a => M.IOVector a -- ^ vector to write elements into -> (Int -> a) -- ^ function to get an element from the given index -> (a -> a -> a) -- ^ binary associative combination operator @@ -78,8 +78,7 @@ -- | Sequential reduction of all the elements in an array.-foldAllS :: (Elt a, V.Unbox a)- => (Int# -> a) -- ^ function to get an element from the given index+foldAllS :: (Int# -> a) -- ^ function to get an element from the given index -> (a -> a -> a) -- ^ binary associative combining function -> a -- ^ starting value -> Int# -- ^ number of elements@@ -99,7 +98,7 @@ -- computes a fold1 on its chunk of the data, and the seed element is only -- applied in the final reduction step. ---foldAllP :: (Elt a, V.Unbox a)+foldAllP :: V.Unbox a => (Int -> a) -- ^ function to get an element from the given index -> (a -> a -> a) -- ^ binary associative combining function -> a -- ^ starting value
Data/Array/Repa/Operators/IndexSpace.hs view
@@ -95,7 +95,7 @@ -- | Backwards permutation of an array's elements. backpermute, unsafeBackpermute :: forall r sh1 sh2 e- . ( Shape sh1, Shape sh2+ . ( Shape sh1 , Source r e) => sh2 -- ^ Extent of result array. -> (sh2 -> sh1) -- ^ Function mapping each index in the result array@@ -152,7 +152,6 @@ extend, unsafeExtend :: ( Slice sl , Shape (SliceShape sl)- , Shape (FullShape sl) , Source r e) => sl -> Array r (SliceShape sl) e@@ -187,7 +186,6 @@ slice, unsafeSlice :: ( Slice sl , Shape (FullShape sl)- , Shape (SliceShape sl) , Source r e) => Array r (FullShape sl) e -> sl
Data/Array/Repa/Operators/Reduction.hs view
@@ -33,7 +33,7 @@ -- >>> foldS c 0 a -- AUnboxed (Z :. 2) (fromList [2,4]) ---foldS :: (Shape sh, Source r a, Elt a, Unbox a)+foldS :: (Shape sh, Source r a, Unbox a) => (a -> a -> a) -> a -> Array r (sh :. Int) a@@ -67,7 +67,7 @@ -- >>> foldP c 0 a -- AUnboxed (Z :. 2) (fromList [2,4]) ---foldP :: (Shape sh, Source r a, Elt a, Unbox a, Monad m)+foldP :: (Shape sh, Source r a, Unbox a, Monad m) => (a -> a -> a) -> a -> Array r (sh :. Int) a@@ -100,7 +100,7 @@ -- Elements are reduced in row-major order. Applications of the operator are -- associated arbitrarily. ---foldAllS :: (Shape sh, Source r a, Elt a, Unbox a)+foldAllS :: (Shape sh, Source r a) => (a -> a -> a) -> a -> Array r sh a@@ -128,7 +128,7 @@ -- associated arbitrarily. -- foldAllP - :: (Shape sh, Source r a, Elt a, Unbox a, Monad m)+ :: (Shape sh, Source r a, Unbox a, Monad m) => (a -> a -> a) -> a -> Array r sh a@@ -146,7 +146,7 @@ -- sum ------------------------------------------------------------------------ -- | Sequential sum the innermost dimension of an array.-sumS :: (Shape sh, Source r a, Num a, Elt a, Unbox a)+sumS :: (Shape sh, Source r a, Num a, Unbox a) => Array r (sh :. Int) a -> Array U sh a sumS = foldS (+) 0@@ -154,7 +154,7 @@ -- | Parallel sum the innermost dimension of an array.-sumP :: (Shape sh, Source r a, Num a, Elt a, Unbox a, Monad m)+sumP :: (Shape sh, Source r a, Num a, Unbox a, Monad m) => Array r (sh :. Int) a -> m (Array U sh a) sumP = foldP (+) 0 @@ -163,7 +163,7 @@ -- sumAll --------------------------------------------------------------------- -- | Sequential sum of all the elements of an array.-sumAllS :: (Shape sh, Source r a, Elt a, Unbox a, Num a)+sumAllS :: (Shape sh, Source r a, Num a) => Array r sh a -> a sumAllS = foldAllS (+) 0@@ -171,7 +171,7 @@ -- | Parallel sum all the elements of an array.-sumAllP :: (Shape sh, Source r a, Elt a, Unbox a, Num a, Monad m)+sumAllP :: (Shape sh, Source r a, Unbox a, Num a, Monad m) => Array r sh a -> m a sumAllP = foldAllP (+) 0@@ -187,7 +187,7 @@ -- | Check whether two arrays have the same shape and contain equal elements, -- in parallel.-equalsP :: (Shape sh, Eq sh, Source r1 a, Source r2 a, Eq a, Monad m) +equalsP :: (Shape sh, Source r1 a, Source r2 a, Eq a, Monad m) => Array r1 sh a -> Array r2 sh a -> m Bool@@ -198,7 +198,7 @@ -- | Check whether two arrays have the same shape and contain equal elements, -- sequentially.-equalsS :: (Shape sh, Eq sh, Source r1 a, Source r2 a, Eq a) +equalsS :: (Shape sh, Source r1 a, Source r2 a, Eq a) => Array r1 sh a -> Array r2 sh a -> Bool
Data/Array/Repa/Operators/Traversal.hs view
@@ -15,7 +15,7 @@ traverse, unsafeTraverse :: forall r sh sh' a b . ( Source r a- , Shape sh, Shape sh')+ , Shape sh) => Array r sh a -- ^ Source array. -> (sh -> sh') -- ^ Function to produce the extent of the result. -> ((sh -> a) -> sh' -> b) -- ^ Function to produce elements of the result.@@ -35,7 +35,7 @@ traverse2, unsafeTraverse2 :: forall r1 r2 sh sh' sh'' a b c . ( Source r1 a, Source r2 b- , Shape sh, Shape sh', Shape sh'')+ , Shape sh, Shape sh') => Array r1 sh a -- ^ First source array. -> Array r2 sh' b -- ^ Second source array. -> (sh -> sh' -> sh'') -- ^ Function to produce the extent of the result.@@ -62,7 +62,7 @@ sh1 sh2 sh3 sh4 a b c d . ( Source r1 a, Source r2 b, Source r3 c- , Shape sh1, Shape sh2, Shape sh3, Shape sh4)+ , Shape sh1, Shape sh2, Shape sh3) => Array r1 sh1 a -> Array r2 sh2 b -> Array r3 sh3 c@@ -89,7 +89,7 @@ sh1 sh2 sh3 sh4 sh5 a b c d e . ( Source r1 a, Source r2 b, Source r3 c, Source r4 d- , Shape sh1, Shape sh2, Shape sh3, Shape sh4, Shape sh5)+ , Shape sh1, Shape sh2, Shape sh3, Shape sh4) => Array r1 sh1 a -> Array r2 sh2 b -> Array r3 sh3 c
Data/Array/Repa/Repr/ByteString.hs view
@@ -47,8 +47,7 @@ -- Conversions ---------------------------------------------------------------- -- | O(1). Wrap a `ByteString` as an array. fromByteString- :: Shape sh- => sh -> ByteString -> Array B sh Word8+ :: sh -> ByteString -> Array B sh Word8 fromByteString sh bs = AByteString sh bs {-# INLINE fromByteString #-}
Data/Array/Repa/Repr/Unboxed.hs view
@@ -90,8 +90,7 @@ -- * This is an alias for `computeS` with a more specific type. -- computeUnboxedS- :: ( Shape sh- , Load r1 sh e, U.Unbox e)+ :: (Load r1 sh e, U.Unbox e) => Array r1 sh e -> Array U sh e computeUnboxedS = computeS {-# INLINE computeUnboxedS #-}@@ -102,8 +101,7 @@ -- * This is an alias for `computeP` with a more specific type. -- computeUnboxedP- :: ( Shape sh- , Load r1 sh e, Monad m, U.Unbox e)+ :: (Load r1 sh e, Monad m, U.Unbox e) => Array r1 sh e -> m (Array U sh e) computeUnboxedP = computeP {-# INLINE computeUnboxedP #-}@@ -121,18 +119,14 @@ -- | O(1). Wrap an unboxed vector as an array.-fromUnboxed- :: (Shape sh, U.Unbox e)- => sh -> U.Vector e -> Array U sh e+fromUnboxed :: sh -> U.Vector e -> Array U sh e fromUnboxed sh vec = AUnboxed sh vec {-# INLINE fromUnboxed #-} -- | O(1). Unpack an unboxed vector from an array.-toUnboxed- :: U.Unbox e- => Array U sh e -> U.Vector e+toUnboxed :: Array U sh e -> U.Vector e toUnboxed (AUnboxed _ vec) = vec {-# INLINE toUnboxed #-}
Data/Array/Repa/Repr/Undefined.hs view
@@ -44,7 +44,7 @@ => Read (Array X sh e) -instance (Shape sh, Num e) => Load X sh e where+instance Shape sh => Load X sh e where loadS _ _ = return () loadP _ _ = return ()
Data/Array/Repa/Repr/Vector.hs view
@@ -83,7 +83,7 @@ -- * This is an alias for `compute` with a more specific type. -- computeVectorS- :: (Shape sh, Load r1 sh e)+ :: Load r1 sh e => Array r1 sh e -> Array V sh e computeVectorS = computeS {-# INLINE computeVectorS #-}@@ -91,7 +91,7 @@ -- | Parallel computation of array elements. computeVectorP- :: (Shape sh, Load r1 sh e, Monad m)+ :: (Load r1 sh e, Monad m) => Array r1 sh e -> m (Array V sh e) computeVectorP = computeP {-# INLINE computeVectorP #-}@@ -107,16 +107,14 @@ -- | O(1). Wrap a boxed vector as an array.-fromVector- :: Shape sh- => sh -> V.Vector e -> Array V sh e+fromVector :: sh -> V.Vector e -> Array V sh e fromVector sh vec = AVector sh vec {-# INLINE fromVector #-} -- | O(1). Unpack a boxed vector from an array.-toVector :: Array V sh e -> V.Vector e+toVector :: Array V sh e -> V.Vector e toVector (AVector _ vec) = vec {-# INLINE toVector #-}
Data/Array/Repa/Stencil/Template.hs view
@@ -63,8 +63,8 @@ in makeStencil2' sizeX sizeY $ filter (\(_, _, v) -> v /= 0) $ [ (fromIntegral y, fromIntegral x, fromIntegral v)- | y <- [minX, minX + 1 .. maxX]- , x <- [minY, minY + 1 .. maxY]+ | y <- [minX, minX + (1 :: Integer) .. maxX]+ , x <- [minY, minY + (1 :: Integer) .. maxY] | v <- coeffs ]
repa.cabal view
@@ -1,5 +1,5 @@ Name: repa-Version: 3.4.1.1+Version: 3.4.1.2 License: BSD3 License-file: LICENSE Author: The DPH Team@@ -26,7 +26,7 @@ , ghc-prim , vector == 0.11.* , bytestring == 0.10.*- , QuickCheck == 2.8.*+ , QuickCheck >= 2.8 && < 2.10 ghc-options: -Wall -fno-warn-missing-signatures