diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK.hs | 41 |
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 | ||
214 | foreign import ccall unsafe "LAPACK/lapack-aux.h eig_l_R" dgeev :: TMMCVM | 214 | foreign import ccall unsafe "eig_l_R" dgeev :: TMMCVM |
215 | foreign import ccall unsafe "LAPACK/lapack-aux.h eig_l_C" zgeev :: TCMCMCVCM | 215 | foreign import ccall unsafe "eig_l_C" zgeev :: TCMCMCVCM |
216 | foreign import ccall unsafe "LAPACK/lapack-aux.h eig_l_S" dsyev :: CInt -> TMVM | 216 | foreign import ccall unsafe "eig_l_S" dsyev :: CInt -> TMVM |
217 | foreign import ccall unsafe "LAPACK/lapack-aux.h eig_l_H" zheev :: CInt -> TCMVCM | 217 | foreign import ccall unsafe "eig_l_H" zheev :: CInt -> TCMVCM |
218 | 218 | ||
219 | eigAux f st m = unsafePerformIO $ do | 219 | eigAux 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 | |||
359 | cholSolveC a b = linearSolveSQAux zpotrs "cholSolveC" (fmat a) (fmat b) | 359 | cholSolveC a b = linearSolveSQAux zpotrs "cholSolveC" (fmat a) (fmat b) |
360 | 360 | ||
361 | ----------------------------------------------------------------------------------- | 361 | ----------------------------------------------------------------------------------- |
362 | foreign import ccall unsafe "LAPACK/lapack-aux.h linearSolveLSR_l" dgels :: TMMM | 362 | foreign import ccall unsafe "linearSolveLSR_l" dgels :: TMMM |
363 | foreign import ccall unsafe "LAPACK/lapack-aux.h linearSolveLSC_l" zgels :: TCMCMCM | 363 | foreign import ccall unsafe "linearSolveLSC_l" zgels :: TCMCMCM |
364 | foreign import ccall unsafe "LAPACK/lapack-aux.h linearSolveSVDR_l" dgelss :: Double -> TMMM | 364 | foreign import ccall unsafe "linearSolveSVDR_l" dgelss :: Double -> TMMM |
365 | foreign import ccall unsafe "LAPACK/lapack-aux.h linearSolveSVDC_l" zgelss :: Double -> TCMCMCM | 365 | foreign import ccall unsafe "linearSolveSVDC_l" zgelss :: Double -> TCMCMCM |
366 | 366 | ||
367 | linearSolveAux f st a b = unsafePerformIO $ do | 367 | linearSolveAux 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) $ | |||
401 | linearSolveSVDC Nothing a b = linearSolveSVDC (Just (-1)) (fmat a) (fmat b) | 401 | linearSolveSVDC Nothing a b = linearSolveSVDC (Just (-1)) (fmat a) (fmat b) |
402 | 402 | ||
403 | ----------------------------------------------------------------------------------- | 403 | ----------------------------------------------------------------------------------- |
404 | foreign import ccall unsafe "LAPACK/lapack-aux.h chol_l_H" zpotrf :: TCMCM | 404 | foreign import ccall unsafe "chol_l_H" zpotrf :: TCMCM |
405 | foreign import ccall unsafe "LAPACK/lapack-aux.h chol_l_S" dpotrf :: TMM | 405 | foreign import ccall unsafe "chol_l_S" dpotrf :: TMM |
406 | 406 | ||
407 | cholAux f st a = do | 407 | cholAux 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) | |||
427 | mbCholS = unsafePerformIO . mbCatch . cholAux dpotrf "cholS" . fmat | 427 | mbCholS = unsafePerformIO . mbCatch . cholAux dpotrf "cholS" . fmat |
428 | 428 | ||
429 | ----------------------------------------------------------------------------------- | 429 | ----------------------------------------------------------------------------------- |
430 | foreign import ccall unsafe "LAPACK/lapack-aux.h qr_l_R" dgeqr2 :: TMVM | 430 | foreign import ccall unsafe "qr_l_R" dgeqr2 :: TMVM |
431 | foreign import ccall unsafe "LAPACK/lapack-aux.h qr_l_C" zgeqr2 :: TCMCVCM | 431 | foreign 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/. |
434 | qrR :: Matrix Double -> (Matrix Double, Vector Double) | 434 | qrR :: 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 | ----------------------------------------------------------------------------------- |
451 | foreign import ccall unsafe "LAPACK/lapack-aux.h hess_l_R" dgehrd :: TMVM | 451 | foreign import ccall unsafe "hess_l_R" dgehrd :: TMVM |
452 | foreign import ccall unsafe "LAPACK/lapack-aux.h hess_l_C" zgehrd :: TCMCVCM | 452 | foreign 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/. |
455 | hessR :: Matrix Double -> (Matrix Double, Vector Double) | 455 | hessR :: 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 | ----------------------------------------------------------------------------------- |
472 | foreign import ccall unsafe "LAPACK/lapack-aux.h schur_l_R" dgees :: TMMM | 472 | foreign import ccall unsafe "schur_l_R" dgees :: TMMM |
473 | foreign import ccall unsafe "LAPACK/lapack-aux.h schur_l_C" zgees :: TCMCMCM | 473 | foreign 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/. |
476 | schurR :: Matrix Double -> (Matrix Double, Matrix Double) | 476 | schurR :: 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 | ----------------------------------------------------------------------------------- |
491 | foreign import ccall unsafe "LAPACK/lapack-aux.h lu_l_R" dgetrf :: TMVM | 491 | foreign import ccall unsafe "lu_l_R" dgetrf :: TMVM |
492 | foreign import ccall unsafe "LAPACK/lapack-aux.h lu_l_C" zgetrf :: TCMVCM | 492 | foreign 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/. |
495 | luR :: Matrix Double -> (Matrix Double, [Int]) | 495 | luR :: Matrix Double -> (Matrix Double, [Int]) |
@@ -511,8 +511,8 @@ luAux f st a = unsafePerformIO $ do | |||
511 | type TW a = CInt -> PD -> a | 511 | type TW a = CInt -> PD -> a |
512 | type TQ a = CInt -> CInt -> PC -> a | 512 | type TQ a = CInt -> CInt -> PC -> a |
513 | 513 | ||
514 | foreign import ccall unsafe "LAPACK/lapack-aux.h luS_l_R" dgetrs :: TMVMM | 514 | foreign import ccall unsafe "luS_l_R" dgetrs :: TMVMM |
515 | foreign import ccall unsafe "LAPACK/lapack-aux.h luS_l_C" zgetrs :: TQ (TW (TQ (TQ (IO CInt)))) | 515 | foreign 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/. |
518 | lusR :: Matrix Double -> [Int] -> Matrix Double -> Matrix Double | 518 | lusR :: 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 | |||