eigs() runs faster for more eigenvalues of the same matrix

43 ビュー (過去 30 日間)
Ilya Tyuryukanov
Ilya Tyuryukanov 2017 年 9 月 12 日
編集済み: Walter Roberson 2018 年 8 月 12 日
I'm a bit confused: running eigs() for 3..20 largest eingevalues/vectors of a ~3000x3000 sparse real symmetric matrix causes the following run times (in seconds, on Linux):
1.03 1.42 1.02 1.16 1.11 1.81 3.01 3.13 3.73 3.12 2.89 2.03 1.36 1.32 1.27 1.22 1.07 0.97 1.23
That is, solving for 9..14 eingepairs is more difficult, but the same eigenpairs (may be a tiny bit less accurate) can be obtained by computing the first 15 or 20 eigenvalues...
I'm running eigs with the following options:
opts.issym = 1;
opts.isreal = 1;
opts.disp = 0;
opts.maxit = 10000;
opts.tol = 2.2204e-16;
[V, v] = eigs(adj, k, 'la', opts);
The large max number of iterations is to get rid of possible NaN values in the solution.

採用された回答

Christine Tobler
Christine Tobler 2017 年 9 月 12 日
The reason is that the "search space" used in each iteration is determined based on the number of eigenvalues requested. By increasing k, the size of the subspace is increased, which in this case means that all eigenvalues can be found much faster. There's no way of knowing the optimal subspace size to use, EIGS just uses max(2*k, 20) by default. So increasing opts.p will have the same effect as asking for more eigenvalues.
The reason EIGS is having problems is that the largest eigenvalues of matrix adj are very close together, and the algorithm used in EIGS depends on a gap between eigenvalues.
An alternative would be to just call eig(full(A)) and compute all eigenvalues and eigenvectors. For this specific matrix, it could be faster than EIGS, since the matrix is real symmetric and has a difficult eigenvalue distribution for EIGS. On my machine, this took 2.5 seconds, while most EIGS calls I tried took about 1.5 seconds.
  1 件のコメント
Ilya Tyuryukanov
Ilya Tyuryukanov 2017 年 9 月 12 日
編集済み: Ilya Tyuryukanov 2017 年 9 月 12 日
Thank you very much. This answer is very informative.

サインインしてコメントする。

その他の回答 (1 件)

Andrew Knyazev
Andrew Knyazev 2018 年 8 月 12 日
編集済み: Walter Roberson 2018 年 8 月 12 日
Please check https://www.mathworks.com/matlabcentral/fileexchange/48-lobpcg-m that has probably faster and more predictable convergence, compared to EIGS

カテゴリ

Help Center および File ExchangeEigenvalues & Eigenvectors についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by