packages feed

matrices 0.4.3 → 0.4.4

raw patch · 5 files changed

+23/−8 lines, 5 filesdep +deepseqdep ~base

Dependencies added: deepseq

Dependency ranges changed: base

Files

matrices.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                matrices-version:             0.4.3+version:             0.4.4 synopsis:            native matrix based on vector description:         This library provide the APIs for creating, indexing,                      modifying matrices (2d arrays), including dense and@@ -12,7 +12,7 @@ license-file:        LICENSE author:              Kai Zhang maintainer:          kai@kzhang.org-copyright:           (c) 2015 Kai Zhang+copyright:           (c) 2015,2016 Kai Zhang category:            Data build-type:          Simple -- extra-source-files:@@ -34,12 +34,13 @@     Data.Matrix.Symmetric     Data.Matrix.Symmetric.Mutable -  ghc-options: -Wall -fwarn-tabs -funbox-strict-fields+  ghc-options: -Wall -funbox-strict-fields    -- other-modules:    build-depends:-      base >=4.5 && <5+      base >=4.8 && <5+    , deepseq     , vector >=0.9     , primitive @@ -68,7 +69,7 @@   other-modules:    default-language:    Haskell2010-  build-depends: +  build-depends:       base     , matrices     , vector
src/Data/Matrix/Dense/Generic.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns          #-}+{-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE FlexibleContexts      #-} {-# LANGUAGE FlexibleInstances     #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -103,6 +104,7 @@     ) where  import           Control.Arrow                     ((&&&), (***))+import           Control.DeepSeq                   hiding (force) import           Control.Monad                     (foldM, foldM_, liftM) import qualified Data.Foldable                     as F import qualified Data.Vector.Generic               as G@@ -111,6 +113,7 @@  import           Data.Matrix.Dense.Generic.Mutable (MMatrix (..)) import qualified Data.Matrix.Generic               as MG+import           GHC.Generics                      (Generic)  type instance MG.Mutable Matrix = MMatrix @@ -120,8 +123,10 @@                          !Int    -- physical row dimension                          !Int    -- offset                          !(v a)  -- flat matrix-    deriving (Show, Read, Eq)+    deriving (Show, Read, Eq, Generic) +instance NFData (v a) => NFData (Matrix v a) where+ rnf (Matrix _ _ _ _ vec) = rnf vec  instance G.Vector v a => MG.Matrix Matrix v a where     -- | O(1) Return the size of matrix.
src/Data/Matrix/Dense/Generic/Mutable.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleInstances     #-}+{-# LANGUAGE FlexibleContexts      #-} {-# LANGUAGE MultiParamTypeClasses #-} module Data.Matrix.Dense.Generic.Mutable    ( -- * Mutable Matrix@@ -14,6 +15,7 @@    ) where  import           Control.Monad               (liftM)+import           Control.DeepSeq import qualified Data.Vector.Generic.Mutable as GM import           Prelude                     hiding (read, replicate) @@ -21,6 +23,9 @@  -- | mutable matrix data MMatrix v s a = MMatrix !Int !Int !Int !Int !(v s a)++instance (NFData (v s a)) => NFData (MMatrix v s a) where+ rnf (MMatrix _ _ _ _ vec) = rnf vec  instance GM.MVector v a => C.MMatrix MMatrix v a where     dim (MMatrix r c _ _ _) = (r,c)
src/Data/Matrix/Sparse/Generic.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleInstances     #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies          #-}+{-# LANGUAGE DeriveGeneric      #-} module Data.Matrix.Sparse.Generic     ( Zero(..)     , CSR(..)@@ -46,6 +47,7 @@ import qualified Data.Vector.Generic.Mutable       as GM import qualified Data.Vector.Unboxed               as U import           Text.Printf                       (printf)+import           GHC.Generics          (Generic)  import           Data.Matrix.Dense.Generic.Mutable (MMatrix) import qualified Data.Matrix.Generic               as MG@@ -71,7 +73,7 @@                    !(v a)  -- values                    !(U.Vector Int)  -- column index of values                    !(U.Vector Int)  -- row pointer-    deriving (Show)+    deriving (Show, Read, Eq, Generic)  instance (Zero a, G.Vector v a) => MG.Matrix CSR v a where     dim (CSR r c _ _ _) = (r,c)
src/Data/Matrix/Symmetric.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleInstances     #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies          #-}+{-# LANGUAGE DeriveGeneric      #-} module Data.Matrix.Symmetric     ( SymMatrix(..)     , dim@@ -29,6 +30,7 @@ import           Data.Bits                     (shiftR) import qualified Data.Vector.Generic           as G import           Prelude                       hiding (zip, zipWith)+import           GHC.Generics          (Generic)  import           Data.Matrix.Generic import           Data.Matrix.Symmetric.Mutable (SymMMatrix (..), new,@@ -38,7 +40,7 @@  -- | Symmetric square matrix data SymMatrix v a = SymMatrix !Int !(v a)-    deriving (Show)+    deriving (Show, Read, Generic, Eq)   --------------------------------------------------------------------------------