summaryrefslogtreecommitdiff
path: root/packages/tests/src
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2012-06-15 11:09:15 +0200
committerAlberto Ruiz <aruiz@um.es>2012-06-15 11:09:15 +0200
commit899c1f71f64f49c5d3b2c264501565227977cd9c (patch)
tree4abe298e0be5bcfaad0a8b5bad137229ece13d8c /packages/tests/src
parentf10af430ec9ab1cc71f8931dec9a4247fc780933 (diff)
kronecker tools
Diffstat (limited to 'packages/tests/src')
-rw-r--r--packages/tests/src/Numeric/LinearAlgebra/Tests.hs20
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)
42import Control.Arrow((***)) 42import Control.Arrow((***))
43import Debug.Trace 43import Debug.Trace
44import Control.Monad(when) 44import Control.Monad(when)
45import Numeric.LinearAlgebra.Util.Convolution 45import Numeric.LinearAlgebra.Util hiding (ones,row,col)
46 46
47import Data.Packed.ST 47import Data.Packed.ST
48 48
@@ -435,6 +435,23 @@ convolutionTest = utest "convolution" ok
435 435
436-------------------------------------------------------------------------------- 436--------------------------------------------------------------------------------
437 437
438kroneckerTest = 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 ()