How to ensure normalization of generalized eigenvalue problem

question

#1

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 (https://docs.scipy.org/doc/scipy-0.19.1/reference/generated/scipy.linalg.eigh.html). How do I do this in julia? Does H=Hermitian(H) and S=Hermitian(S) guarantee this?


#2

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.)


#3

X'*S*X is approximately I? Why not exactly?


#4

Roundoff errors.


#5

Thank you for reply. I always think detailed documentation of some functions are lacking.


#6

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.)