Undocumented way to output the smallest 3 eigenvalues of the 500 eigenvalues using eig?

1 次查看(过去 30 天)
In the documention of eigs:
Using eigs is not the most efficient way to find a few eigenvalues of small, dense matrices. If the problem fits into memory, it might be quicker to use eig(full(A)). For example, finding three eigenvalues in a 500-by-500 matrix is a relatively small problem that is easily handled with eig.
It seems not very obvious to me:
To find the 3 smallest eigenvalues of A. What `eigs` does is simply eigs(A,3,'sm').
However, eig does not have a command like this. I browse through the whole eig documentation page and all I know is to do eig(full(A)) and do the sorting on all the total number of eigenvalues myself and extract the 3 smallest out. Unlike the one-liner eigs(A,3,'sm'), this takes quite a number of steps for this purpose and it is only a little bit faster.
From the quote above, it seems to me that there is an undocumented very fast way to find the 3 smallest eigenvalues from eig, without finding all of the eigenvalues first.
I tried: eig(full(A),3,'sm') and eig(full(A),3). But they do not work.

回答(1 个)

michio
michio 2016-9-2
As you have already figured out, eig always finds all the eigenvalues and does not have an undocumented option to find, for example, the 3 smallest eigenvalues.
The statement from the doc page simply states that in some cases it's quicker to find all eigenvalues and sort them. How quicker? It is strongly depends on the property of the matrix.

类别

Help CenterFile Exchange 中查找有关 Mathematics and Optimization 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by