Error with eigenvalues of unitary matrix

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 Comments

Are you getting an error message, or are you getting a warning? I get a warning:
Warning: Only 0 of the 6 requested eigenvalues converged.
> In eigs>CallARPACK/processEUPDinfo (line 1111)
In eigs>CallARPACK (line 1054)
In eigs (line 113)
I get that warning if I ask for 'LR' or 'SR', but if I ask for 'LI' or 'SI' then I get non-nan outputs.
Here is the full message:
Error using eigs/processEUPDinfo (line 1280)
Error with ARPACK routine zneupd:
znaupd did not find any eigenvalues to sufficient accuracy.
Error in eigs (line 353)
flag = processEUPDinfo(nargout<3);
What is non-nan?
In any case, what do you believe is the problem?
Oh, if I use eigs(U,98) it gives me 98 eigenvalues, no problem! Weird.
And if I use eigs(U,100) it says "For nonsymmetric and complex problems,must have number of eigenvalues k < n-1." Why is this?
Which MATLAB version are you using? R2017a does not have 1280 lines in eigs.m; if it were to generate an error it would be line 1106 in R2017a.
I am using R2015a. But why am I restricted to N-2 eigenvalues of a N-dimensional matrix?
In R2017a you can request all 100.
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.
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.

Sign in to comment.

 Accepted Answer

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)

More Answers (0)

Categories

Find more on Linear Algebra in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!