summaryrefslogtreecommitdiff
path: root/packages/tests/src
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2012-06-10 14:00:08 +0200
committerAlberto Ruiz <aruiz@um.es>2012-06-10 14:00:08 +0200
commitf10af430ec9ab1cc71f8931dec9a4247fc780933 (patch)
treef8f9981cba2debe894310fb6f2ba77a8d7cde262 /packages/tests/src
parentd109c791aef6dbb6a15fb65efe5c42121728aed0 (diff)
convolution
Diffstat (limited to 'packages/tests/src')
-rw-r--r--packages/tests/src/Numeric/LinearAlgebra/Tests.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
index fd66767..4e9a521 100644
--- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
+++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs
@@ -42,6 +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
45 46
46import Data.Packed.ST 47import Data.Packed.ST
47 48
@@ -421,7 +422,20 @@ accumTest = utest "accum" ok
421 && 422 &&
422 toList (flatten x) == [1,0,0,0,1,0,0,0,1] 423 toList (flatten x) == [1,0,0,0,1,0,0,0,1]
423 424
424--------------------------------------------------------------------- 425--------------------------------------------------------------------------------
426
427convolutionTest = utest "convolution" ok
428 where
429-- a = fromList [1..10] :: Vector Double
430 b = fromList [1..3] :: Vector Double
431 c = (5><7) [1..] :: Matrix Double
432-- d = (3><3) [0,-1,0,-1,4,-1,0,-1,0] :: Matrix Double
433 ok = separable (corr b) c == corr2 (outer b b) c
434 && separable (conv b) c == conv2 (outer b b) c
435
436--------------------------------------------------------------------------------
437
438
425 439
426-- | All tests must pass with a maximum dimension of about 20 440-- | All tests must pass with a maximum dimension of about 20
427-- (some tests may fail with bigger sizes due to precision loss). 441-- (some tests may fail with bigger sizes due to precision loss).
@@ -596,6 +610,7 @@ runTests n = do
596 , condTest 610 , condTest
597 , conformTest 611 , conformTest
598 , accumTest 612 , accumTest
613 , convolutionTest
599 ] 614 ]
600 when (errors c + failures c > 0) exitFailure 615 when (errors c + failures c > 0) exitFailure
601 return () 616 return ()