diff options
author | Reiner Pope <unknown> | 2008-10-24 08:59:02 +0000 |
---|---|---|
committer | Reiner Pope <unknown> | 2008-10-24 08:59:02 +0000 |
commit | d8639b28ec9e83b54b45c987508d270d5469451c (patch) | |
tree | ed660ba16b4dd21bd9608fbbde7cc4dcba93f31c /lib/Numeric/LinearAlgebra/LAPACK.hs | |
parent | ce8fed3a3558468b128a03cc4c96aa6c11357b4d (diff) |
added dgetrs support for solving linear systems from LU factorization
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK.hs | 17 |
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 | ----------------------------------------------------------------------------------- | ||
343 | foreign import ccall "LAPACK/lapack-aux.h luS_l_R" dgetrs :: TMVMM | ||
344 | |||
345 | lusR :: Matrix Double -> [Int] -> Matrix Double -> Matrix Double | ||
346 | lusR a piv b = lusR' (fmat a) piv (fmat b) | ||
347 | |||
348 | lusR' 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 | ||