diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-03-27 18:36:53 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-03-27 18:36:53 +0000 |
commit | 9a0c3092e572f6bd11329e9acabc6470ef438203 (patch) | |
tree | 3f095fa9fe219c30a5b56df3dc46dfa64e7e38f3 /lib/Numeric/LinearAlgebra/LAPACK.hs | |
parent | bd1de48eb723b792cad02ecd8f4434078552839b (diff) |
cholSolve
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK.hs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs index a1ac1cf..5d4eb0d 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK.hs +++ b/lib/Numeric/LinearAlgebra/LAPACK.hs | |||
@@ -18,6 +18,7 @@ module Numeric.LinearAlgebra.LAPACK ( | |||
18 | -- * Linear systems | 18 | -- * Linear systems |
19 | linearSolveR, linearSolveC, | 19 | linearSolveR, linearSolveC, |
20 | lusR, lusC, | 20 | lusR, lusC, |
21 | cholSolveR, cholSolveC, | ||
21 | linearSolveLSR, linearSolveLSC, | 22 | linearSolveLSR, linearSolveLSC, |
22 | linearSolveSVDR, linearSolveSVDC, | 23 | linearSolveSVDR, linearSolveSVDC, |
23 | -- * SVD | 24 | -- * SVD |
@@ -312,8 +313,10 @@ eigOnlyH = vrev . fst. eigSHAux (zheev 1) "eigH'" . fmat | |||
312 | vrev = flatten . flipud . reshape 1 | 313 | vrev = flatten . flipud . reshape 1 |
313 | 314 | ||
314 | ----------------------------------------------------------------------------- | 315 | ----------------------------------------------------------------------------- |
315 | foreign import ccall "LAPACK/lapack-aux.h linearSolveR_l" dgesv :: TMMM | 316 | foreign import ccall "linearSolveR_l" dgesv :: TMMM |
316 | foreign import ccall "LAPACK/lapack-aux.h linearSolveC_l" zgesv :: TCMCMCM | 317 | foreign import ccall "linearSolveC_l" zgesv :: TCMCMCM |
318 | foreign import ccall "cholSolveR_l" dpotrs :: TMMM | ||
319 | foreign import ccall "cholSolveC_l" zpotrs :: TCMCMCM | ||
317 | 320 | ||
318 | linearSolveSQAux f st a b | 321 | linearSolveSQAux f st a b |
319 | | n1==n2 && n1==r = unsafePerformIO $ do | 322 | | n1==n2 && n1==r = unsafePerformIO $ do |
@@ -334,6 +337,15 @@ linearSolveR a b = linearSolveSQAux dgesv "linearSolveR" (fmat a) (fmat b) | |||
334 | linearSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) | 337 | linearSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) |
335 | linearSolveC a b = linearSolveSQAux zgesv "linearSolveC" (fmat a) (fmat b) | 338 | linearSolveC a b = linearSolveSQAux zgesv "linearSolveC" (fmat a) (fmat b) |
336 | 339 | ||
340 | |||
341 | -- | Solves a symmetric positive definite system of linear equations using a precomputed Cholesky factorization obtained by 'cholS'. | ||
342 | cholSolveR :: Matrix Double -> Matrix Double -> Matrix Double | ||
343 | cholSolveR a b = linearSolveSQAux dpotrs "cholSolveR" (fmat a) (fmat b) | ||
344 | |||
345 | -- | Solves a Hermitian positive definite system of linear equations using a precomputed Cholesky factorization obtained by 'cholH'. | ||
346 | cholSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double) | ||
347 | cholSolveC a b = linearSolveSQAux zpotrs "cholSolveC" (fmat a) (fmat b) | ||
348 | |||
337 | ----------------------------------------------------------------------------------- | 349 | ----------------------------------------------------------------------------------- |
338 | foreign import ccall "LAPACK/lapack-aux.h linearSolveLSR_l" dgels :: TMMM | 350 | foreign import ccall "LAPACK/lapack-aux.h linearSolveLSR_l" dgels :: TMMM |
339 | foreign import ccall "LAPACK/lapack-aux.h linearSolveLSC_l" zgels :: TCMCMCM | 351 | foreign import ccall "LAPACK/lapack-aux.h linearSolveLSC_l" zgels :: TCMCMCM |