summaryrefslogtreecommitdiff
path: root/lib/LAPACK.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LAPACK.hs')
-rw-r--r--lib/LAPACK.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/LAPACK.hs b/lib/LAPACK.hs
index 54eea8a..e84647b 100644
--- a/lib/LAPACK.hs
+++ b/lib/LAPACK.hs
@@ -19,6 +19,7 @@ module LAPACK (
19 linearSolveR, linearSolveC, 19 linearSolveR, linearSolveC,
20 linearSolveLSR, linearSolveLSC, 20 linearSolveLSR, linearSolveLSC,
21 linearSolveSVDR, linearSolveSVDC, 21 linearSolveSVDR, linearSolveSVDC,
22 cholS, cholH
22) where 23) where
23 24
24import Data.Packed.Internal 25import Data.Packed.Internal
@@ -279,3 +280,27 @@ linearSolveSVDC_l rcond a b = unsafePerformIO $ do
279 n = cols a 280 n = cols a
280 nrhs = cols b 281 nrhs = cols b
281 282
283-----------------------------------------------------------------------------------
284foreign import ccall "LAPACK/lapack-aux.h chol_l_H" zpotrf :: TCMCM
285
286-- | Wrapper for LAPACK's /zpotrf/,which computes the Cholesky factorization of a
287-- complex Hermitian positive definite matrix.
288cholH :: Matrix (Complex Double) -> Matrix (Complex Double)
289cholH a = unsafePerformIO $ do
290 r <- createMatrix ColumnMajor n n
291 zpotrf // mat fdat a // mat dat r // check "cholH" [fdat a]
292 return r
293 where n = rows a
294
295-----------------------------------------------------------------------------------
296foreign import ccall "LAPACK/lapack-aux.h chol_l_S" dpotrf :: TMM
297
298-- | Wrapper for LAPACK's /dpotrf/,which computes the Cholesky factorization of a
299-- real symmetric positive definite matrix.
300cholS :: Matrix Double -> Matrix Double
301cholS a = unsafePerformIO $ do
302 r <- createMatrix ColumnMajor n n
303 dpotrf // mat fdat a // mat dat r // check "cholS" [fdat a]
304 return r
305 where n = rows a
306