Reduce error in non Hermitian matrix diagonalization

Hi, guys:

I have limited knowledge about julia and other coding languages. Recently I am trying to diagonalize a series of matrices. Each matrix is obtained by some recursion relation and it is supposed to be Hermitian. But due to the round off error, I will get a non-Hermitian matrix. And this leads to an error in the diagonalized result. How to reduce the error as much as possible? I guess I can use Hermitian(A) or (A+A’)/2 to transfer this matrix to a Hermitian one at first. But I don’t know if this is a good idea.

If it’s just roundoff error, I would just use Hermitian(A)

See also https://github.com/JuliaLang/julia/pull/31836

1 Like

Thanks!