Error with eigenvalues of unitary matrix

4 ビュー (過去 30 日間)
marnovaes
marnovaes 2017 年 8 月 18 日
コメント済み: Christine Tobler 2017 年 8 月 21 日
I am trying to diagonalize a unitary matrix, but am getting an error message:
"flag = processEUPDinfo(nargout<3);"
This is surprising, as unitary matrices are very well behaved.
The code is quite simple:
A=randn(100);
B=randn(100);
Z=A+B*1i;
[U,S,V]=svd(Z);
eigs(U)
What is the matter??
  8 件のコメント
Michelangelo Ricciulli
Michelangelo Ricciulli 2017 年 8 月 19 日
Hi, I know it is not an answer, but why are you using eigs() instead of eig() if you need all the eigenvalues? In my understanding eigs is optimized for sparse matrices and it is used to obtain only a subset of the eigenvalues.
Christine Tobler
Christine Tobler 2017 年 8 月 21 日
marnovaes: It doesn't make much sense to call EIGS asking for all eigenvalues, since the algorithm is only efficient when called for a small subset of eigenvalues. Because of this, the ARPACK library (which is called by EIGS) does not allow asking for more than N-2 eigenvalues.
In R2017a, EIGS now just calls eig(full(A)) for this case - so the call will work, but it still makes more sense to call EIG directly if you know in advance that you will want all eigenvalues.

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

採用された回答

Christine Tobler
Christine Tobler 2017 年 8 月 21 日
As mentioned in the comments above, if you are intending to compute all eigenvalues, it's best to call EIG, not EIGS. In fact, even if you only need a subset, for a matrix of size 100 it's probably cheaper to just call EIG.
Now why is EIGS having a hard time with this specific matrix? This is a well-conditioned problem, as you say, but in fact, it's computing a subset that is making it hard for EIGS.
The algorithm used by eigs(A) is based on an iteration that moves a set of 20 vectors closer to the eigenvectors with eigenvalues of largest magnitude. The problem is that for matrix U, all eigenvalues have the same magnitude:
plot(eig(U), 'x')
Because of this, the algorithm gets locked up trying to decide which are the 6 largest eigenvalues of this matrix, and unable to commit to any one set.
For a small dense matrix, you should definitely just compute all eigenvalues with EIG. If you have a larger matrix, the best thing is probably to rethink what subset of eigenvalues you are looking for. For example, searching for the 6 eigenvalues closest to 1 converges easily:
eigs(U, 6, 1)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by