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.hs41
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs
index 9bc6669..ffc6cee 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK.hs
+++ b/lib/Numeric/LinearAlgebra/LAPACK.hs
@@ -211,10 +211,10 @@ leftSVAux f st x = unsafePerformIO $ do
211 211
212----------------------------------------------------------------------------- 212-----------------------------------------------------------------------------
213 213
214foreign import ccall unsafe "LAPACK/lapack-aux.h eig_l_R" dgeev :: TMMCVM 214foreign import ccall unsafe "eig_l_R" dgeev :: TMMCVM
215foreign import ccall unsafe "LAPACK/lapack-aux.h eig_l_C" zgeev :: TCMCMCVCM 215foreign import ccall unsafe "eig_l_C" zgeev :: TCMCMCVCM
216foreign import ccall unsafe "LAPACK/lapack-aux.h eig_l_S" dsyev :: CInt -> TMVM 216foreign import ccall unsafe "eig_l_S" dsyev :: CInt -> TMVM
217foreign import ccall unsafe "LAPACK/lapack-aux.h eig_l_H" zheev :: CInt -> TCMVCM 217foreign import ccall unsafe "eig_l_H" zheev :: CInt -> TCMVCM
218 218
219eigAux f st m = unsafePerformIO $ do 219eigAux f st m = unsafePerformIO $ do
220 l <- createVector r 220 l <- createVector r
@@ -359,10 +359,10 @@ cholSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Comp
359cholSolveC a b = linearSolveSQAux zpotrs "cholSolveC" (fmat a) (fmat b) 359cholSolveC a b = linearSolveSQAux zpotrs "cholSolveC" (fmat a) (fmat b)
360 360
361----------------------------------------------------------------------------------- 361-----------------------------------------------------------------------------------
362foreign import ccall unsafe "LAPACK/lapack-aux.h linearSolveLSR_l" dgels :: TMMM 362foreign import ccall unsafe "linearSolveLSR_l" dgels :: TMMM
363foreign import ccall unsafe "LAPACK/lapack-aux.h linearSolveLSC_l" zgels :: TCMCMCM 363foreign import ccall unsafe "linearSolveLSC_l" zgels :: TCMCMCM
364foreign import ccall unsafe "LAPACK/lapack-aux.h linearSolveSVDR_l" dgelss :: Double -> TMMM 364foreign import ccall unsafe "linearSolveSVDR_l" dgelss :: Double -> TMMM
365foreign import ccall unsafe "LAPACK/lapack-aux.h linearSolveSVDC_l" zgelss :: Double -> TCMCMCM 365foreign import ccall unsafe "linearSolveSVDC_l" zgelss :: Double -> TCMCMCM
366 366
367linearSolveAux f st a b = unsafePerformIO $ do 367linearSolveAux f st a b = unsafePerformIO $ do
368 r <- createMatrix ColumnMajor (max m n) nrhs 368 r <- createMatrix ColumnMajor (max m n) nrhs
@@ -401,8 +401,8 @@ linearSolveSVDC (Just rcond) a b = subMatrix (0,0) (cols a, cols b) $
401linearSolveSVDC Nothing a b = linearSolveSVDC (Just (-1)) (fmat a) (fmat b) 401linearSolveSVDC Nothing a b = linearSolveSVDC (Just (-1)) (fmat a) (fmat b)
402 402
403----------------------------------------------------------------------------------- 403-----------------------------------------------------------------------------------
404foreign import ccall unsafe "LAPACK/lapack-aux.h chol_l_H" zpotrf :: TCMCM 404foreign import ccall unsafe "chol_l_H" zpotrf :: TCMCM
405foreign import ccall unsafe "LAPACK/lapack-aux.h chol_l_S" dpotrf :: TMM 405foreign import ccall unsafe "chol_l_S" dpotrf :: TMM
406 406
407cholAux f st a = do 407cholAux f st a = do
408 r <- createMatrix ColumnMajor n n 408 r <- createMatrix ColumnMajor n n
@@ -427,8 +427,8 @@ mbCholS :: Matrix Double -> Maybe (Matrix Double)
427mbCholS = unsafePerformIO . mbCatch . cholAux dpotrf "cholS" . fmat 427mbCholS = unsafePerformIO . mbCatch . cholAux dpotrf "cholS" . fmat
428 428
429----------------------------------------------------------------------------------- 429-----------------------------------------------------------------------------------
430foreign import ccall unsafe "LAPACK/lapack-aux.h qr_l_R" dgeqr2 :: TMVM 430foreign import ccall unsafe "qr_l_R" dgeqr2 :: TMVM
431foreign import ccall unsafe "LAPACK/lapack-aux.h qr_l_C" zgeqr2 :: TCMCVCM 431foreign import ccall unsafe "qr_l_C" zgeqr2 :: TCMCVCM
432 432
433-- | QR factorization of a real matrix, using LAPACK's /dgeqr2/. 433-- | QR factorization of a real matrix, using LAPACK's /dgeqr2/.
434qrR :: Matrix Double -> (Matrix Double, Vector Double) 434qrR :: Matrix Double -> (Matrix Double, Vector Double)
@@ -448,8 +448,8 @@ qrAux f st a = unsafePerformIO $ do
448 mn = min m n 448 mn = min m n
449 449
450----------------------------------------------------------------------------------- 450-----------------------------------------------------------------------------------
451foreign import ccall unsafe "LAPACK/lapack-aux.h hess_l_R" dgehrd :: TMVM 451foreign import ccall unsafe "hess_l_R" dgehrd :: TMVM
452foreign import ccall unsafe "LAPACK/lapack-aux.h hess_l_C" zgehrd :: TCMCVCM 452foreign import ccall unsafe "hess_l_C" zgehrd :: TCMCVCM
453 453
454-- | Hessenberg factorization of a square real matrix, using LAPACK's /dgehrd/. 454-- | Hessenberg factorization of a square real matrix, using LAPACK's /dgehrd/.
455hessR :: Matrix Double -> (Matrix Double, Vector Double) 455hessR :: Matrix Double -> (Matrix Double, Vector Double)
@@ -469,8 +469,8 @@ hessAux f st a = unsafePerformIO $ do
469 mn = min m n 469 mn = min m n
470 470
471----------------------------------------------------------------------------------- 471-----------------------------------------------------------------------------------
472foreign import ccall unsafe "LAPACK/lapack-aux.h schur_l_R" dgees :: TMMM 472foreign import ccall unsafe "schur_l_R" dgees :: TMMM
473foreign import ccall unsafe "LAPACK/lapack-aux.h schur_l_C" zgees :: TCMCMCM 473foreign import ccall unsafe "schur_l_C" zgees :: TCMCMCM
474 474
475-- | Schur factorization of a square real matrix, using LAPACK's /dgees/. 475-- | Schur factorization of a square real matrix, using LAPACK's /dgees/.
476schurR :: Matrix Double -> (Matrix Double, Matrix Double) 476schurR :: Matrix Double -> (Matrix Double, Matrix Double)
@@ -488,8 +488,8 @@ schurAux f st a = unsafePerformIO $ do
488 where n = rows a 488 where n = rows a
489 489
490----------------------------------------------------------------------------------- 490-----------------------------------------------------------------------------------
491foreign import ccall unsafe "LAPACK/lapack-aux.h lu_l_R" dgetrf :: TMVM 491foreign import ccall unsafe "lu_l_R" dgetrf :: TMVM
492foreign import ccall unsafe "LAPACK/lapack-aux.h lu_l_C" zgetrf :: TCMVCM 492foreign import ccall unsafe "lu_l_C" zgetrf :: TCMVCM
493 493
494-- | LU factorization of a general real matrix, using LAPACK's /dgetrf/. 494-- | LU factorization of a general real matrix, using LAPACK's /dgetrf/.
495luR :: Matrix Double -> (Matrix Double, [Int]) 495luR :: Matrix Double -> (Matrix Double, [Int])
@@ -511,8 +511,8 @@ luAux f st a = unsafePerformIO $ do
511type TW a = CInt -> PD -> a 511type TW a = CInt -> PD -> a
512type TQ a = CInt -> CInt -> PC -> a 512type TQ a = CInt -> CInt -> PC -> a
513 513
514foreign import ccall unsafe "LAPACK/lapack-aux.h luS_l_R" dgetrs :: TMVMM 514foreign import ccall unsafe "luS_l_R" dgetrs :: TMVMM
515foreign import ccall unsafe "LAPACK/lapack-aux.h luS_l_C" zgetrs :: TQ (TW (TQ (TQ (IO CInt)))) 515foreign import ccall unsafe "luS_l_C" zgetrs :: TQ (TW (TQ (TQ (IO CInt))))
516 516
517-- | Solve a real linear system from a precomputed LU decomposition ('luR'), using LAPACK's /dgetrs/. 517-- | Solve a real linear system from a precomputed LU decomposition ('luR'), using LAPACK's /dgetrs/.
518lusR :: Matrix Double -> [Int] -> Matrix Double -> Matrix Double 518lusR :: Matrix Double -> [Int] -> Matrix Double -> Matrix Double
@@ -533,3 +533,4 @@ lusAux f st a piv b
533 n = rows b 533 n = rows b
534 m = cols b 534 m = cols b
535 piv' = fromList (map (fromIntegral.succ) piv) :: Vector Double 535 piv' = fromList (map (fromIntegral.succ) piv) :: Vector Double
536