# svds(X,r) and svd(X,'econ') generating different singular vectors for large complex matrix X ??

16 views (last 30 days)
Bolun Chen on 9 Apr 2021
Edited: Bruno Luong on 9 Apr 2021
Hi,
I was trying to calculate truncated svd for a large complex matrix X. I noticed that svds(X,r) and svd(X,'econ') seemingly generate different U and V matrices, although the singular values are the same. For example,
A = randn(50,20) + 1i*randn(50,20);
[U,S,V] = svd(A,'econ');
[Ur,Sr,Vr] = svds(A,2);
U(1:4,1:2)
Ur(1:4,1:2)
S(1:2,1:2)
Sr(1:2,1:2)
But when X is small or real, two commands give the same results. For example,
A = randn(50,20);
[U,S,V] = svd(A,'econ');
[Ur,Sr,Vr] = svds(A,2);
U(1:4,1:2)
Ur(1:4,1:2)
S(1:2,1:2)
Sr(1:2,1:2)
Or,
A = randn(10,5) + 1i*randn(10,5);
[U,S,V] = svd(A,'econ');
[Ur,Sr,Vr] = svds(A,2);
U(1:4,1:2)
Ur(1:4,1:2)
S(1:2,1:2)
Sr(1:2,1:2)
Did I misunderstand something? Thanks in advance!

Bruno Luong on 9 Apr 2021
Edited: Bruno Luong on 9 Apr 2021
The singular value (eigen) decomposition SVD/SVDS is not unique, vectors is up to scaling, (values is up to order for eigen value decomposition - EIG/EIGS), and I'm not talking about multiple singular/eigen values (order > 1).
If you do
U(:,1:2)./Ur(:,1:2)
abs(U(:,1:2)./Ur(:,1:2))
after your code, you can clearly observe they are just proportonal by a unit complex scaling.
Bolun Chen on 9 Apr 2021
Thank you, Bruno!