3
$\begingroup$

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.

$\endgroup$
  • 5
    $\begingroup$ Checking NumPy documentation I can see that it uses zyevd and zheevd. $\endgroup$ – nicoguaro Jul 17 '18 at 14:50
  • 1
    $\begingroup$ 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? $\endgroup$ – rchilton1980 Jul 17 '18 at 15:32
  • $\begingroup$ @rchilton1980, yes. I just realized that I wrote a Z in front of both. $\endgroup$ – nicoguaro Jul 17 '18 at 17:28
  • $\begingroup$ 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. $\endgroup$ – WIP Jul 18 '18 at 6:53
  • 1
    $\begingroup$ 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. $\endgroup$ – WIP Jul 19 '18 at 9:31
3
$\begingroup$

Since your eigenvalues are very localized, I can suggest trying the FEAST algorithm. It really benefits from a tight search interval and can be beneficial in terms of speed and accuracy (and v2.1 is readily available from Intel MKL, while you might opt in using the newer one by a separate library download).

$\endgroup$
  • $\begingroup$ That is interesting but I asked for a method not to rely on a particular library, I meant something I could also code by myself. But in the end I figure out that my problem was all my fault and that I am a total idiot and that the LAPACK routine do the job really well. So finally this could be interesting for other people looking for an alternative to LAPACK. $\endgroup$ – WIP Jul 19 '18 at 9:25

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.