How to ensure orthogonality of eigenvectors

I have a Hermitian matrix A. Due to numerical errors, (A'-A)/2 is around 10^-17 and eig returns nonorthogonal eigenvectors. I don’t see a eigh function (from numpy) counterpart in julia. How can I ensure orthogonality of eigenvectors of A?

eig(Hermitian(A))

3 Likes

Thank you. Although it is a little bit inconvenient when A has imaginary part in its diagonal axis due to floating point error.

You can rewrite the matrix by keeping only the upper part and copy this upper part to the lower part. This will be exactly symmetric.

See Avoid checking the diagonal for non-real elements when constructing Hermitians by andreasnoack · Pull Request #17367 · JuliaLang/julia · GitHub