I have a Hermitian matrix H
and a Hermitian and positive definite matrix S
. I want the solutions to the following generalized eigenvalue problem Hx=\lambda Sx and want x
to be properly normalized. In scipy, there’s an eigh
function that guarantees the normalization (scipy.linalg.eigh — SciPy v0.19.1 Reference Guide). How do I do this in julia? Does H=Hermitian(H)
and S=Hermitian(S)
guarantee this?
Yes, if you do λ, X = eig(Hermitian(H), Hermitian(S))
, then X
is “properly” normalized in the sense that X'*S*X
is approximately I
. Similarly for eigfact
etcetera.
(Actually, eig
will check whether its arguments are Hermitian and do this automatically, but explicitly telling it that you have Hermitian matrices is a good practice.)
X'*S*X
is approximately I
? Why not exactly?
Roundoff errors.
Thank you for reply. I always think detailed documentation of some functions are lacking.
Documentation patches are always welcome and are quite easy. (Just search on the julia github for a phrase from the docstring to find out where it is in the source. You can edit the file directly in your web browser to submit a patch.)
2 Likes