diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK.hs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs index a84a17e..628d4f8 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK.hs +++ b/lib/Numeric/LinearAlgebra/LAPACK.hs | |||
@@ -21,7 +21,8 @@ module Numeric.LinearAlgebra.LAPACK ( | |||
21 | linearSolveSVDR, linearSolveSVDC, | 21 | linearSolveSVDR, linearSolveSVDC, |
22 | cholS, cholH, | 22 | cholS, cholH, |
23 | qrR, qrC, | 23 | qrR, qrC, |
24 | hessR, hessC | 24 | hessR, hessC, |
25 | schurR, schurC | ||
25 | ) where | 26 | ) where |
26 | 27 | ||
27 | import Data.Packed.Internal | 28 | import Data.Packed.Internal |
@@ -351,7 +352,7 @@ hessR a = unsafePerformIO $ do | |||
351 | ----------------------------------------------------------------------------------- | 352 | ----------------------------------------------------------------------------------- |
352 | foreign import ccall "LAPACK/lapack-aux.h hess_l_C" zgehrd :: TCMCVCM | 353 | foreign import ccall "LAPACK/lapack-aux.h hess_l_C" zgehrd :: TCMCVCM |
353 | 354 | ||
354 | -- | Wrapper for LAPACK's /zgeqr2/, which computes a Hessenberg factorization of a square complex matrix. | 355 | -- | Wrapper for LAPACK's /zgehrd/, which computes a Hessenberg factorization of a square complex matrix. |
355 | hessC :: Matrix (Complex Double) -> (Matrix (Complex Double), Vector (Complex Double)) | 356 | hessC :: Matrix (Complex Double) -> (Matrix (Complex Double), Vector (Complex Double)) |
356 | hessC a = unsafePerformIO $ do | 357 | hessC a = unsafePerformIO $ do |
357 | r <- createMatrix ColumnMajor m n | 358 | r <- createMatrix ColumnMajor m n |
@@ -362,3 +363,26 @@ hessC a = unsafePerformIO $ do | |||
362 | n = cols a | 363 | n = cols a |
363 | mn = min m n | 364 | mn = min m n |
364 | 365 | ||
366 | ----------------------------------------------------------------------------------- | ||
367 | foreign import ccall "LAPACK/lapack-aux.h schur_l_R" dgees :: TMMM | ||
368 | |||
369 | -- | Wrapper for LAPACK's /dgees/, which computes a Schur factorization of a square real matrix. | ||
370 | schurR :: Matrix Double -> (Matrix Double, Matrix Double) | ||
371 | schurR a = unsafePerformIO $ do | ||
372 | u <- createMatrix ColumnMajor n n | ||
373 | s <- createMatrix ColumnMajor n n | ||
374 | dgees // mat fdat a // mat dat u // mat dat s // check "schurR" [fdat a] | ||
375 | return (u,s) | ||
376 | where n = rows a | ||
377 | |||
378 | ----------------------------------------------------------------------------------- | ||
379 | foreign import ccall "LAPACK/lapack-aux.h schur_l_C" zgees :: TCMCMCM | ||
380 | |||
381 | -- | Wrapper for LAPACK's /zgees/, which computes a Schur factorization of a square complex matrix. | ||
382 | schurC :: Matrix (Complex Double) -> (Matrix (Complex Double), Matrix (Complex Double)) | ||
383 | schurC a = unsafePerformIO $ do | ||
384 | u <- createMatrix ColumnMajor n n | ||
385 | s <- createMatrix ColumnMajor n n | ||
386 | zgees // mat fdat a // mat dat u // mat dat s // check "schurC" [fdat a] | ||
387 | return (u,s) | ||
388 | where n = rows a | ||