diff options
author | Alberto Ruiz <aruiz@um.es> | 2008-02-23 19:35:51 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2008-02-23 19:35:51 +0000 |
commit | 500f5fca244dadab494655aa73d7183df1c87c50 (patch) | |
tree | e02abfcf4db24a538646c6f0982c58dabb3adc63 /lib/Numeric/LinearAlgebra/Tests.hs | |
parent | da54e2f2c27f68c08f4db7551c57b2c1136dc778 (diff) |
working on tests
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests.hs | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs index 534eb04..7ecf812 100644 --- a/lib/Numeric/LinearAlgebra/Tests.hs +++ b/lib/Numeric/LinearAlgebra/Tests.hs | |||
@@ -15,8 +15,7 @@ Some tests. | |||
15 | module Numeric.LinearAlgebra.Tests( | 15 | module Numeric.LinearAlgebra.Tests( |
16 | module Numeric.LinearAlgebra.Tests.Instances, | 16 | module Numeric.LinearAlgebra.Tests.Instances, |
17 | module Numeric.LinearAlgebra.Tests.Properties, | 17 | module Numeric.LinearAlgebra.Tests.Properties, |
18 | qCheck,RM,CM, rM,cM, rHer,cHer,rRot,cRot,rSq,cSq, | 18 | qCheck, runTests |
19 | runTests | ||
20 | --, runBigTests | 19 | --, runBigTests |
21 | ) where | 20 | ) where |
22 | 21 | ||
@@ -24,43 +23,41 @@ import Numeric.LinearAlgebra | |||
24 | import Numeric.LinearAlgebra.Tests.Instances | 23 | import Numeric.LinearAlgebra.Tests.Instances |
25 | import Numeric.LinearAlgebra.Tests.Properties | 24 | import Numeric.LinearAlgebra.Tests.Properties |
26 | import Test.QuickCheck | 25 | import Test.QuickCheck |
27 | import Debug.Trace | 26 | import Numeric.GSL(setErrorHandlerOff) |
28 | 27 | ||
29 | qCheck n = check defaultConfig {configSize = const n} | 28 | qCheck n = check defaultConfig {configSize = const n} |
30 | 29 | ||
31 | debug x = trace (show x) x | ||
32 | |||
33 | type RM = Matrix Double | ||
34 | type CM = Matrix (Complex Double) | ||
35 | |||
36 | rM m = m :: RM | ||
37 | cM m = m :: CM | ||
38 | |||
39 | rHer (Her m) = m :: RM | ||
40 | cHer (Her m) = m :: CM | ||
41 | |||
42 | rRot (Rot m) = m :: RM | ||
43 | cRot (Rot m) = m :: CM | ||
44 | |||
45 | rSq (Sq m) = m :: RM | ||
46 | cSq (Sq m) = m :: CM | ||
47 | |||
48 | rWC (WC m) = m :: RM | ||
49 | cWC (WC m) = m :: CM | ||
50 | |||
51 | -- | It runs all the tests. | 30 | -- | It runs all the tests. |
52 | runTests :: Int -- ^ maximum dimension | 31 | runTests :: Int -- ^ maximum dimension |
53 | -> IO () | 32 | -> IO () |
54 | runTests n = do | 33 | runTests n = do |
55 | qCheck n (hermitian . rHer) | 34 | setErrorHandlerOff |
56 | qCheck n (hermitian . cHer) | 35 | let test p = qCheck n p |
57 | qCheck n (unitary . rRot) | 36 | test (luProp . rM) |
58 | qCheck n (unitary . cRot) | 37 | test (luProp . cM) |
59 | qCheck n (wellCond . rWC) | 38 | test (invProp . rSqWC) |
60 | qCheck n (wellCond . cWC) | 39 | test (invProp . cSqWC) |
61 | -------------------------------- | 40 | test (pinvProp . rM) |
62 | qCheck n (luTest . rM) | 41 | test (pinvProp . cM) |
63 | qCheck n (luTest . cM) | 42 | test (detProp . cSqWC) |
43 | test (svdProp1 . rM) | ||
44 | test (svdProp1 . cM) | ||
45 | test (svdProp2 . rM) | ||
46 | test (svdProp2 . cM) | ||
47 | test (eigSHProp . rHer) | ||
48 | test (eigSHProp . cHer) | ||
49 | test (eigProp . rSq) | ||
50 | test (eigProp . cSq) | ||
51 | test (nullspaceProp . rM) | ||
52 | test (nullspaceProp . cM) | ||
53 | test (qrProp . rM) | ||
54 | test (qrProp . cM) | ||
55 | test (hessProp . rSq) | ||
56 | test (hessProp . cSq) | ||
57 | test (schurProp2 . rSq) | ||
58 | test (schurProp1 . cSq) | ||
59 | test (cholProp . rPosDef) | ||
60 | test (cholProp . cPosDef) | ||
64 | 61 | ||
65 | -- | Some additional tests on big matrices. They take a few minutes. | 62 | -- | Some additional tests on big matrices. They take a few minutes. |
66 | runBigTests :: IO () | 63 | runBigTests :: IO () |