From f10af430ec9ab1cc71f8931dec9a4247fc780933 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sun, 10 Jun 2012 14:00:08 +0200 Subject: convolution --- packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'packages/tests/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) import Control.Arrow((***)) import Debug.Trace import Control.Monad(when) +import Numeric.LinearAlgebra.Util.Convolution import Data.Packed.ST @@ -421,7 +422,20 @@ accumTest = utest "accum" ok && toList (flatten x) == [1,0,0,0,1,0,0,0,1] ---------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +convolutionTest = utest "convolution" ok + where +-- a = fromList [1..10] :: Vector Double + b = fromList [1..3] :: Vector Double + c = (5><7) [1..] :: Matrix Double +-- d = (3><3) [0,-1,0,-1,4,-1,0,-1,0] :: Matrix Double + ok = separable (corr b) c == corr2 (outer b b) c + && separable (conv b) c == conv2 (outer b b) c + +-------------------------------------------------------------------------------- + + -- | All tests must pass with a maximum dimension of about 20 -- (some tests may fail with bigger sizes due to precision loss). @@ -596,6 +610,7 @@ runTests n = do , condTest , conformTest , accumTest + , convolutionTest ] when (errors c + failures c > 0) exitFailure return () -- cgit v1.2.3