SVDS fails to find the requested number of singular values
1 view (last 30 days)
Show older comments
David Russell
on 7 Feb 2018
Answered: Christine Tobler
on 8 Feb 2018
I have a large, sparse matrix P whose 2nd-6th singular values are very close together. When I call svds(P, n) for n = 1 through 4, I only get one singular value, i.e. S is a 1X1 matrix. But for n > 4 I get n singular values. For example, for n = 10, I get the following singular values:
0.999983033171519
0.977304152905677
0.977303005303906
0.977301775263024
0.977291373746100
0.977282929457516
0.973261074205161
0.952652676911938
0.952651480387276
0.952646797642832
I'd love to know what's going on here, and if there is a way to anticipate or correct for the case when the number of found singular values is deficient. I'm using MATLAB 2015b and I've attached the matrix in question.
0 Comments
Accepted Answer
Christine Tobler
on 8 Feb 2018
The algorithm used in SVDS was rewritten for R2016a (and Name-Value pairs such as 'SubspaceDimension' were added in R2017b - they correspond to fields in the options structure in the older syntaxes).
In R2015b, the best thing to do would be to check the length of the output vector, and in case it is too short, increase the requested number of singular values (this implicitly increases the 'SubspaceDimension' used in the internal algorithm).
In R2016a and later, n singular values are always returned, but there is a warning that the iteration did not converge. The algorithm can be made to converge by setting 'SubspaceDimension'. In MATLAB R2016a-R2017a, the command 'SubspaceDimension' is set using the 'p' field in the options structure: svds(P, n, 'largest', struct('p', 60)).
The reason that this problem is hard to solve is that the 7 largest singular values are very close together for this matrix.
0 Comments
More Answers (1)
Matt J
on 8 Feb 2018
Edited: Matt J
on 8 Feb 2018
The documentation says to try increasing the SubspaceDimension parameter. This seems to work with your matrix,
>> svds(P,4,'largest','SubspaceDimension',60)
ans =
0.999983033171520
0.977304152905677
0.977303005303906
0.977301775263023
0 Comments
See Also
Categories
Find more on Sparse Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!