diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-10-02 18:59:50 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-10-02 18:59:50 +0000 |
commit | 42bec1ac9911131b552f66779203eb599a86563d (patch) | |
tree | c4aefaedb21730644fcd4d2f85d830fe4d4daf07 /examples/tests.hs | |
parent | d925bada507562250a75587c409bdb35bbbc6ed8 (diff) |
lapack real and complex unpacked QR
Diffstat (limited to 'examples/tests.hs')
-rw-r--r-- | examples/tests.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/examples/tests.hs b/examples/tests.hs index b088069..b3272cf 100644 --- a/examples/tests.hs +++ b/examples/tests.hs | |||
@@ -7,7 +7,8 @@ import Numeric.GSL hiding (sin,cos,exp,choose) | |||
7 | import Numeric.LinearAlgebra | 7 | import Numeric.LinearAlgebra |
8 | import Numeric.LinearAlgebra.Linear(Linear) | 8 | import Numeric.LinearAlgebra.Linear(Linear) |
9 | import Numeric.LinearAlgebra.LAPACK | 9 | import Numeric.LinearAlgebra.LAPACK |
10 | import Numeric.GSL.Matrix | 10 | import Numeric.GSL.Matrix(svdg) |
11 | import qualified Numeric.GSL.Matrix as GSL | ||
11 | import Test.QuickCheck hiding (test) | 12 | import Test.QuickCheck hiding (test) |
12 | import Test.HUnit hiding ((~:),test) | 13 | import Test.HUnit hiding ((~:),test) |
13 | import System.Random(randomRs,mkStdGen) | 14 | import System.Random(randomRs,mkStdGen) |
@@ -271,6 +272,11 @@ cholCTest = chol ((2><2) [1,2,2,9::Complex Double]) == (2><2) [1,2,0,2.236067977 | |||
271 | 272 | ||
272 | --------------------------------------------------------------------- | 273 | --------------------------------------------------------------------- |
273 | 274 | ||
275 | qrTest qr m = q <> r |~| m -- && q <> ctrans q |~| ident (rows m) | ||
276 | where (q,r) = qr m | ||
277 | |||
278 | --------------------------------------------------------------------- | ||
279 | |||
274 | asFortran m = (rows m >|< cols m) $ toList (fdat m) | 280 | asFortran m = (rows m >|< cols m) $ toList (fdat m) |
275 | asC m = (rows m >< cols m) $ toList (cdat m) | 281 | asC m = (rows m >< cols m) $ toList (cdat m) |
276 | 282 | ||
@@ -322,6 +328,12 @@ tests = do | |||
322 | [ test "cholR" cholRTest | 328 | [ test "cholR" cholRTest |
323 | , test "cholC" cholRTest | 329 | , test "cholC" cholRTest |
324 | ] | 330 | ] |
331 | putStrLn "--------- qr ---------" | ||
332 | quickCheck (qrTest GSL.qr) | ||
333 | quickCheck (qrTest (GSL.unpackQR . GSL.qrPacked)) | ||
334 | quickCheck (qrTest ( unpackQR . GSL.qrPacked)) | ||
335 | quickCheck (qrTest qr ::RM->Bool) | ||
336 | quickCheck (qrTest qr ::CM->Bool) | ||
325 | putStrLn "--------- nullspace ------" | 337 | putStrLn "--------- nullspace ------" |
326 | quickCheck (nullspaceTest :: RM -> Bool) | 338 | quickCheck (nullspaceTest :: RM -> Bool) |
327 | quickCheck (nullspaceTest :: CM -> Bool) | 339 | quickCheck (nullspaceTest :: CM -> Bool) |