summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-10-27 13:32:18 +0000
committerAlberto Ruiz <aruiz@um.es>2007-10-27 13:32:18 +0000
commit7954e066f7181861ea8ebf348ca09c9ede9afc89 (patch)
tree3608c91b4e043c26ba8cc11e00161f9a51c5cfd3 /examples
parent6d9d36c92a7509f72342fcbbcb3a754d50ad97f3 (diff)
expm test
Diffstat (limited to 'examples')
-rw-r--r--examples/tests.hs13
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
219rank m | m |~| 0 = 0
220 | otherwise = dim s where (_,s,_) = economy svd m
221
222zeros (r,c) = reshape c (constant 0 (r*c)) 219zeros (r,c) = reshape c (constant 0 (r*c))
223 220
224ones (r,c) = zeros (r,c) + 1 221ones (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
300expmTest m = expm (logm m) |~| complex m
301 where logm m = matFunc Prelude.log m
302
303---------------------------------------------------------------------
304
303asFortran m = (rows m >|< cols m) $ toList (fdat m) 305asFortran m = (rows m >|< cols m) $ toList (fdat m)
304asC m = (rows m >< cols m) $ toList (cdat m) 306asC 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)