summaryrefslogtreecommitdiff
path: root/packages/tests
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
parentd109c791aef6dbb6a15fb65efe5c42121728aed0 (diff)
convolution
Diffstat (limited to 'packages/tests')
-rw-r--r--packages/tests/hmatrix-tests.cabal4
-rw-r--r--packages/tests/src/Numeric/LinearAlgebra/Tests.hs17
2 files changed, 18 insertions, 3 deletions
diff --git a/packages/tests/hmatrix-tests.cabal b/packages/tests/hmatrix-tests.cabal
index 1c6443e..10b7c80 100644
--- a/packages/tests/hmatrix-tests.cabal
+++ b/packages/tests/hmatrix-tests.cabal
@@ -1,5 +1,5 @@
1Name: hmatrix-tests 1Name: hmatrix-tests
2Version: 0.2 2Version: 0.3
3License: GPL 3License: GPL
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
@@ -21,7 +21,7 @@ extra-source-files: CHANGES
21library 21library
22 22
23 Build-Depends: base >= 4 && < 5, 23 Build-Depends: base >= 4 && < 5,
24 hmatrix >= 0.14, 24 hmatrix >= 0.14.1,
25 QuickCheck >= 2, HUnit, random 25 QuickCheck >= 2, HUnit, random
26 26
27 hs-source-dirs: src 27 hs-source-dirs: src
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 ()