diff options
author | Alberto Ruiz <aruiz@um.es> | 2008-02-21 19:00:22 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2008-02-21 19:00:22 +0000 |
commit | e5387206db024f55c19a62e7b1d324364c5f2d23 (patch) | |
tree | 4aec886e5ed1ded645b132014fb19af72513fa21 /lib/Numeric/LinearAlgebra/Tests.hs | |
parent | bc2dcb1464ed2674e48bbb9372dc6135abe9bd1c (diff) |
working on tests
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests.hs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs new file mode 100644 index 0000000..534eb04 --- /dev/null +++ b/lib/Numeric/LinearAlgebra/Tests.hs | |||
@@ -0,0 +1,67 @@ | |||
1 | ----------------------------------------------------------------------------- | ||
2 | {- | | ||
3 | Module : Numeric.LinearAlgebra.Tests | ||
4 | Copyright : (c) Alberto Ruiz 2007 | ||
5 | License : GPL-style | ||
6 | |||
7 | Maintainer : Alberto Ruiz (aruiz at um dot es) | ||
8 | Stability : provisional | ||
9 | Portability : portable | ||
10 | |||
11 | Some tests. | ||
12 | |||
13 | -} | ||
14 | |||
15 | module Numeric.LinearAlgebra.Tests( | ||
16 | module Numeric.LinearAlgebra.Tests.Instances, | ||
17 | module Numeric.LinearAlgebra.Tests.Properties, | ||
18 | qCheck,RM,CM, rM,cM, rHer,cHer,rRot,cRot,rSq,cSq, | ||
19 | runTests | ||
20 | --, runBigTests | ||
21 | ) where | ||
22 | |||
23 | import Numeric.LinearAlgebra | ||
24 | import Numeric.LinearAlgebra.Tests.Instances | ||
25 | import Numeric.LinearAlgebra.Tests.Properties | ||
26 | import Test.QuickCheck | ||
27 | import Debug.Trace | ||
28 | |||
29 | qCheck n = check defaultConfig {configSize = const n} | ||
30 | |||
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. | ||
52 | runTests :: Int -- ^ maximum dimension | ||
53 | -> IO () | ||
54 | runTests n = do | ||
55 | qCheck n (hermitian . rHer) | ||
56 | qCheck n (hermitian . cHer) | ||
57 | qCheck n (unitary . rRot) | ||
58 | qCheck n (unitary . cRot) | ||
59 | qCheck n (wellCond . rWC) | ||
60 | qCheck n (wellCond . cWC) | ||
61 | -------------------------------- | ||
62 | qCheck n (luTest . rM) | ||
63 | qCheck n (luTest . cM) | ||
64 | |||
65 | -- | Some additional tests on big matrices. They take a few minutes. | ||
66 | runBigTests :: IO () | ||
67 | runBigTests = undefined | ||