summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs18
2 files changed, 19 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 21c58cb..f24ee38 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
10.11.2.0 10.11.2.0
2======== 2========
3 3
4- geigSH'
4- mapVectorWithIndex 5- mapVectorWithIndex
5 6
60.11.1.0 70.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).
720geigSH' :: Field t
721 => Matrix t -- ^ A
722 -> Matrix t -- ^ B
723 -> (Vector Double, Matrix t)
724geigSH' 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