Numerical Recipes Forum  

Go Back   Numerical Recipes Forum > Numerical Recipes Third Edition Forum > General Hints, Tips, and Tricks for Using NR3

Thread Tools Rate Thread Display Modes
Old 01-26-2011, 02:31 PM
jmbl49 jmbl49 is offline
Registered User
Join Date: Jan 2008
Posts: 5
"SVD" here in NR3 forum vs. wikipedia: who's winning?

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"

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?

Last edited by jmbl49; 01-26-2011 at 06:01 PM. Reason: confirmation and addition
Reply With Quote
Old 01-28-2011, 01:27 PM
davekw7x davekw7x is offline
Registered User
Join Date: Jan 2008
Posts: 453
Originally Posted by jmbl49 View Post
...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

Here's the thread where I showed how I used NR3 SVD to find the pseudo-inverse of your example matrix: SVD and pseudoinverse

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.)

Last edited by davekw7x; 01-29-2011 at 10:50 AM.
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 07:49 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.