summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/LAPACK.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-08-26 17:49:45 +0000
committerAlberto Ruiz <aruiz@um.es>2010-08-26 17:49:45 +0000
commit6058e1b17c005be1ea95ebb7d98d9fd15bb538d2 (patch)
treec4277e00c2c92a0ed8f3750255154fa8e2b6fe2d /lib/Numeric/LinearAlgebra/LAPACK.hs
parentf541d7dbdc8338b1dd1c0538751d837a16740bd8 (diff)
Float matrix product
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK.hs18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs
index 7f057ba..eec3035 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK.hs
+++ b/lib/Numeric/LinearAlgebra/LAPACK.hs
@@ -14,7 +14,7 @@
14 14
15module Numeric.LinearAlgebra.LAPACK ( 15module Numeric.LinearAlgebra.LAPACK (
16 -- * Matrix product 16 -- * Matrix product
17 multiplyR, multiplyC, 17 multiplyR, multiplyC, multiplyF, multiplyQ,
18 -- * Linear systems 18 -- * Linear systems
19 linearSolveR, linearSolveC, 19 linearSolveR, linearSolveC,
20 lusR, lusC, 20 lusR, lusC,
@@ -51,8 +51,10 @@ import Control.Monad(when)
51 51
52----------------------------------------------------------------------------------- 52-----------------------------------------------------------------------------------
53 53
54foreign import ccall "LAPACK/lapack-aux.h multiplyR" dgemmc :: CInt -> CInt -> TMMM 54foreign import ccall "multiplyR" dgemmc :: CInt -> CInt -> TMMM
55foreign import ccall "LAPACK/lapack-aux.h multiplyC" zgemmc :: CInt -> CInt -> TCMCMCM 55foreign import ccall "multiplyC" zgemmc :: CInt -> CInt -> TCMCMCM
56foreign import ccall "multiplyF" sgemmc :: CInt -> CInt -> TFMFMFM
57foreign import ccall "multiplyQ" cgemmc :: CInt -> CInt -> TQMQMQM
56 58
57isT MF{} = 0 59isT MF{} = 0
58isT MC{} = 1 60isT MC{} = 1
@@ -69,12 +71,20 @@ multiplyAux f st a b = unsafePerformIO $ do
69 71
70-- | Matrix product based on BLAS's /dgemm/. 72-- | Matrix product based on BLAS's /dgemm/.
71multiplyR :: Matrix Double -> Matrix Double -> Matrix Double 73multiplyR :: Matrix Double -> Matrix Double -> Matrix Double
72multiplyR a b = multiplyAux dgemmc "dgemmc" a b 74multiplyR a b = {-# SCC "multiplyR" #-} multiplyAux dgemmc "dgemmc" a b
73 75
74-- | Matrix product based on BLAS's /zgemm/. 76-- | Matrix product based on BLAS's /zgemm/.
75multiplyC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) 77multiplyC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double)
76multiplyC a b = multiplyAux zgemmc "zgemmc" a b 78multiplyC a b = multiplyAux zgemmc "zgemmc" a b
77 79
80-- | Matrix product based on BLAS's /sgemm/.
81multiplyF :: Matrix Float -> Matrix Float -> Matrix Float
82multiplyF a b = multiplyAux sgemmc "sgemmc" a b
83
84-- | Matrix product based on BLAS's /cgemm/.
85multiplyQ :: Matrix (Complex Float) -> Matrix (Complex Float) -> Matrix (Complex Float)
86multiplyQ a b = multiplyAux cgemmc "cgemmc" a b
87
78----------------------------------------------------------------------------- 88-----------------------------------------------------------------------------
79foreign import ccall "svd_l_R" dgesvd :: TMMVM 89foreign import ccall "svd_l_R" dgesvd :: TMMVM
80foreign import ccall "svd_l_C" zgesvd :: TCMCMVCM 90foreign import ccall "svd_l_C" zgesvd :: TCMCMVCM