summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/LAPACK.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs
index 83db901..d78b506 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK.hs
+++ b/lib/Numeric/LinearAlgebra/LAPACK.hs
@@ -19,7 +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 luR, luC, lusR,
23 cholS, cholH, 23 cholS, cholH,
24 qrR, qrC, 24 qrR, qrC,
25 hessR, hessC, 25 hessR, hessC,
@@ -337,3 +337,18 @@ luAux f st a = unsafePerformIO $ do
337 return (lu, map (pred.round) (toList piv)) 337 return (lu, map (pred.round) (toList piv))
338 where n = rows a 338 where n = rows a
339 m = cols a 339 m = cols a
340
341
342-----------------------------------------------------------------------------------
343foreign import ccall "LAPACK/lapack-aux.h luS_l_R" dgetrs :: TMVMM
344
345lusR :: Matrix Double -> [Int] -> Matrix Double -> Matrix Double
346lusR a piv b = lusR' (fmat a) piv (fmat b)
347
348lusR' a piv b = unsafePerformIO $ do
349 x <- createMatrix ColumnMajor n m
350 app4 dgetrs mat a vec piv' mat b mat x "lusR"
351 return x
352 where n = rows b
353 m = cols b
354 piv' = fromList (map (fromIntegral.succ) piv) :: Vector Double