From 3f68d78613ed61540c38548fb3b7e8fca77a85d2 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 28 May 2015 09:17:40 +0200 Subject: use omat for multiplyI --- packages/base/src/Numeric/LinearAlgebra/LAPACK.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'packages/base/src/Numeric') diff --git a/packages/base/src/Numeric/LinearAlgebra/LAPACK.hs b/packages/base/src/Numeric/LinearAlgebra/LAPACK.hs index 219d996..6fb2b13 100644 --- a/packages/base/src/Numeric/LinearAlgebra/LAPACK.hs +++ b/packages/base/src/Numeric/LinearAlgebra/LAPACK.hs @@ -58,7 +58,7 @@ foreign import ccall unsafe "multiplyR" dgemmc :: CInt -> CInt -> TMMM foreign import ccall unsafe "multiplyC" zgemmc :: CInt -> CInt -> TCMCMCM foreign import ccall unsafe "multiplyF" sgemmc :: CInt -> CInt -> TFMFMFM foreign import ccall unsafe "multiplyQ" cgemmc :: CInt -> CInt -> TQMQMQM -foreign import ccall unsafe "multiplyI" c_multiplyI :: CInt -> CInt -> (CM CInt (CM CInt (CM CInt (IO CInt)))) +foreign import ccall unsafe "multiplyI" c_multiplyI :: OM CInt (OM CInt (OM CInt (IO CInt))) isT Matrix{order = ColumnMajor} = 0 isT Matrix{order = RowMajor} = 1 @@ -90,8 +90,12 @@ multiplyQ :: Matrix (Complex Float) -> Matrix (Complex Float) -> Matrix (Complex multiplyQ a b = multiplyAux cgemmc "cgemmc" a b multiplyI :: Matrix CInt -> Matrix CInt -> Matrix CInt -multiplyI = multiplyAux c_multiplyI "c_multiplyI" - +multiplyI a b = unsafePerformIO $ do + when (cols a /= rows b) $ error $ + "inconsistent dimensions in matrix product "++ shSize a ++ " x " ++ shSize b + s <- createMatrix ColumnMajor (rows a) (cols b) + app3 c_multiplyI omat a omat b omat s "c_multiplyI" + return s ----------------------------------------------------------------------------- foreign import ccall unsafe "svd_l_R" dgesvd :: TMMVM -- cgit v1.2.3