"SVD" here in NR3 forum vs. wikipedia: who's winning?

01-26-2011, 01:31 PM
In the hopes of clarifying some doubts I have about the validity of output from the svd routines obtained from this forum (see various hardcopy examples throughout the returns on search "matrix" wrt svd), I went to wikipedia and pulled up the page on "singular value decomposition" http://en.wikipedia.org/wiki/Singular_value_decomposition.

Simply put, the "example" (see heading there of this name) shows a 4 x 5 matrix "M" and in the immediately following decomposition illustration shows a corresponding "U" matrix having only 4 rows and 4 columns!

Doesn't this directly conflict with the notion that the N x M
matrix is actually rectangular not square, but moreover, how can a square matrix add a dimension ... (so quickly)?

My question is which examples are correct? Wiki's set doesn't attempt to reassemble the original matrix "M" but then again, could the "Product [U] x [W] x [V-Transpose]" that it proposes be correct with [U] being only 4 x 4?

[edited by poster]

Online matrix solver verifies wikipedia 4 x 4 "U" from 5 x 4 "M", so ignoring this reference above, is there a good reason why return "U"(&etc) values for wikipedia's "M":

1 0 0 0 2
0 0 3 0 0
0 0 0 0 0
0 4 0 0 0

using MPD78's modified davekw7x routine example given in "how to include svdcmp" thread posted by florian101 the output decomposition is not the same?

01-28-2011, 12:27 PM
...some doubts ...
Decomposition is not unique. For me, the importance of SVD is not the intermediate matrix size and shape; it's the application to which I am applying it.

There is a mention of a couple of different approaches (that give different size and shapes of the intermediate matrices) here: SVD in Mathematica (http://mathworld.wolfram.com/SingularValueDecomposition.html)

Here's the thread where I showed how I used NR3 SVD to find the pseudo-inverse of your example matrix: SVD and pseudoinverse (http://www.nr.com/forum/showthread.php?t=993#4)

Even though the intermediate matrices were different from some other SVD method examples, the resulting pseudoinverse matrix was the same.

Bottom line: Unlike most other routines, the NR3 authors treat SVD code as a "black box" and don't offer (much) insight on its development. They do give references. (However...See Footnote.)

SVD is a starting point for performing certain operations. There are plenty of circumstances with certain matrices that even SVD can't save us.

If you find an example of an application that uses SVD as a tool and it gives gives incorrect results, how about posting it?



The question of "who is winning" implies that there is some kind of contest. I think there are plenty of statements by the authors of the Numerical Recipes to the effect that the methods presented are for educational purposes, and not necessarily to be used as a canned library of routines that are in some way superior to other published packages. (Although, in many cases, they may be absolutely appropriate for general use; I won't say more about this.)


Therefore, in my opinion, the question of who's winning is irrelevant.

But maybe that's just me. I'm funny that way.

(I have no connection with the Numerical Recipes authors or the owners of this forum.)