packages feed

hmatrix-tests 0.2 → 0.3

raw patch · 2 files changed

+36/−3 lines, 2 filesdep ~hmatrixPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hmatrix

API changes (from Hackage documentation)

Files

hmatrix-tests.cabal view
@@ -1,5 +1,5 @@ Name:               hmatrix-tests-Version:            0.2+Version:            0.3 License:            GPL License-file:       LICENSE Author:             Alberto Ruiz@@ -21,7 +21,7 @@ library      Build-Depends:      base >= 4 && < 5,-                        hmatrix >= 0.14,+                        hmatrix >= 0.14.1,                         QuickCheck >= 2, HUnit, random      hs-source-dirs:     src
src/Numeric/LinearAlgebra/Tests.hs view
@@ -42,6 +42,7 @@ import Control.Arrow((***)) import Debug.Trace import Control.Monad(when)+import Numeric.LinearAlgebra.Util hiding (ones,row,col)  import Data.Packed.ST @@ -421,8 +422,38 @@          &&          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++--------------------------------------------------------------------------------++kroneckerTest = utest "kronecker" ok+  where+    a,x,b :: Matrix Double+    a = (3><4) [1..]+    x = (4><2) [3,5..]+    b = (2><5) [0,5..]+    v1 = vec (a <> x <> b)+    v2 = (trans b `kronecker` a) <> vec x+    s = trans b <> b+    v3 = vec s+    v4 = dup 5 <> vech s+    ok = v1 == v2 && v3 == v4+      && vtrans 1 a == trans a+      && vtrans (rows a) a == asColumn (vec a)++--------------------------------------------------------------------------------+++ -- | All tests must pass with a maximum dimension of about 20 --  (some tests may fail with bigger sizes due to precision loss). runTests :: Int  -- ^ maximum dimension@@ -596,6 +627,8 @@         , condTest         , conformTest         , accumTest+        , convolutionTest+        , kroneckerTest         ]     when (errors c + failures c > 0) exitFailure     return ()