I need to compute numerically all the eigenvalues of roughly $500$ large Hermitian matrices, $(5 \times 10^5) \times (5 \times 10^5)$).

At best, I can speed up my computation such that it takes almost twice the amount of time that I can reach on python using the numpy package.

I would like if such a difference can be in general further reduced, and the two performance can be similar, or there is a gap between mathematica an python that I cannot fill.

  • $\begingroup$ That's weird. I thought that both numpy and Mathematica link to the same library (ARPACK). Be sure to use Method->"Arnoldi"; see also documentation of Eigenvalues. $\endgroup$ – Henrik Schumacher Mar 2 '18 at 8:17
  • $\begingroup$ Oh thank you. I will try to do some tests on that. But so, on general ground, should I expect to reach the same performance with mathematica and python? thatnks! $\endgroup$ – Dario Rosa Mar 2 '18 at 8:19
  • $\begingroup$ Mathematica should perfom some additional copy operations for the transfer to and from the library in order to preserve immutability. But that should be negligible compared to the effort of computing the eigenvalues. Once the matrix is in the library (and the same options are uses), I see now reason why there should be a performance difference. Unfortunately, Mathematica provides only few suboptions for "Arnoldi" to tune it further. Moreover, I don't know to which version of ARPACK they link. $\endgroup$ – Henrik Schumacher Mar 2 '18 at 8:26
  • $\begingroup$ I see. Actually from the documentation it seems that Arnoldi method can be used only if we need few eigenvalues but I need all of them. Do you know whether I can overcome this problem? $\endgroup$ – Dario Rosa Mar 2 '18 at 8:30
  • $\begingroup$ Doh. Yeah, that is an issue. You can try to compute first and secand half of spectrum separately. Moreover, it just came to my mind that Mathematica might not link to the parallel version of ARPACK =/ $\endgroup$ – Henrik Schumacher Mar 2 '18 at 8:35

Your Answer

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

Browse other questions tagged or ask your own question.