diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-22 11:50:06 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-22 11:50:06 +0200 |
commit | 9c4406534e826badee79b1fe585c9c11f0fa01a5 (patch) | |
tree | 469319e5c7074876884028117c01c292d628c82e /packages/tests | |
parent | 5158a1717f1d4caee25669a0781602fe64787302 (diff) |
sparse test, fix peps in rank test
Diffstat (limited to 'packages/tests')
3 files changed, 10 insertions, 5 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index 55a805a..5fdc5af 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -25,8 +25,8 @@ module Numeric.LinearAlgebra.Tests( | |||
25 | ) where | 25 | ) where |
26 | 26 | ||
27 | --import Data.Packed.Random | 27 | --import Data.Packed.Random |
28 | import Numeric.LinearAlgebra.Compat | 28 | import Numeric.LinearAlgebra |
29 | import Numeric.LinearAlgebra.Util(row,col) | 29 | import Numeric.LinearAlgebra.Util(col,row) |
30 | import Data.Packed | 30 | import Data.Packed |
31 | import Numeric.LinearAlgebra.LAPACK | 31 | import Numeric.LinearAlgebra.LAPACK |
32 | import Numeric.LinearAlgebra.Tests.Instances | 32 | import Numeric.LinearAlgebra.Tests.Instances |
@@ -56,6 +56,9 @@ import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector | |||
56 | 56 | ||
57 | import Test.QuickCheck.Test(isSuccess) | 57 | import Test.QuickCheck.Test(isSuccess) |
58 | 58 | ||
59 | eps = peps :: Double | ||
60 | i = 0:+1 :: Complex Double | ||
61 | |||
59 | qCheck n x = do | 62 | qCheck n x = do |
60 | r <- quickCheckWithResult stdArgs {maxSize = n} x | 63 | r <- quickCheckWithResult stdArgs {maxSize = n} x |
61 | when (not $ isSuccess r) (exitFailure) | 64 | when (not $ isSuccess r) (exitFailure) |
@@ -473,6 +476,7 @@ kroneckerTest = utest "kronecker" ok | |||
473 | 476 | ||
474 | -------------------------------------------------------------------------------- | 477 | -------------------------------------------------------------------------------- |
475 | 478 | ||
479 | sparseTest = utest "sparse mul" (fst $ checkT (undefined :: SMatrix)) | ||
476 | 480 | ||
477 | 481 | ||
478 | -- | All tests must pass with a maximum dimension of about 20 | 482 | -- | All tests must pass with a maximum dimension of about 20 |
@@ -632,7 +636,7 @@ runTests n = do | |||
632 | , utest "buildVector/Matrix" $ | 636 | , utest "buildVector/Matrix" $ |
633 | complex (10 |> [0::Double ..]) == buildVector 10 fromIntegral | 637 | complex (10 |> [0::Double ..]) == buildVector 10 fromIntegral |
634 | && ident 5 == buildMatrix 5 5 (\(r,c) -> if r==c then 1::Double else 0) | 638 | && ident 5 == buildMatrix 5 5 (\(r,c) -> if r==c then 1::Double else 0) |
635 | , utest "rank" $ rank ((2><3)[1,0,0,1,6*eps,0]) == 1 | 639 | , utest "rank" $ rank ((2><3)[1,0,0,1,5*eps,0]) == 1 |
636 | && rank ((2><3)[1,0,0,1,7*eps,0]) == 2 | 640 | && rank ((2><3)[1,0,0,1,7*eps,0]) == 2 |
637 | , utest "block" $ fromBlocks [[ident 3,0],[0,ident 4]] == (ident 7 :: CM) | 641 | , utest "block" $ fromBlocks [[ident 3,0],[0,ident 4]] == (ident 7 :: CM) |
638 | , odeTest | 642 | , odeTest |
@@ -650,6 +654,7 @@ runTests n = do | |||
650 | , accumTest | 654 | , accumTest |
651 | , convolutionTest | 655 | , convolutionTest |
652 | , kroneckerTest | 656 | , kroneckerTest |
657 | , sparseTest | ||
653 | ] | 658 | ] |
654 | when (errors c + failures c > 0) exitFailure | 659 | when (errors c + failures c > 0) exitFailure |
655 | return () | 660 | return () |
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs index b306f94..4f5a5d2 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs | |||
@@ -30,7 +30,7 @@ import System.Random | |||
30 | 30 | ||
31 | import Numeric.LinearAlgebra | 31 | import Numeric.LinearAlgebra |
32 | import Numeric.LinearAlgebra.Devel | 32 | import Numeric.LinearAlgebra.Devel |
33 | import Numeric.Container | 33 | import Numeric.Container hiding (Testable) |
34 | import Control.Monad(replicateM) | 34 | import Control.Monad(replicateM) |
35 | import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector | 35 | import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector |
36 | ,sized,classify,Testable,Property | 36 | ,sized,classify,Testable,Property |
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs index 70d36e8..110ed24 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs | |||
@@ -43,7 +43,7 @@ module Numeric.LinearAlgebra.Tests.Properties ( | |||
43 | linearSolveProp, linearSolveProp2 | 43 | linearSolveProp, linearSolveProp2 |
44 | ) where | 44 | ) where |
45 | 45 | ||
46 | import Numeric.LinearAlgebra.Compat --hiding (real,complex) | 46 | import Numeric.LinearAlgebra.Compat hiding (Testable) --hiding (real,complex) |
47 | import Numeric.LinearAlgebra.LAPACK | 47 | import Numeric.LinearAlgebra.LAPACK |
48 | import Debug.Trace | 48 | import Debug.Trace |
49 | import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector | 49 | import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector |