diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-10-27 13:32:18 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-10-27 13:32:18 +0000 |
commit | 7954e066f7181861ea8ebf348ca09c9ede9afc89 (patch) | |
tree | 3608c91b4e043c26ba8cc11e00161f9a51c5cfd3 /examples/tests.hs | |
parent | 6d9d36c92a7509f72342fcbbcb3a754d50ad97f3 (diff) |
expm test
Diffstat (limited to 'examples/tests.hs')
-rw-r--r-- | examples/tests.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/examples/tests.hs b/examples/tests.hs index e2f0dd5..7b85a9b 100644 --- a/examples/tests.hs +++ b/examples/tests.hs | |||
@@ -216,9 +216,6 @@ eigTestSH m = m <> v |~| v <> real (diag s) | |||
216 | && m |~| v <> real (diag s) <> ctrans v | 216 | && m |~| v <> real (diag s) <> ctrans v |
217 | where (s, v) = eigSH m | 217 | where (s, v) = eigSH m |
218 | 218 | ||
219 | rank m | m |~| 0 = 0 | ||
220 | | otherwise = dim s where (_,s,_) = economy svd m | ||
221 | |||
222 | zeros (r,c) = reshape c (constant 0 (r*c)) | 219 | zeros (r,c) = reshape c (constant 0 (r*c)) |
223 | 220 | ||
224 | ones (r,c) = zeros (r,c) + 1 | 221 | ones (r,c) = zeros (r,c) + 1 |
@@ -300,6 +297,11 @@ schurTest2 m = m |~| u <> s <> ctrans u && unitary u && upperHessenberg s -- fix | |||
300 | 297 | ||
301 | --------------------------------------------------------------------- | 298 | --------------------------------------------------------------------- |
302 | 299 | ||
300 | expmTest m = expm (logm m) |~| complex m | ||
301 | where logm m = matFunc Prelude.log m | ||
302 | |||
303 | --------------------------------------------------------------------- | ||
304 | |||
303 | asFortran m = (rows m >|< cols m) $ toList (fdat m) | 305 | asFortran m = (rows m >|< cols m) $ toList (fdat m) |
304 | asC m = (rows m >< cols m) $ toList (cdat m) | 306 | asC m = (rows m >< cols m) $ toList (cdat m) |
305 | 307 | ||
@@ -367,6 +369,11 @@ tests = do | |||
367 | if os == "mingw32" | 369 | if os == "mingw32" |
368 | then putStrLn "complex schur skipped in this OS" | 370 | then putStrLn "complex schur skipped in this OS" |
369 | else quickCheck (schurTest1 . sqm ::SqM (Complex Double) -> Bool) | 371 | else quickCheck (schurTest1 . sqm ::SqM (Complex Double) -> Bool) |
372 | putStrLn "--------- expm --------" | ||
373 | runTestTT $ TestList | ||
374 | [ test "expmd" (expmTest $ (2><2) [1,2,3,5 :: Double]) | ||
375 | --, test "expmnd" (expmTest $ (2><2) [1,0,1,1 :: Double]) | ||
376 | ] | ||
370 | putStrLn "--------- nullspace ------" | 377 | putStrLn "--------- nullspace ------" |
371 | quickCheck (nullspaceTest :: RM -> Bool) | 378 | quickCheck (nullspaceTest :: RM -> Bool) |
372 | quickCheck (nullspaceTest :: CM -> Bool) | 379 | quickCheck (nullspaceTest :: CM -> Bool) |