From 4863cdb1a7495547f05e068f3f8228dae4e57f1f Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 15 Oct 2009 10:13:24 +0000 Subject: NFData instances --- lib/Numeric/LinearAlgebra/Instances.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/Numeric/LinearAlgebra/Instances.hs b/lib/Numeric/LinearAlgebra/Instances.hs index 79a8990..3122a3d 100644 --- a/lib/Numeric/LinearAlgebra/Instances.hs +++ b/lib/Numeric/LinearAlgebra/Instances.hs @@ -27,6 +27,7 @@ import Data.List(transpose,intersperse) import Foreign(Storable) import Data.Monoid import Data.Packed.Internal.Vector +import Control.Parallel.Strategies ------------------------------------------------------------------ @@ -196,3 +197,10 @@ instance (Storable a) => Monoid (Vector a) where where j [] = mempty j l = join l +--------------------------------------------------------------- + +instance (NFData a, Storable a) => NFData (Vector a) where + rnf = rnf . (@>0) + +instance (NFData a, Element a) => NFData (Matrix a) where + rnf = rnf . flatten -- cgit v1.2.3