From c53d2470d0b7a4248dba23e511a75566a8dcd039 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 13 Jul 2011 19:57:31 +0000 Subject: generalized symmetric eigensystem --- CHANGES | 1 + lib/Numeric/LinearAlgebra/Algorithms.hs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGES b/CHANGES index 21c58cb..f24ee38 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ 0.11.2.0 ======== +- geigSH' - mapVectorWithIndex 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 ( -- ** Eigensystems eig, eigSH, eigSH', eigenvalues, eigenvaluesSH, eigenvaluesSH', + geigSH', -- ** QR qr, rq, -- ** Cholesky @@ -712,3 +713,20 @@ relativeError x y = dig (norm (x `sub` y) / norm x) where norm = pnorm Infinity dig r = round $ -logBase 10 (realToFrac r :: Double) +---------------------------------------------------------------------- + +-- | Generalized symmetric positive definite eigensystem Av = lBv, +-- for A and B symmetric, B positive definite (conditions not checked). +geigSH' :: Field t + => Matrix t -- ^ A + -> Matrix t -- ^ B + -> (Vector Double, Matrix t) +geigSH' a b = (l,v') + where + u = cholSH b + iu = inv u + c = ctrans iu <> a <> iu + (l,v) = eigSH' c + v' = iu <> v + (<>) = mXm + -- cgit v1.2.3