diff options
author | Alberto Ruiz <aruiz@um.es> | 2012-06-10 14:00:08 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2012-06-10 14:00:08 +0200 |
commit | f10af430ec9ab1cc71f8931dec9a4247fc780933 (patch) | |
tree | f8f9981cba2debe894310fb6f2ba77a8d7cde262 /packages/tests/src | |
parent | d109c791aef6dbb6a15fb65efe5c42121728aed0 (diff) |
convolution
Diffstat (limited to 'packages/tests/src')
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 17 |
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) | |||
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 | 46 | ||
46 | import Data.Packed.ST | 47 | import 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 | |||
427 | convolutionTest = 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 () |