summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Algorithms.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-10-23 13:30:33 +0000
committerAlberto Ruiz <aruiz@um.es>2008-10-23 13:30:33 +0000
commitce8fed3a3558468b128a03cc4c96aa6c11357b4d (patch)
treeff5fa5486e17007b06bfcdaf35779b828d102941 /lib/Numeric/LinearAlgebra/Algorithms.hs
parentfaeaf6d261b760e628c1e63551d822d16876c0cc (diff)
NaN problem solved with asm(finit)
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs54
1 files changed, 1 insertions, 53 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index 45298b5..e2fec9d 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -139,16 +139,8 @@ instance Field (Complex Double) where
139 qr = unpackQR . qrC 139 qr = unpackQR . qrC
140 hess = unpackHess hessC 140 hess = unpackHess hessC
141 schur = schurC 141 schur = schurC
142
143#if defined(WORKAROUND)
144 multiply = mulCW
145#else
146#if defined(EXPOSEBUG)
147 multiply = multiplyC
148#else
149 multiply = multiplyC3 142 multiply = multiplyC3
150#endif 143
151#endif
152 144
153-- | Eigenvalues and Eigenvectors of a complex hermitian or real symmetric matrix using lapack's dsyev or zheev. 145-- | Eigenvalues and Eigenvectors of a complex hermitian or real symmetric matrix using lapack's dsyev or zheev.
154-- 146--
@@ -639,47 +631,3 @@ multiplyC3 x y = unsafePerformIO $ multiply3 zgemm "cblas_zgemm" (fmat x) (fmat
639 return s 631 return s
640 -- if toLists s== toLists s then return s else error $ "HORROR " ++ (show (toLists s)) 632 -- if toLists s== toLists s then return s else error $ "HORROR " ++ (show (toLists s))
641 | otherwise = error $ st ++ " (matrix product) of nonconformant matrices" 633 | otherwise = error $ st ++ " (matrix product) of nonconformant matrices"
642
643-----------------------------------------------------------------------------------
644-- BLAS via auxiliary C
645-----------------------------------------------------------------------------------
646
647-- foreign import ccall "multiply.h multiplyR2" dgemmc :: TMMM
648-- foreign import ccall "multiply.h multiplyC2" zgemmc :: TCMCMCM
649--
650-- multiply2 f st a b
651-- | cols a == rows b = unsafePerformIO $ do
652-- s <- createMatrix ColumnMajor (rows a) (cols b)
653-- app3 f mat a mat b mat s st
654-- if toLists s== toLists s then return s else error $ "AYYY " ++ (show (toLists s))
655-- | otherwise = error $ st ++ " (matrix product) of nonconformant matrices"
656--
657-- multiplyR2 :: Matrix Double -> Matrix Double -> Matrix Double
658-- multiplyR2 a b = multiply2 dgemmc "dgemmc" (fmat a) (fmat b)
659--
660-- multiplyC2 :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double)
661-- multiplyC2 a b = multiply2 zgemmc "zgemmc" (fmat a) (fmat b)
662
663-----------------------------------------------------------------------------------
664-- direct C multiplication, to expose the NaN bug
665-----------------------------------------------------------------------------------
666
667-- foreign import ccall "multiply.h multiplyR" cmultiplyR :: TMMM
668foreign import ccall "multiply.h multiplyC" cmultiplyC :: TCMCMCM
669
670cmultiply f st a b
671-- | cols a == rows b =
672 = unsafePerformIO $ do
673 s <- createMatrix RowMajor (rows a) (cols b)
674 app3 f mat a mat b mat s st
675 if toLists s== toLists s
676 then return s
677 else error $ "NaN FOUND!! " ++ (show (toLists s))
678 -- return s
679-- | otherwise = error $ st ++ " (matrix product) of nonconformant matrices"
680
681-- multiplyR :: Matrix Double -> Matrix Double -> Matrix Double
682-- multiplyR a b = cmultiply cmultiplyR "cmultiplyR" (cmat a) (cmat b)
683
684multiplyC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double)
685multiplyC a b = cmultiply cmultiplyC "cmultiplyR" (cmat a) (cmat b)