diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK.hs | 18 |
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 | ||
15 | module Numeric.LinearAlgebra.LAPACK ( | 15 | module 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 | ||
54 | foreign import ccall "LAPACK/lapack-aux.h multiplyR" dgemmc :: CInt -> CInt -> TMMM | 54 | foreign import ccall "multiplyR" dgemmc :: CInt -> CInt -> TMMM |
55 | foreign import ccall "LAPACK/lapack-aux.h multiplyC" zgemmc :: CInt -> CInt -> TCMCMCM | 55 | foreign import ccall "multiplyC" zgemmc :: CInt -> CInt -> TCMCMCM |
56 | foreign import ccall "multiplyF" sgemmc :: CInt -> CInt -> TFMFMFM | ||
57 | foreign import ccall "multiplyQ" cgemmc :: CInt -> CInt -> TQMQMQM | ||
56 | 58 | ||
57 | isT MF{} = 0 | 59 | isT MF{} = 0 |
58 | isT MC{} = 1 | 60 | isT 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/. |
71 | multiplyR :: Matrix Double -> Matrix Double -> Matrix Double | 73 | multiplyR :: Matrix Double -> Matrix Double -> Matrix Double |
72 | multiplyR a b = multiplyAux dgemmc "dgemmc" a b | 74 | multiplyR 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/. |
75 | multiplyC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) | 77 | multiplyC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) |
76 | multiplyC a b = multiplyAux zgemmc "zgemmc" a b | 78 | multiplyC a b = multiplyAux zgemmc "zgemmc" a b |
77 | 79 | ||
80 | -- | Matrix product based on BLAS's /sgemm/. | ||
81 | multiplyF :: Matrix Float -> Matrix Float -> Matrix Float | ||
82 | multiplyF a b = multiplyAux sgemmc "sgemmc" a b | ||
83 | |||
84 | -- | Matrix product based on BLAS's /cgemm/. | ||
85 | multiplyQ :: Matrix (Complex Float) -> Matrix (Complex Float) -> Matrix (Complex Float) | ||
86 | multiplyQ a b = multiplyAux cgemmc "cgemmc" a b | ||
87 | |||
78 | ----------------------------------------------------------------------------- | 88 | ----------------------------------------------------------------------------- |
79 | foreign import ccall "svd_l_R" dgesvd :: TMMVM | 89 | foreign import ccall "svd_l_R" dgesvd :: TMMVM |
80 | foreign import ccall "svd_l_C" zgesvd :: TCMCMVCM | 90 | foreign import ccall "svd_l_C" zgesvd :: TCMCMVCM |