From 8c890d59088015865a4e8c6b0ebec13e58d8b295 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Tue, 21 May 2013 14:02:17 +0200 Subject: NFData (Matrix t) --- lib/Data/Packed/Internal/Matrix.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/Data/Packed/Internal') 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) import Foreign.C.Types import Foreign.C.String(newCString) import System.IO.Unsafe(unsafePerformIO) +import Control.DeepSeq ----------------------------------------------------------------- @@ -459,3 +460,13 @@ size m = (rows m, cols m) shSize m = "(" ++ show (rows m) ++"><"++ show (cols m)++")" +---------------------------------------------------------------------- + +instance (Storable t, NFData t) => NFData (Matrix t) + where + rnf m | d > 0 = rnf (v @> 0) + | otherwise = () + where + d = dim v + v = xdat m + -- cgit v1.2.3