diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Util.hs | 14 | ||||
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Util.hs b/packages/base/src/Numeric/LinearAlgebra/Util.hs index 779630f..60079e7 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Util.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Util.hs | |||
@@ -473,3 +473,17 @@ dispShort maxr maxc dec m = | |||
473 | where | 473 | where |
474 | fmt = printf ("%."++show dec ++"f") | 474 | fmt = printf ("%."++show dec ++"f") |
475 | 475 | ||
476 | -------------------------------------------------------------------------------- | ||
477 | |||
478 | instance Testable (Matrix I) where | ||
479 | checkT _ = test | ||
480 | |||
481 | test :: (Bool, IO()) | ||
482 | test = (and ok, print ok) | ||
483 | where | ||
484 | m = (3><4) [1..12] :: Matrix I | ||
485 | md = fromInt m :: Matrix Double | ||
486 | ok = [ tr m <> m == toInt (tr md <> md) | ||
487 | , m <> tr m == toInt (md <> tr md) | ||
488 | ] | ||
489 | |||
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index 71c7c16..b138c2b 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -379,6 +379,10 @@ staticTest = utest "static" (fst $ checkT (undefined :: L 3 5)) | |||
379 | 379 | ||
380 | -------------------------------------------------------------------------------- | 380 | -------------------------------------------------------------------------------- |
381 | 381 | ||
382 | intTest = utest "int ops" (fst $ checkT (undefined :: Matrix I)) | ||
383 | |||
384 | -------------------------------------------------------------------------------- | ||
385 | |||
382 | indexProp g f x = a1 == g a2 && a2 == a3 && b1 == g b2 && b2 == b3 | 386 | indexProp g f x = a1 == g a2 && a2 == a3 && b1 == g b2 && b2 == b3 |
383 | where | 387 | where |
384 | l = map g (toList (f x)) | 388 | l = map g (toList (f x)) |
@@ -567,6 +571,7 @@ runTests n = do | |||
567 | , convolutionTest | 571 | , convolutionTest |
568 | , sparseTest | 572 | , sparseTest |
569 | , staticTest | 573 | , staticTest |
574 | , intTest | ||
570 | ] | 575 | ] |
571 | when (errors c + failures c > 0) exitFailure | 576 | when (errors c + failures c > 0) exitFailure |
572 | return () | 577 | return () |