# First few smallest eigenvalues of a large dense symmetric matrix

I construct a large (say 2000x2000) matrix M whose entries are real random variables drawn from a certain distribution. Most of these values will be nonzero, so M is not sparse. Then I construct (formally)

X[i,j] = ( M[i,j] + M[j,i] ) / 2;

so that I know for sure that the matrix X is symmetric.

I am interested in the first few (say 10) eigenvalues of X, smallest in absolute value. I checked the Documentation and I tested

Eigenvalues[X];
Eigenvalues[X, -10];
Eigenvalues[matrix, -10, Method -> "Arnoldi"];
Eigenvalues[matrix,Method->{"FEAST","Interval"->{min,max}}];


Supposedly the first basic method should be the slowest, because it's giving me the list of all the eigenvalues. It turns out this is not the case: the first two methods take just about the same time, while the 3rd and the 4th are definitely slower.

What is going on? And, most importantly, what is the fastest method to get to my goal?

• The third method is about 15% faster for me (13.0.0 for Mac OS X ARM (64-bit) (December 3, 2021). I don't have the FEAST library installed to check the 4th. I used SeedRandom[0]; x = With[{m = RandomReal[{0, 1}, {2000, 2000}]}, (m + Transpose[m])/2]; Commented Aug 9, 2022 at 16:58
• I'm running my code on a Intel® Core™ i7-4790 CPU @ 3.60GHz × 8. Could it be that Mathematica is parallelizing parts of the first algorithm, so that it turns out to be faster on my machine? Commented Aug 9, 2022 at 17:31
• I also found that the Arnoldi method is the fastest of the three, but by a relatively small margin (0.52 s vs. 0.53 s vs. 0.51 s). I am on MMA 12.3.1 on Win10-64. Commented Aug 9, 2022 at 18:37
• I also have 8 cores. I don’t think it is parallelizing. But, I don’t know how to determine whether that is true. Commented Aug 10, 2022 at 9:10
• @CraigCarter I use Linux and if I type top in a terminal while Mathematica is running, I find a CPU usage of, like, 200%. Then I guess it is parallelizing. Commented Aug 10, 2022 at 9:12