diff options
-rw-r--r-- | hmatrix.cabal | 3 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/hmatrix.cabal b/hmatrix.cabal index 514d562..800e7b0 100644 --- a/hmatrix.cabal +++ b/hmatrix.cabal | |||
@@ -88,7 +88,8 @@ library | |||
88 | storable-complex, | 88 | storable-complex, |
89 | process, random, | 89 | process, random, |
90 | vector >= 0.8, | 90 | vector >= 0.8, |
91 | binary | 91 | binary, |
92 | deepseq | ||
92 | 93 | ||
93 | Extensions: ForeignFunctionInterface, | 94 | Extensions: ForeignFunctionInterface, |
94 | CPP | 95 | CPP |
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index b8ed18d..367c189 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -47,6 +47,7 @@ import Data.Complex(Complex) | |||
47 | import Foreign.C.Types | 47 | import Foreign.C.Types |
48 | import Foreign.C.String(newCString) | 48 | import Foreign.C.String(newCString) |
49 | import System.IO.Unsafe(unsafePerformIO) | 49 | import System.IO.Unsafe(unsafePerformIO) |
50 | import Control.DeepSeq | ||
50 | 51 | ||
51 | ----------------------------------------------------------------- | 52 | ----------------------------------------------------------------- |
52 | 53 | ||
@@ -459,3 +460,13 @@ size m = (rows m, cols m) | |||
459 | 460 | ||
460 | shSize m = "(" ++ show (rows m) ++"><"++ show (cols m)++")" | 461 | shSize m = "(" ++ show (rows m) ++"><"++ show (cols m)++")" |
461 | 462 | ||
463 | ---------------------------------------------------------------------- | ||
464 | |||
465 | instance (Storable t, NFData t) => NFData (Matrix t) | ||
466 | where | ||
467 | rnf m | d > 0 = rnf (v @> 0) | ||
468 | | otherwise = () | ||
469 | where | ||
470 | d = dim v | ||
471 | v = xdat m | ||
472 | |||