diff options
Diffstat (limited to 'packages/tests/src/Numeric/LinearAlgebra')
3 files changed, 10 insertions, 11 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index 30480d7..ecda6c1 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -500,10 +500,10 @@ sliceTest = utest "slice test" $ and | |||
500 | , testSlice (test_qrgr 4 tau2) qrr2 | 500 | , testSlice (test_qrgr 4 tau2) qrr2 |
501 | ] | 501 | ] |
502 | where | 502 | where |
503 | (qrr1,tau1) = qrRaw (rec :: Matrix R) | 503 | QR qrr1 tau1 = qrRaw (rec :: Matrix R) |
504 | (qrr2,tau2) = qrRaw (rec :: Matrix C) | 504 | QR qrr2 tau2 = qrRaw (rec :: Matrix C) |
505 | 505 | ||
506 | test_qrgr n t x = qrgr n (x,t) | 506 | test_qrgr n t x = qrgr n (QR x t) |
507 | 507 | ||
508 | ok_qrgr x = simeq 1E-15 q q' | 508 | ok_qrgr x = simeq 1E-15 q q' |
509 | where | 509 | where |
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs index 4704989..3d5441d 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs | |||
@@ -81,8 +81,7 @@ instance (Field a, Arbitrary a) => Arbitrary (Rot a) where | |||
81 | 81 | ||
82 | 82 | ||
83 | -- a complex hermitian or real symmetric matrix | 83 | -- a complex hermitian or real symmetric matrix |
84 | --newtype (Her a) = Her (Matrix a) deriving Show | 84 | instance (Field a, Arbitrary a, Num (Vector a)) => Arbitrary (Herm a) where |
85 | instance (Field a, Arbitrary a, Num (Vector a)) => Arbitrary (Her a) where | ||
86 | arbitrary = do | 85 | arbitrary = do |
87 | Sq m <- arbitrary | 86 | Sq m <- arbitrary |
88 | let m' = m/2 | 87 | let m' = m/2 |
@@ -127,7 +126,7 @@ instance (Numeric a, ArbitraryField a, Num (Vector a)) | |||
127 | arbitrary = do | 126 | arbitrary = do |
128 | m <- arbitrary | 127 | m <- arbitrary |
129 | let (_,v) = eigSH m | 128 | let (_,v) = eigSH m |
130 | n = rows (her m) | 129 | n = rows (unSym m) |
131 | l <- replicateM n (choose (0,100)) | 130 | l <- replicateM n (choose (0,100)) |
132 | let s = diag (fromList l) | 131 | let s = diag (fromList l) |
133 | p = v <> real s <> tr v | 132 | p = v <> real s <> tr v |
@@ -161,8 +160,8 @@ fM m = m :: FM | |||
161 | zM m = m :: ZM | 160 | zM m = m :: ZM |
162 | 161 | ||
163 | 162 | ||
164 | rHer m = her m :: RM | 163 | rHer m = unSym m :: RM |
165 | cHer m = her m :: CM | 164 | cHer m = unSym m :: CM |
166 | 165 | ||
167 | rRot (Rot m) = m :: RM | 166 | rRot (Rot m) = m :: RM |
168 | cRot (Rot m) = m :: CM | 167 | cRot (Rot m) = m :: CM |
@@ -176,8 +175,8 @@ cWC (WC m) = m :: CM | |||
176 | rSqWC (SqWC m) = m :: RM | 175 | rSqWC (SqWC m) = m :: RM |
177 | cSqWC (SqWC m) = m :: CM | 176 | cSqWC (SqWC m) = m :: CM |
178 | 177 | ||
179 | rSymWC (SqWC m) = sym m :: Her R | 178 | rSymWC (SqWC m) = sym m :: Herm R |
180 | cSymWC (SqWC m) = sym m :: Her C | 179 | cSymWC (SqWC m) = sym m :: Herm C |
181 | 180 | ||
182 | rPosDef (PosDef m) = m :: RM | 181 | rPosDef (PosDef m) = m :: RM |
183 | cPosDef (PosDef m) = m :: CM | 182 | cPosDef (PosDef m) = m :: CM |
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs index 2ac3588..720b7bd 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs | |||
@@ -263,7 +263,7 @@ multProp2 p (a,b) = (tr (a <> b)) :~p~: (tr b <> tr a) | |||
263 | 263 | ||
264 | linearSolveProp f m = f m m |~| ident (rows m) | 264 | linearSolveProp f m = f m m |~| ident (rows m) |
265 | 265 | ||
266 | linearSolvePropH f m = f m (her m) |~| ident (rows (her m)) | 266 | linearSolvePropH f m = f m (unSym m) |~| ident (rows (unSym m)) |
267 | 267 | ||
268 | linearSolveProp2 f (a,x) = not wc `trivial` (not wc || a <> f a b |~| b) | 268 | linearSolveProp2 f (a,x) = not wc `trivial` (not wc || a <> f a b |~| b) |
269 | where q = min (rows a) (cols a) | 269 | where q = min (rows a) (cols a) |