summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/LAPACK.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-12-03 10:43:52 +0000
committerAlberto Ruiz <aruiz@um.es>2007-12-03 10:43:52 +0000
commitc520939e33cc895febed271d5c3218457317bba9 (patch)
tree8661410a5cb946a3ae40e0c0fbacccccd0fd5ada /lib/Numeric/LinearAlgebra/LAPACK.hs
parentd7d3b731c037fca41bd9128c3da2a582189cb4d9 (diff)
lapack lu
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK.hs21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs
index cacad87..83db901 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK.hs
+++ b/lib/Numeric/LinearAlgebra/LAPACK.hs
@@ -19,6 +19,7 @@ module Numeric.LinearAlgebra.LAPACK (
19 linearSolveR, linearSolveC, 19 linearSolveR, linearSolveC,
20 linearSolveLSR, linearSolveLSC, 20 linearSolveLSR, linearSolveLSC,
21 linearSolveSVDR, linearSolveSVDC, 21 linearSolveSVDR, linearSolveSVDC,
22 luR, luC,
22 cholS, cholH, 23 cholS, cholH,
23 qrR, qrC, 24 qrR, qrC,
24 hessR, hessC, 25 hessR, hessC,
@@ -299,7 +300,7 @@ hessAux f st a = unsafePerformIO $ do
299 mn = min m n 300 mn = min m n
300 301
301----------------------------------------------------------------------------------- 302-----------------------------------------------------------------------------------
302foreign import ccall safe "LAPACK/lapack-aux.h schur_l_R" dgees :: TMMM 303foreign import ccall "LAPACK/lapack-aux.h schur_l_R" dgees :: TMMM
303foreign import ccall "LAPACK/lapack-aux.h schur_l_C" zgees :: TCMCMCM 304foreign import ccall "LAPACK/lapack-aux.h schur_l_C" zgees :: TCMCMCM
304 305
305-- | Wrapper for LAPACK's /dgees/, which computes a Schur factorization of a square real matrix. 306-- | Wrapper for LAPACK's /dgees/, which computes a Schur factorization of a square real matrix.
@@ -318,3 +319,21 @@ schurAux f st a = unsafePerformIO $ do
318 where n = rows a 319 where n = rows a
319 320
320----------------------------------------------------------------------------------- 321-----------------------------------------------------------------------------------
322foreign import ccall "LAPACK/lapack-aux.h lu_l_R" dgetrf :: TMVM
323foreign import ccall "LAPACK/lapack-aux.h lu_l_C" zgetrf :: TCMVCM
324
325-- | Wrapper for LAPACK's /dgetrf/, which computes a LU factorization of a general real matrix.
326luR :: Matrix Double -> (Matrix Double, [Int])
327luR = luAux dgetrf "luR" . fmat
328
329-- | Wrapper for LAPACK's /zgees/, which computes a Schur factorization of a square complex matrix.
330luC :: Matrix (Complex Double) -> (Matrix (Complex Double), [Int])
331luC = luAux zgetrf "luC" . fmat
332
333luAux f st a = unsafePerformIO $ do
334 lu <- createMatrix ColumnMajor n m
335 piv <- createVector (min n m)
336 app3 f mat a vec piv mat lu st
337 return (lu, map (pred.round) (toList piv))
338 where n = rows a
339 m = cols a