New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
svds
returns non-orthogonal singular vectors when there are degenerate singular values
#16608
Comments
If the same thing happens in octave/python/matlab, then this is likely an upstream issue. |
The behavior described is not a bug, but an intrinsic limitation of the algorithm used by For example, Parlett writes in The Symmetric Eigenvalue Problem, Ch. 12: The fact that The only workaround for sparse matrices is to either use a different algorithm, such as a sparse direct eigensolver, or a block Krylov method (c.f. Parlett 13.10, pp. 316 ff.), neither of which are provided by The only reasonable actions here are:
|
svds
returns non-orthogonal singular vectors when there are degenerate singular valueseigs
and svds
for matrices with multiple eigenvalues/singular values
@jiahao I'm not sure this is the complete story. In general, I find that julia> A = diagm(sort(rand(5), rev = true));
julia> A[2,2]=A[1,1];
julia> AA = [zeros(5,5) A; A' zeros(5,5)];
julia> VV = eigs(AA, nev = 8)[2]
10×8 Array{Float64,2}:
0.396673 -0.301188 -0.639755 0.585363 -2.77556e-17 -2.77556e-17 0.0 2.25514e-17
-0.585363 -0.639755 0.301188 0.396673 2.77556e-16 1.11022e-16 1.11022e-16 3.05311e-16
9.71445e-17 -2.48711e-16 1.14518e-16 0.0 -0.707107 0.707107 7.91034e-16 -5.55112e-16
0.0 5.81047e-16 -2.42155e-17 -5.55112e-17 -2.54198e-16 7.77156e-16 -0.707107 0.707107
2.77556e-17 0.0 0.0 0.0 -1.94289e-16 -5.55112e-17 -2.91434e-16 -1.66533e-16
-0.396673 -0.301188 -0.639755 -0.585363 8.32667e-17 0.0 2.77556e-17 3.90313e-16
0.585363 -0.639755 0.301188 -0.396673 3.88578e-16 -1.11022e-16 5.55112e-17 3.85109e-16
-1.11022e-16 -4.77305e-16 1.2396e-16 4.16334e-17 -0.707107 -0.707107 -9.02056e-16 -3.05311e-16
0.0 3.10657e-16 4.91347e-17 1.11022e-16 -5.57705e-16 -7.49401e-16 0.707107 0.707107
5.55112e-17 -3.33067e-16 0.0 5.55112e-17 -1.11022e-16 -2.22045e-16 -7.21645e-16 -3.33067e-16 Parlett is careful about mentioning "...exact arithmetic..." in the paragraphs after the first you list and, as I read him, he suggests that, in practice, rounding errors solve most of the problem. To me, the problem seems to be that we'll have to be a little more careful about which of the columns of the eigenvectors of Line 382 in 15626c3
|
@andreasnoack When roundoff breaks the degeneracy in the subspace traversed and allows some component in other eigenvectors, what you suggest is reasonable. However, I'm skeptical that users can rely on floating point roundoff to make their computations work in general. I don't recall Parlett ever saying that "rounding errors solve most of the problem", rather only that he can't prove much in finite precision about what happens. |
The problem you suggest is not a problem for our |
eigs
and svds
for matrices with multiple eigenvalues/singular valuessvds
returns non-orthogonal singular vectors when there are degenerate singular values
I've just checked MATLAB 2016a's implementation of (Apparently this is new in 2016a; @andreasnoack has seen that |
Fixes #16608 Make "Symmetric generalized with singular B" a testset
…value. This avoids the problem of selecting the singular values among the eigenvalues and it should also be faster since only half the eigenvalues are computed. This also fixes a bug which showed up when the subspace size was manually set. In that case the number of returned singular values would correspond to nsv. Fixes #16608 Make "Symmetric generalized with singular B" a testset
…value. This avoids the problem of selecting the singular values among the eigenvalues and it should also be faster since only half the eigenvalues are computed. This also fixes a bug which showed up when the subspace size was manually set. In that case the number of returned singular values would correspond to nsv. Fixes #16608 Make "Symmetric generalized with singular B" a testset
…value. This avoids the problem of selecting the singular values among the eigenvalues and it should also be faster since only half the eigenvalues are computed. This also fixes a bug which showed up when the subspace size was manually set. In that case the number of returned singular values would correspond to nsv. Fixes #16608 Make "Symmetric generalized with singular B" a testset
…value. This avoids the problem of selecting the singular values among the eigenvalues and it should also be faster since only half the eigenvalues are computed. This also fixes a bug which showed up when the subspace size was manually set. In that case the number of returned singular values would correspond to nsv. Fixes #16608 Make "Symmetric generalized with singular B" a testset
…value. This avoids the problem of selecting the singular values among the eigenvalues and it should also be faster since only half the eigenvalues are computed. This also fixes a bug which showed up when the subspace size was manually set. In that case the number of returned singular values would correspond to nsv. Fixes #16608 Make "Symmetric generalized with singular B" a testset
… The latter is only relevant when computing the small values and we don't support that. This also fixes #16608.
… The latter is only relevant when computing the small values and we don't support that. This also fixes #16608.
A colleague of mine spotted a bug with the following:
That prints out for instance
So in the first case there are no degenerate singular values and everything goes fine: After doing an SVD of M, we can multiply M with U and S and get a diagonal matrix with the singular values on the diagonal. The columns of U are orthogonal.
However, if we set
D[2] = D[1]
so that there's degeneracy, the same thing fails. The singular values come out right, but the singular vectors don't: You can see that the block of C corresponding to the degenerate singular values is not diagonal and the columns of U are not orthogonal.I'm guessing that this is related to the non-uniqueness of singular vectors corresponding to degenerate singular values, but I haven't looked at the code for
svds
. Note that if you run that code a few times, sometimes things work out correctly by luck even in the latter case.The text was updated successfully, but these errors were encountered: