packages feed

massiv 0.1.2.0 → 0.1.3.0

raw patch · 10 files changed

+60/−10 lines, 10 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Massiv.Array.Delayed: makeWindowedArray :: Source r ix e => Array r ix e -> ix -> ix -> (ix -> e) -> Array DW ix e
+ Data.Massiv.Array.Manifest: unsafeWithPtr :: Storable a => Array S ix a -> (Ptr a -> IO b) -> IO b
+ Data.Massiv.Array.Manifest: withPtr :: (Index ix, Storable a) => MArray RealWorld S ix a -> (Ptr a -> IO b) -> IO b
+ Data.Massiv.Array.Mutable: computeInto :: (Load r' ix e, Mutable r ix e) => MArray RealWorld r ix e -> Array r' ix e -> IO ()
+ Data.Massiv.Array.Mutable: data RealWorld :: *
+ Data.Massiv.Core.Index: errorSizeMismatch :: (Show ix, Show ix') => String -> ix -> ix' -> a

Files

massiv.cabal view
@@ -1,5 +1,5 @@ name:                massiv-version:             0.1.2.0+version:             0.1.3.0 synopsis:            Massiv (Массив) is an Array Library. description:         Multi-dimensional Arrays with fusion, stencils and parallel computation. homepage:            https://github.com/lehins/massiv
src/Data/Massiv/Array/Delayed.hs view
@@ -15,6 +15,7 @@   , DI   , toInterleaved   , DW+  , makeWindowedArray   ) where  import           Data.Massiv.Array.Delayed.Interleaved
src/Data/Massiv/Array/Delayed/Internal.hs view
@@ -252,12 +252,11 @@   | sz2 == oneIndex = liftArray (`f` (unsafeIndex arr2 zeroIndex)) arr1   | sz1 == sz2 =     DArray (getComp arr1) sz1 (\ !ix -> f (unsafeIndex arr1 ix) (unsafeIndex arr2 ix))-  | otherwise =-    error $-    "Array dimensions must be the same, instead got: " ++-    show (size arr1) ++ " and " ++ show (size arr2)+  | otherwise = errorSizeMismatch "liftArray2" (size arr1) (size arr2)   where     oneIndex = pureIndex 1     sz1 = size arr1     sz2 = size arr2 {-# INLINE liftArray2 #-}++
src/Data/Massiv/Array/Delayed/Windowed.hs view
@@ -78,6 +78,8 @@ -- | Supply a separate generating function for interior of an array. This is -- very usful for stencil mapping, where interior function does not perform -- boundary checks, thus significantly speeding up computation process.+--+-- @since 0.1.3 makeWindowedArray   :: Source r ix e   => Array r ix e -- ^ Source array that will have a window inserted into it
src/Data/Massiv/Array/Manifest.hs view
@@ -27,6 +27,8 @@   -- * Storable   , S(..)   , Storable+  , withPtr+  , unsafeWithPtr   -- * Unboxed   , U(..)   , Unbox
src/Data/Massiv/Array/Manifest/Internal.hs view
@@ -24,6 +24,7 @@   , computeAs   , computeProxy   , computeSource+  , computeInto   , clone   , convert   , convertAs@@ -38,7 +39,8 @@   ) where  import           Control.Exception                  (try)-import           Control.Monad.ST                   (runST)+import           Control.Monad                      (unless)+import           Control.Monad.ST                   (RealWorld, runST) import           Data.Foldable                      (Foldable (..)) import           Data.Massiv.Array.Delayed.Internal import           Data.Massiv.Array.Ops.Fold         as M@@ -185,7 +187,6 @@   {-# INLINE loadP #-}  - loadMutableS :: (Load r' ix e, Mutable r ix e) =>                 Array r' ix e -> Array r ix e loadMutableS !arr =@@ -226,7 +227,7 @@ {-# INLINE computeAs #-}  --- | Same as `convert` and `convertAs`, but let's you supply resulting representation type as a proxy+-- | Same as `compute` and `computeAs`, but let's you supply resulting representation type as a proxy -- argument. -- -- @since 0.1.1@@ -242,6 +243,23 @@ computeProxy :: (Load r' ix e, Mutable r ix e) => proxy r -> Array r' ix e -> Array r ix e computeProxy _ = compute {-# INLINE computeProxy #-}+++-- | Compute an Array while loading the results into the supplied mutable target array. Sizes of+-- both arrays must agree, otherwise error.+--+-- @since 0.1.3+computeInto ::+     (Load r' ix e, Mutable r ix e)+  => MArray RealWorld r ix e -- ^ Target Array+  -> Array r' ix e -- ^ Array to load+  -> IO ()+computeInto !mArr !arr = do+  unless (msize mArr == size arr) $ errorSizeMismatch "computeInto" (msize mArr) (size arr)+  case getComp arr of+    Seq        -> loadS arr (unsafeLinearRead mArr) (unsafeLinearWrite mArr)+    ParOn wIds -> loadP wIds arr (unsafeLinearRead mArr) (unsafeLinearWrite mArr)+{-# INLINE computeInto #-}   -- | This is just like `compute`, but can be applied to `Source` arrays and will be a noop if
src/Data/Massiv/Array/Manifest/Storable.hs view
@@ -17,6 +17,8 @@   ( S (..)   , Array(..)   , VS.Storable+  , withPtr+  , unsafeWithPtr   ) where  import           Control.DeepSeq                     (NFData (..), deepseq)@@ -30,6 +32,7 @@ import           Data.Massiv.Core.List import qualified Data.Vector.Storable                as VS import qualified Data.Vector.Storable.Mutable        as MVS+import           Foreign.Ptr import           GHC.Exts                            as GHC (IsList (..)) import           Prelude                             hiding (mapM) @@ -147,3 +150,18 @@   {-# INLINE fromList #-}   toList = GHC.toList . toListArray   {-# INLINE toList #-}++-- | A pointer to the beginning of originally created array, i.e. various index manipulation+-- functions that do slicing, extracting, etc. have no affect on this pointer.+--+-- @since 0.1.3+unsafeWithPtr :: VS.Storable a => Array S ix a -> (Ptr a -> IO b) -> IO b+unsafeWithPtr arr = VS.unsafeWith (sData arr)++++-- | A pointer to the beginning of the mutable array.+--+-- @since 0.1.3+withPtr :: (Index ix, VS.Storable a) => MArray RealWorld S ix a -> (Ptr a -> IO b) -> IO b+withPtr (MSArray _ mv) = MVS.unsafeWith mv
src/Data/Massiv/Array/Mutable.hs view
@@ -29,6 +29,9 @@   , modify'   , swap   , swap'+  -- * Computation+  , RealWorld+  , computeInto   -- * Generate (experimental)    -- $generate
src/Data/Massiv/Core/Computation.hs view
@@ -16,11 +16,11 @@  import           Control.DeepSeq (NFData (..), deepseq) #if MIN_VERSION_base(4,9,0)+#if !MIN_VERSION_base(4,11,0) import Data.Semigroup-+#endif instance Semigroup Comp where   (<>) = joinComp- #endif  
src/Data/Massiv/Core/Index/Class.hs view
@@ -413,3 +413,10 @@   fName ++   ": Index out of bounds: " ++ show ix ++ " for Array of size: " ++ show sz {-# NOINLINE errorIx #-}+++-- | Helper function for throwing error when sizes do not match+errorSizeMismatch :: (Show ix, Show ix') => String -> ix -> ix' -> a+errorSizeMismatch fName sz sz' =+  error $ fName ++ ": Mismatch in size of arrays " ++ show sz ++ " vs " ++ show sz'+{-# NOINLINE errorSizeMismatch #-}