diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index 4e9a521..99c0c91 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -42,7 +42,7 @@ import Data.Packed.Development(unsafeFromForeignPtr,unsafeToForeignPtr) | |||
42 | import Control.Arrow((***)) | 42 | import Control.Arrow((***)) |
43 | import Debug.Trace | 43 | import Debug.Trace |
44 | import Control.Monad(when) | 44 | import Control.Monad(when) |
45 | import Numeric.LinearAlgebra.Util.Convolution | 45 | import Numeric.LinearAlgebra.Util hiding (ones,row,col) |
46 | 46 | ||
47 | import Data.Packed.ST | 47 | import Data.Packed.ST |
48 | 48 | ||
@@ -435,6 +435,23 @@ convolutionTest = utest "convolution" ok | |||
435 | 435 | ||
436 | -------------------------------------------------------------------------------- | 436 | -------------------------------------------------------------------------------- |
437 | 437 | ||
438 | kroneckerTest = utest "kronecker" ok | ||
439 | where | ||
440 | a,x,b :: Matrix Double | ||
441 | a = (3><4) [1..] | ||
442 | x = (4><2) [3,5..] | ||
443 | b = (2><5) [0,5..] | ||
444 | v1 = vec (a <> x <> b) | ||
445 | v2 = (trans b `kronecker` a) <> vec x | ||
446 | s = trans b <> b | ||
447 | v3 = vec s | ||
448 | v4 = dup 5 <> vech s | ||
449 | ok = v1 == v2 && v3 == v4 | ||
450 | && vtrans 1 a == trans a | ||
451 | && vtrans (rows a) a == asColumn (vec a) | ||
452 | |||
453 | -------------------------------------------------------------------------------- | ||
454 | |||
438 | 455 | ||
439 | 456 | ||
440 | -- | All tests must pass with a maximum dimension of about 20 | 457 | -- | All tests must pass with a maximum dimension of about 20 |
@@ -611,6 +628,7 @@ runTests n = do | |||
611 | , conformTest | 628 | , conformTest |
612 | , accumTest | 629 | , accumTest |
613 | , convolutionTest | 630 | , convolutionTest |
631 | , kroneckerTest | ||
614 | ] | 632 | ] |
615 | when (errors c + failures c > 0) exitFailure | 633 | when (errors c + failures c > 0) exitFailure |
616 | return () | 634 | return () |