Any reason why Octave, R, Numpy and LAPACK yield different SVD results on the same matrix? Any reason why Octave, R, Numpy and LAPACK yield different SVD results on the same matrix? numpy numpy

Any reason why Octave, R, Numpy and LAPACK yield different SVD results on the same matrix?


In SVD decomposition $A=UDV^T$ only $D$ is unique (up to reordering). It is more or less easy to see that $cU$ and $\frac{1}{c}V$ will give the same decomposition. So it is not surprising that different algorithms can give different results. What matters is that $D$ must be the same for all algorithms.


Actually, the U and V are also unique for unique singular values. The reason yours are not is that singular values 2 and 3 are repeated. Singular value 1 (the 3.4) is unique - and therefore columns 1 of U and V are the same in both answers.

Also, even though columns 2 and 3 are not unique, they should lie in the same linear subspace for both answers. This means that if U1 consists of columns 2 and 3 of the first U, and U2 consists of columns 2 and 3 of the second U, then U1'*U2 should be a full rank 2x2 matrix whose columns are both of unit (euclidean) magnitude.