diff options
author | Alberto Ruiz <aruiz@um.es> | 2008-10-22 12:59:18 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2008-10-22 12:59:18 +0000 |
commit | faeaf6d261b760e628c1e63551d822d16876c0cc (patch) | |
tree | 45e3e2d1460d72e1fd037e19d4470963b75cc00e /lib/Numeric/LinearAlgebra/Tests/Properties.hs | |
parent | 9d9b1274a522e1bf0c5dea210765a0368ebb74a5 (diff) |
-Wall
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests/Properties.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests/Properties.hs | 15 |
1 files changed, 7 insertions, 8 deletions
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 | ||
41 | import Numeric.LinearAlgebra | 41 | import Numeric.LinearAlgebra |
42 | import Numeric.LinearAlgebra.Tests.Instances(Sq(..),Her(..),Rot(..)) | ||
43 | import Test.QuickCheck | 42 | import Test.QuickCheck |
44 | import Debug.Trace | 43 | -- import Debug.Trace |
45 | 44 | ||
46 | debug x = trace (show x) x | 45 | -- debug x = trace (show x) x |
47 | 46 | ||
48 | -- relative error | 47 | -- relative error |
49 | dist :: (Normed t, Num t) => t -> t -> Double | 48 | dist :: (Normed t, Num t) => t -> t -> Double |
@@ -77,7 +76,7 @@ hermitian m = square m && m |~| ctrans m | |||
77 | wellCond m = rcond m > 1/100 | 76 | wellCond m = rcond m > 1/100 |
78 | 77 | ||
79 | positiveDefinite m = minimum (toList e) > 0 | 78 | positiveDefinite m = minimum (toList e) > 0 |
80 | where (e,v) = eigSH m | 79 | where (e,_v) = eigSH m |
81 | 80 | ||
82 | upperTriang m = rows m == 1 || down == z | 81 | upperTriang 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 | ||
108 | detProp m = s d1 |~| s d2 | 107 | detProp 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 | ||
148 | cholProp m = m |~| ctrans c <> c && upperTriang c | 147 | cholProp 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 | ||
152 | expmDiagProp m = expm (logm m) :~ 7 ~: complex m | 151 | expmDiagProp m = expm (logm m) :~ 7 ~: complex m |
153 | where logm m = matFunc log m | 152 | where logm = matFunc log |
154 | 153 | ||
155 | multProp1 (a,b) = a <> b |~| mulH a b | 154 | multProp1 (a,b) = a <> b |~| mulH a b |
156 | 155 | ||