diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-27 10:41:40 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-27 10:41:40 +0200 |
commit | cf3c788f0c44577ac1a5365e8154200b53a36409 (patch) | |
tree | d667ea10609e74b69b11309bb59b7e000b240a92 /packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |
parent | 365e2435e71de10ebe849acac5a107b6f43817c4 (diff) |
static dimensions, cont.
Diffstat (limited to 'packages/tests/src/Numeric/LinearAlgebra/Tests.hs')
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index 3803f3b..02beb21 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -1,5 +1,7 @@ | |||
1 | {-# LANGUAGE CPP #-} | 1 | {-# LANGUAGE CPP #-} |
2 | {-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-incomplete-patterns #-} | 2 | {-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-incomplete-patterns #-} |
3 | {-# LANGUAGE DataKinds #-} | ||
4 | |||
3 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
4 | {- | | 6 | {- | |
5 | Module : Numeric.LinearAlgebra.Tests | 7 | Module : Numeric.LinearAlgebra.Tests |
@@ -25,7 +27,8 @@ module Numeric.LinearAlgebra.Tests( | |||
25 | ) where | 27 | ) where |
26 | 28 | ||
27 | import Numeric.LinearAlgebra | 29 | import Numeric.LinearAlgebra |
28 | import Numeric.HMatrix | 30 | import Numeric.HMatrix hiding ((<>)) |
31 | import Numeric.LinearAlgebra.Real(L) | ||
29 | import Numeric.LinearAlgebra.Util(col,row) | 32 | import Numeric.LinearAlgebra.Util(col,row) |
30 | import Data.Packed | 33 | import Data.Packed |
31 | import Numeric.LinearAlgebra.LAPACK | 34 | import Numeric.LinearAlgebra.LAPACK |
@@ -466,18 +469,23 @@ kroneckerTest = utest "kronecker" ok | |||
466 | x = (4><2) [3,5..] | 469 | x = (4><2) [3,5..] |
467 | b = (2><5) [0,5..] | 470 | b = (2><5) [0,5..] |
468 | v1 = vec (a <> x <> b) | 471 | v1 = vec (a <> x <> b) |
469 | v2 = (trans b `kronecker` a) <.> vec x | 472 | v2 = (trans b `kronecker` a) <> vec x |
470 | s = trans b <> b | 473 | s = trans b <> b |
471 | v3 = vec s | 474 | v3 = vec s |
472 | v4 = (dup 5 :: Matrix Double) <.> vech s | 475 | v4 = (dup 5 :: Matrix Double) <> vech s |
473 | ok = v1 == v2 && v3 == v4 | 476 | ok = v1 == v2 && v3 == v4 |
474 | && vtrans 1 a == trans a | 477 | && vtrans 1 a == trans a |
475 | && vtrans (rows a) a == asColumn (vec a) | 478 | && vtrans (rows a) a == asColumn (vec a) |
476 | 479 | ||
477 | -------------------------------------------------------------------------------- | 480 | -------------------------------------------------------------------------------- |
478 | 481 | ||
479 | sparseTest = utest "sparse mul" (fst $ checkT (undefined :: SMatrix)) | 482 | sparseTest = utest "sparse" (fst $ checkT (undefined :: GMatrix)) |
483 | |||
484 | -------------------------------------------------------------------------------- | ||
480 | 485 | ||
486 | staticTest = utest "static" (fst $ checkT (undefined :: L 3 5)) | ||
487 | |||
488 | -------------------------------------------------------------------------------- | ||
481 | 489 | ||
482 | -- | All tests must pass with a maximum dimension of about 20 | 490 | -- | All tests must pass with a maximum dimension of about 20 |
483 | -- (some tests may fail with bigger sizes due to precision loss). | 491 | -- (some tests may fail with bigger sizes due to precision loss). |
@@ -655,6 +663,7 @@ runTests n = do | |||
655 | , convolutionTest | 663 | , convolutionTest |
656 | , kroneckerTest | 664 | , kroneckerTest |
657 | , sparseTest | 665 | , sparseTest |
666 | , staticTest | ||
658 | ] | 667 | ] |
659 | when (errors c + failures c > 0) exitFailure | 668 | when (errors c + failures c > 0) exitFailure |
660 | return () | 669 | return () |