# Compute nearly degenerated eigen values and vectors

In a quantum physics calculation, I have to deal with a matrix that has a lot of eigenvalues really close to each other ($10^{-6}$ relative difference for example) and I can't manage to obtain accurate enough eigenvectors and eigenvalues. Indeed, I would like to reach machine precision and I get only $10^{-9}$ with zheev from LAPACK both with MKL and ATLAS.

This implies that it is due to LAPACK itself and that it is possible to achieve better precision with other methods. I know that it is totally possible with my matrix since I achieve the expected precision with numpy.linalg.eigh but I can't tell what is different between my use of LAPACK and what is done in numpy. (I explain the comparison between the two there but my question here is different).

I wonder if there is an algorithm that is known to be efficient for really close eigenvalues. The restrictions are that I don't use really big matrices (less than 100 lines for now) that are Hermitian and I know that the eigenvalues are all comprised between 0 and 2 (both included).

I have to compute all eigenvalues and vectors with the maximum precision.

• Checking NumPy documentation I can see that it uses zyevd and zheevd. Commented Jul 17, 2018 at 14:50
• I think nicoguaro's comment is very useful. If numpy is giving you the desired precision and uses the ???evd routines (divide and conquer, instead of QR iteration) I think that's the best thing to try next since the calling sequence will be very similar. That said, zyevd is unknown to me (and google). Nicoguaro, do you perhaps mean dsyevd, for the real case? Commented Jul 17, 2018 at 15:32
• @rchilton1980, yes. I just realized that I wrote a Z in front of both. Commented Jul 17, 2018 at 17:28
• Indeed Numpy claim to use LAPACK routines and I already checked zheevd, unfortunatly it did not produce a better result and I do not understand why. Still this conversation is not in the scope of the current question but I would be glad to investigate further with you on the apropriate thread.
– WIP
Commented Jul 18, 2018 at 6:53
• For the record I was just deteriorating output from fortran in the process of introducing it into python so there was no real difference between numpy and fortran/lapack output.
– WIP
Commented Jul 19, 2018 at 9:31