diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests/Properties.hs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests/Properties.hs b/lib/Numeric/LinearAlgebra/Tests/Properties.hs index b5f0501..fe13544 100644 --- a/lib/Numeric/LinearAlgebra/Tests/Properties.hs +++ b/lib/Numeric/LinearAlgebra/Tests/Properties.hs | |||
@@ -1,4 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | 1 | {-# LANGUAGE CPP, FlexibleContexts #-} |
2 | {-# OPTIONS_GHC -fno-warn-unused-imports #-} | 2 | {-# OPTIONS_GHC -fno-warn-unused-imports #-} |
3 | ----------------------------------------------------------------------------- | 3 | ----------------------------------------------------------------------------- |
4 | {- | | 4 | {- | |
@@ -29,13 +29,14 @@ module Numeric.LinearAlgebra.Tests.Properties ( | |||
29 | pinvProp, | 29 | pinvProp, |
30 | detProp, | 30 | detProp, |
31 | nullspaceProp, | 31 | nullspaceProp, |
32 | bugProp, | ||
32 | svdProp1, svdProp1a, svdProp1b, svdProp2, svdProp3, svdProp4, | 33 | svdProp1, svdProp1a, svdProp1b, svdProp2, svdProp3, svdProp4, |
33 | svdProp5a, svdProp5b, svdProp6a, svdProp6b, svdProp7, | 34 | svdProp5a, svdProp5b, svdProp6a, svdProp6b, svdProp7, |
34 | eigProp, eigSHProp, eigProp2, eigSHProp2, | 35 | eigProp, eigSHProp, eigProp2, eigSHProp2, |
35 | qrProp, rqProp, rqProp1, rqProp2, rqProp3, | 36 | qrProp, rqProp, rqProp1, rqProp2, rqProp3, |
36 | hessProp, | 37 | hessProp, |
37 | schurProp1, schurProp2, | 38 | schurProp1, schurProp2, |
38 | cholProp, | 39 | cholProp, exactProp, |
39 | expmDiagProp, | 40 | expmDiagProp, |
40 | multProp1, multProp2, | 41 | multProp1, multProp2, |
41 | subProp, | 42 | subProp, |
@@ -132,6 +133,15 @@ nullspaceProp m = null nl `trivial` (null nl || m <> n |~| zeros (r,c) | |||
132 | 133 | ||
133 | ------------------------------------------------------------------ | 134 | ------------------------------------------------------------------ |
134 | 135 | ||
136 | -- testcase for nonempty fpu stack | ||
137 | -- uncommenting unitary' signature eliminates the problem | ||
138 | bugProp m = m |~| u <> real d <> trans v && unitary' u && unitary' v | ||
139 | where (u,d,v) = fullSVD m | ||
140 | -- unitary' :: (Num (Vector t), Field t) => Matrix t -> Bool | ||
141 | unitary' a = unitary a | ||
142 | |||
143 | ------------------------------------------------------------------ | ||
144 | |||
135 | -- fullSVD | 145 | -- fullSVD |
136 | svdProp1 m = m |~| u <> real d <> trans v && unitary u && unitary v | 146 | svdProp1 m = m |~| u <> real d <> trans v && unitary u && unitary v |
137 | where (u,d,v) = fullSVD m | 147 | where (u,d,v) = fullSVD m |
@@ -237,7 +247,8 @@ schurProp2 m = m |~| u <> s <> ctrans u && unitary u && upperHessenberg s -- fix | |||
237 | 247 | ||
238 | cholProp m = m |~| ctrans c <> c && upperTriang c | 248 | cholProp m = m |~| ctrans c <> c && upperTriang c |
239 | where c = chol m | 249 | where c = chol m |
240 | -- pos = positiveDefinite m | 250 | |
251 | exactProp m = chol m == chol (m+0) | ||
241 | 252 | ||
242 | expmDiagProp m = expm (logm m) :~ 7 ~: complex m | 253 | expmDiagProp m = expm (logm m) :~ 7 ~: complex m |
243 | where logm = matFunc log | 254 | where logm = matFunc log |