summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Tests
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-10-22 12:59:18 +0000
committerAlberto Ruiz <aruiz@um.es>2008-10-22 12:59:18 +0000
commitfaeaf6d261b760e628c1e63551d822d16876c0cc (patch)
tree45e3e2d1460d72e1fd037e19d4470963b75cc00e /lib/Numeric/LinearAlgebra/Tests
parent9d9b1274a522e1bf0c5dea210765a0368ebb74a5 (diff)
-Wall
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests')
-rw-r--r--lib/Numeric/LinearAlgebra/Tests/Instances.hs6
-rw-r--r--lib/Numeric/LinearAlgebra/Tests/Properties.hs15
2 files changed, 10 insertions, 11 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests/Instances.hs b/lib/Numeric/LinearAlgebra/Tests/Instances.hs
index 677ad2b..4e829d2 100644
--- a/lib/Numeric/LinearAlgebra/Tests/Instances.hs
+++ b/lib/Numeric/LinearAlgebra/Tests/Instances.hs
@@ -30,9 +30,9 @@ import Control.Monad(replicateM)
30 30
31instance (Arbitrary a, RealFloat a) => Arbitrary (Complex a) where 31instance (Arbitrary a, RealFloat a) => Arbitrary (Complex a) where
32 arbitrary = do 32 arbitrary = do
33 r <- arbitrary 33 re <- arbitrary
34 i <- arbitrary 34 im <- arbitrary
35 return (r:+i) 35 return (re :+ im)
36 coarbitrary = undefined 36 coarbitrary = undefined
37 37
38chooseDim = sized $ \m -> choose (1,max 1 m) 38chooseDim = sized $ \m -> choose (1,max 1 m)
diff --git a/lib/Numeric/LinearAlgebra/Tests/Properties.hs b/lib/Numeric/LinearAlgebra/Tests/Properties.hs
index 5663b86..b5321c2 100644
--- a/lib/Numeric/LinearAlgebra/Tests/Properties.hs
+++ b/lib/Numeric/LinearAlgebra/Tests/Properties.hs
@@ -39,11 +39,10 @@ module Numeric.LinearAlgebra.Tests.Properties (
39) where 39) where
40 40
41import Numeric.LinearAlgebra 41import Numeric.LinearAlgebra
42import Numeric.LinearAlgebra.Tests.Instances(Sq(..),Her(..),Rot(..))
43import Test.QuickCheck 42import Test.QuickCheck
44import Debug.Trace 43-- import Debug.Trace
45 44
46debug x = trace (show x) x 45-- debug x = trace (show x) x
47 46
48-- relative error 47-- relative error
49dist :: (Normed t, Num t) => t -> t -> Double 48dist :: (Normed t, Num t) => t -> t -> Double
@@ -77,7 +76,7 @@ hermitian m = square m && m |~| ctrans m
77wellCond m = rcond m > 1/100 76wellCond m = rcond m > 1/100
78 77
79positiveDefinite m = minimum (toList e) > 0 78positiveDefinite m = minimum (toList e) > 0
80 where (e,v) = eigSH m 79 where (e,_v) = eigSH m
81 80
82upperTriang m = rows m == 1 || down == z 81upperTriang m = rows m == 1 || down == z
83 where down = fromList $ concat $ zipWith drop [1..] (toLists (ctrans m)) 82 where down = fromList $ concat $ zipWith drop [1..] (toLists (ctrans m))
@@ -107,8 +106,8 @@ pinvProp m = m <> p <> m |~| m
107 106
108detProp m = s d1 |~| s d2 107detProp m = s d1 |~| s d2
109 where d1 = det m 108 where d1 = det m
110 d2 = det' m * det q 109 d2 = det' * det q
111 det' m = product $ toList $ takeDiag r 110 det' = product $ toList $ takeDiag r
112 (q,r) = qr m 111 (q,r) = qr m
113 s x = fromList [x] 112 s x = fromList [x]
114 113
@@ -147,10 +146,10 @@ schurProp2 m = m |~| u <> s <> ctrans u && unitary u && upperHessenberg s -- fix
147 146
148cholProp m = m |~| ctrans c <> c && upperTriang c 147cholProp m = m |~| ctrans c <> c && upperTriang c
149 where c = chol m 148 where c = chol m
150 pos = positiveDefinite m 149 -- pos = positiveDefinite m
151 150
152expmDiagProp m = expm (logm m) :~ 7 ~: complex m 151expmDiagProp m = expm (logm m) :~ 7 ~: complex m
153 where logm m = matFunc log m 152 where logm = matFunc log
154 153
155multProp1 (a,b) = a <> b |~| mulH a b 154multProp1 (a,b) = a <> b |~| mulH a b
156 155