sparsesvd
sparsesvd copied to clipboard
sparsesvd of an identity matrix is totally messed up
Sparsesvd somehow gives a random solution to an svd of an identity matrix. Is there a reason for this?
I just checked and confirmed -- the singular values are ok, but left/right singular vectors are complete rubbish.
Actually, the issue seems to be not just with identity matrix, but any matrix that has multiple identical singular values (algebraic multiplicity).
For example, the 10x10 identity matrix has ten singular values, all 1.0. This throws off SVDLIBC (the library wrapped by sparsesvd
).
A "proper" fix will take time (=either modifying SVDLIBC, or post-processing its output). A faster fix is to use more interesting input, if possible -- multiple identical singular values don't happen as often in real-world data.