Problem with SVD


Wolf
08-14-2002, 03:00 AM
Hi,
I am using the svdcmp() routine (V2.10). The two bugs in this routine reported on this web site I have corrected and I read the discussion about the uniqueness of SV-decompositions.

The matricees I have to decompose are singular and some of the singular values are equal. My algorithm enforces this condition. A simple example is the following 3x3 matrix:
Matrix (3x3):
-0.988228951897092 -1.086594333683141 -1.433160736952583
-3.190200029661606 0.190459703263404 -6.475629910954768
1.400596416735888 7.158603907761226 -0.778109120408813

The singular values are (7.421974, 7.421974, 0.)

Fist question: The singular values of the matricees provided in the example xsvdcmp are nicely sorted in descendeing order. The singular values of real world matricees are not. Is svdcmp() designed to sort the singular values or not?

Second question: If a matrix has equal singular values, an orthogonal transformation may be applied to the corresponding columns. For the above case this means, that the column corresponding to the singular value sv=0. should be equal to other decompositions (up to sign). The other two columns may have different values. Comparing the columns of u and v corresponding to sv=0. returned by svdcmp(), MATHLAB and MATHEMATICA I get:

Column of u corresponding to sv=0.;

svdcmp() MATHLAB MATHEMATICA
----------------------------------------------------------
0.961016 -0.9610 -0.961016
-0.230954 0.2310 0.230954
0.152016 -0.1520 -0.152016

Column of v corresponding to sv=0.;

svdcmp() MATHLAB MATHEMATICA
----------------------------------------------------------
0.872872 0.8729 -0.872872
0.458956 -0.2182 0.218218
0.165695 -0.4364 0.436436

How can this be?

With best regards,
Frank Wolf.

Saul Teukolsky
08-14-2002, 08:33 PM
Dear Frank,

Sorry, I'm unable to reproduce your problem. I get the same values you quote for the other programs. Note that xsvdcmp (if you're using that as the driver program) outputs the transpose of V, so you have to read the first row, not the first column. That's the only thing I can think of.

Good luck in tracking your problem down.

Saul Teukolsky

Wolf
08-15-2002, 01:21 AM
Thanks for the hint. You are right. Yes, svdcmp() does work correctly. I really overlooked, that the transpose of v is returned. So the bug must be somewhere in my code.

Could you please comment on the singular value sorting question?

With best regards,
Frank.

Saul Teukolsky
08-15-2002, 01:34 PM
Hi Frank,

The singular values are not sorted in general.

Saul

pjt33
09-10-2002, 09:03 PM
> The two bugs in this routine reported on this web site I have corrected

Where are they reported? I've looked over the website pretty thoroughly. I'm getting failure to converge on my Java port, even when I make the convergence test really lax, and I'd like to check I was porting a correct version.

Saul Teukolsky
09-10-2002, 09:12 PM
Look under Official Bug Reports on this forum.

Saul Teukolsky