singular value decomposition?
Hi,
I need to solve a homogeneous system A.x = 0, where matrix A has 8 rows and 9 columns. I saw a paper that suggests to use singular value decomposition (SVD) to solve for x.
I googled and find defintions of SVD, but I don''t know how to implement it.
Also, I think I can use gauss elimination as an alternative method, and it''s easier to implement than SVD. But I heard that SVD is faster.
Any suggestions?
As to how to implement it, I found my SVD algorithm in numerical recipies in C ( if I remember correctly ).
When I programmed the algorithm as the book present it, I had a little problem though, the order of the singular value was not 100% correct, so I had to correct it. Again, if I remember correctly, it was something along the line of swapping the last two values ( and corresponding row and column of left and right matrices ).
I don''t know if SVD is the solution for that kind of problem though, I personally used it in a very different context.
When I programmed the algorithm as the book present it, I had a little problem though, the order of the singular value was not 100% correct, so I had to correct it. Again, if I remember correctly, it was something along the line of swapping the last two values ( and corresponding row and column of left and right matrices ).
I don''t know if SVD is the solution for that kind of problem though, I personally used it in a very different context.
This time, Google isn''t your only friend. Numerical Recipes is a valuable ressource for these kind of problems :
http://www.library.cornell.edu/nr/bookcpdf.html (chapter 2.6)
Some code for SVD
http://www.magic-software.com/Source/Math/WmlMatrix3.cpp
http://www.library.cornell.edu/nr/bookcpdf.html (chapter 2.6)
Some code for SVD
http://www.magic-software.com/Source/Math/WmlMatrix3.cpp
Even if SVD is faster in some case, which I doubt, it is not stable. Gaussian elimination with either sort of pivoting will be more stable.
if you want to solve a linear system that is Ax=b ( A is matrix x,b :are vectors)
but A is singular you cannot use standart methods ( Gaussian Elimination etc fails ) That why SVD is used.
If you have more equation than independent variable I suggest you to use pseudoinverse. That is something like
x=inverse(AT*A)*AT*b, AT is transpose of A.
but A is singular you cannot use standart methods ( Gaussian Elimination etc fails ) That why SVD is used.
If you have more equation than independent variable I suggest you to use pseudoinverse. That is something like
x=inverse(AT*A)*AT*b, AT is transpose of A.
quote:Original post by leinad
What's the purpose of the SVD, I want to know but I'm to lazy to clicky.
Don't be lazy. That will get you fired from McDonald's, .
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
[edited by - grhodes_at_work on October 17, 2003 10:31:18 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement