diff options
author | Alberto Ruiz <aruiz@um.es> | 2011-07-13 19:57:31 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2011-07-13 19:57:31 +0000 |
commit | c53d2470d0b7a4248dba23e511a75566a8dcd039 (patch) | |
tree | d2b899943396c0928225795cc8862b354cefdc36 | |
parent | 2cb2293eeb617baa404f444944bb4613c645133a (diff) |
generalized symmetric eigensystem
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 18 |
2 files changed, 19 insertions, 0 deletions
@@ -1,6 +1,7 @@ | |||
1 | 0.11.2.0 | 1 | 0.11.2.0 |
2 | ======== | 2 | ======== |
3 | 3 | ||
4 | - geigSH' | ||
4 | - mapVectorWithIndex | 5 | - mapVectorWithIndex |
5 | 6 | ||
6 | 0.11.1.0 | 7 | 0.11.1.0 |
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index a6b3174..bea33ea 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -44,6 +44,7 @@ module Numeric.LinearAlgebra.Algorithms ( | |||
44 | -- ** Eigensystems | 44 | -- ** Eigensystems |
45 | eig, eigSH, eigSH', | 45 | eig, eigSH, eigSH', |
46 | eigenvalues, eigenvaluesSH, eigenvaluesSH', | 46 | eigenvalues, eigenvaluesSH, eigenvaluesSH', |
47 | geigSH', | ||
47 | -- ** QR | 48 | -- ** QR |
48 | qr, rq, | 49 | qr, rq, |
49 | -- ** Cholesky | 50 | -- ** Cholesky |
@@ -712,3 +713,20 @@ relativeError x y = dig (norm (x `sub` y) / norm x) | |||
712 | where norm = pnorm Infinity | 713 | where norm = pnorm Infinity |
713 | dig r = round $ -logBase 10 (realToFrac r :: Double) | 714 | dig r = round $ -logBase 10 (realToFrac r :: Double) |
714 | 715 | ||
716 | ---------------------------------------------------------------------- | ||
717 | |||
718 | -- | Generalized symmetric positive definite eigensystem Av = lBv, | ||
719 | -- for A and B symmetric, B positive definite (conditions not checked). | ||
720 | geigSH' :: Field t | ||
721 | => Matrix t -- ^ A | ||
722 | -> Matrix t -- ^ B | ||
723 | -> (Vector Double, Matrix t) | ||
724 | geigSH' a b = (l,v') | ||
725 | where | ||
726 | u = cholSH b | ||
727 | iu = inv u | ||
728 | c = ctrans iu <> a <> iu | ||
729 | (l,v) = eigSH' c | ||
730 | v' = iu <> v | ||
731 | (<>) = mXm | ||
732 | |||