From 9fc924dc107cd619c60a421d288dafb92f417b8c Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sat, 1 Jan 2011 20:59:47 +0000 Subject: accum --- lib/Numeric/LinearAlgebra/Tests.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/Numeric/LinearAlgebra') diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs index 3bcfec5..32cd39d 100644 --- a/lib/Numeric/LinearAlgebra/Tests.hs +++ b/lib/Numeric/LinearAlgebra/Tests.hs @@ -392,6 +392,18 @@ conformTest = utest "conform" ok --------------------------------------------------------------------- +accumTest = utest "accum" ok + where + x = ident 3 :: Matrix Double + ok = accum x (+) [((1,2),7), ((2,2),3)] + == (3><3) [1,0,0 + ,0,1,7 + ,0,0,4] + && + toList (flatten x) == [1,0,0,0,1,0,0,0,1] + +--------------------------------------------------------------------- + -- | All tests must pass with a maximum dimension of about 20 -- (some tests may fail with bigger sizes due to precision loss). runTests :: Int -- ^ maximum dimension @@ -562,6 +574,7 @@ runTests n = do , findAssocTest , condTest , conformTest + , accumTest ] return () -- cgit v1.2.3