summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Tests.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-09-11 18:45:27 +0000
committerAlberto Ruiz <aruiz@um.es>2010-09-11 18:45:27 +0000
commit996d2fdb53154993ac02b5350cd4941548e6a61e (patch)
tree0bb1cb4b8847e17d78ec87c383c3d4c610bf8030 /lib/Numeric/LinearAlgebra/Tests.hs
parenta519a29770a6ef8d08dea3b3e7971ed1f4084126 (diff)
simple tests
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Tests.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs
index 426700b..2d5b0da 100644
--- a/lib/Numeric/LinearAlgebra/Tests.hs
+++ b/lib/Numeric/LinearAlgebra/Tests.hs
@@ -271,6 +271,31 @@ normsMTest = TestList [
271 271
272--------------------------------------------------------------------- 272---------------------------------------------------------------------
273 273
274sumprodTest = TestList [
275 utest "sumCD" $ sumElements z == 6
276 , utest "sumCF" $ sumElements (single z) == 6
277 , utest "sumD" $ sumElements v == 6
278 , utest "sumF" $ sumElements (single v) == 6
279
280 , utest "prodCD" $ prodProp z
281 , utest "prodCF" $ prodProp (single z)
282 , utest "prodD" $ prodProp v
283 , utest "prodF" $ prodProp (single v)
284 ] where v = fromList [1,2,3] :: Vector Double
285 z = fromList [1,2-i,3+i]
286 prodProp x = prodElements x == product (toList x)
287
288---------------------------------------------------------------------
289
290chainTest = utest "chain" $ foldl1' (<>) ms |~| chain ms where
291 ms = [ diag (fromList [1,2,3 :: Double])
292 , konst 3 (3,5)
293 , (5><10) [1 .. ]
294 , konst 5 (10,2)
295 ]
296
297---------------------------------------------------------------------
298
274conjuTest m = mapVector conjugate (flatten (trans m)) == flatten (ctrans m) 299conjuTest m = mapVector conjugate (flatten (trans m)) == flatten (ctrans m)
275 300
276--------------------------------------------------------------------- 301---------------------------------------------------------------------
@@ -439,6 +464,8 @@ runTests n = do
439 , utest "offset" offsetTest 464 , utest "offset" offsetTest
440 , normsVTest 465 , normsVTest
441 , normsMTest 466 , normsMTest
467 , sumprodTest
468 , chainTest
442 ] 469 ]
443 return () 470 return ()
444 471