# TDecompSVD ... non orthogonal V !?!

Hi
I am using TDecompSVD to decompose a ~ (1500 x 150) sized matrix. The decomposition seems to work, but I dont really understand the output as the matrix V is not orthogonal as I would expect. When I run the following…

``````TDecompSVD svd(A);
cout << svd.Decompose() << endl;
TMatrixD V = svd.GetV();
TMatrixD id = V.Transpose(V) * V;
cout << "ID " << id.Sum() <<" "<< id.Min() <<" "<<id.Max()<< endl;``````

… then I get this output …

``````1
ID 1.76085 -0.581951 1``````

… when I would expect the minimum value to be 0 and the sum to be just equal to the dimension. When I looked at the matrix id in detail, I found that its only the first few rows that have non zero entries.

What can go wrong with the SVD? Is there a way to fix this? I thought its guaranteed to get orthogonal matrices out. Am I doing something completely wrong?

ps: actually I am not 100% about the usage of transpose. Isnt it a bit strange that I have to put the matrix as parameter and still the method isnt static?

now i am almost sure that I am doing something wrong…
when I multiply the matrix V to a random vector, then the length of this vector doenst change. However, when I multiply the transpose afterwards, i dont get the original vector

``````a.Randomize(0.5,0.3,0.235);
TVectorD a_old = a;
cout << a.Norm2Sqr() << endl;
a = V.Transpose(V) * a;
cout << a.Norm2Sqr() << endl;
a = V * a;
cout << a.Norm2Sqr() << endl;
TVectorD err = a-a_old;
cout << "err " << err.Norm2Sqr() << endl;``````

from this i get the following output…

``````4.58507
4.58507
4.58507
err 3.4213``````

which is somehow not consistent, as a matrix that does not change the 2norm of a vector is orthogonal and thus i would also expect that VV’a = a but it isnt…

Just to close this post… what was wrong is the line

it should be

[code]TMatrixD id = V;
id.Transpose(id);[\code]

According to the documentation Transpose is void. I dont understand why the above code didnt produce an error. However, my actual problem is solved.