Why eigs ('lm') are much faster than eigs ('sm')

I use eigs to compute eigenvectors of sparse square matrices large (tens of thousands). I want this to be the smallest set of eigenvectors. But

eigs(A, 10, 'sm')      % Note: A is the matrix

works very slowly.

However, using eigs (A, 10, 'lm') gives me an answer relatively faster. And, as I tried, replacing 10 with A_width in eigs (A, 10, 'lm'), so this includes all eigenvectors, does not solve this problem, because it does it as slowly as using "sm".

So, I want to know why the calculation of the smallest vectors (using "sm") is much slower than the computation of the largest?

By the way, if you have an idea how to use eigs with "sm" as fast as with "lm", tell me that.

+5
source share
3 answers

Since it eigsis actually a function of the m file, we can profile it. I performed a few basic tests, and it greatly depends on the nature of the data in the matrix. If we run the profiler separately in the following two lines of code:

eigs(eye(1000), 10, 'lm'), and
eigs(eye(1000), 10, 'sm'),

then in the first case it calls arpackc(the main function that performs the work - according to the comments to eigs, probably from here ) a total of 22 times. In the second case, it is called 103 times.

On the other hand, having tried it with

eigs(rand(1000), 10, 'lm'), and
eigs(rand(1000), 10, 'sm'),

, 'lm' arpackc , sm.

, , , ARPACK . , rand, , , , , , , .

: , , . , , , .

: , , , , - .

+1

, eigs, ( ) Lanczos. , . :

  • ,
  • ,
  • .

, "" eigs , . . Matlab eigs, , sigma, . , eig, , eigs .

+5

. :

(1) A x = lam x

(, , , )

, (1). , , : K^k = {A*r0,....,A^k*r0}, ().

, (1) :

(2) 1/lam x = A^(-1) x or A^(-1) x = invlam x  

(2) (1). K^k = {A^(-1)*r0,....,A^(-k)*r0}, ( !).

,

+1

All Articles