summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-10-02 18:59:50 +0000
committerAlberto Ruiz <aruiz@um.es>2007-10-02 18:59:50 +0000
commit42bec1ac9911131b552f66779203eb599a86563d (patch)
treec4aefaedb21730644fcd4d2f85d830fe4d4daf07 /examples
parentd925bada507562250a75587c409bdb35bbbc6ed8 (diff)
lapack real and complex unpacked QR
Diffstat (limited to 'examples')
-rw-r--r--examples/tests.hs14
-rw-r--r--examples/useStatic.hs (renamed from examples/usaStatic.hs)0
2 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)
7import Numeric.LinearAlgebra 7import Numeric.LinearAlgebra
8import Numeric.LinearAlgebra.Linear(Linear) 8import Numeric.LinearAlgebra.Linear(Linear)
9import Numeric.LinearAlgebra.LAPACK 9import Numeric.LinearAlgebra.LAPACK
10import Numeric.GSL.Matrix 10import Numeric.GSL.Matrix(svdg)
11import qualified Numeric.GSL.Matrix as GSL
11import Test.QuickCheck hiding (test) 12import Test.QuickCheck hiding (test)
12import Test.HUnit hiding ((~:),test) 13import Test.HUnit hiding ((~:),test)
13import System.Random(randomRs,mkStdGen) 14import 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
275qrTest qr m = q <> r |~| m -- && q <> ctrans q |~| ident (rows m)
276 where (q,r) = qr m
277
278---------------------------------------------------------------------
279
274asFortran m = (rows m >|< cols m) $ toList (fdat m) 280asFortran m = (rows m >|< cols m) $ toList (fdat m)
275asC m = (rows m >< cols m) $ toList (cdat m) 281asC 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)
diff --git a/examples/usaStatic.hs b/examples/useStatic.hs
index 619af8f..619af8f 100644
--- a/examples/usaStatic.hs
+++ b/examples/useStatic.hs