summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Algorithms.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs18
1 files changed, 18 insertions, 0 deletions
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