Re: [Lapackpp-devel] Problem finding Null space using LaSVD_IP()
Status: Beta
Brought to you by:
cstim
From: Christian S. <sti...@tu...> - 2006-12-15 09:18:12
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Good to hear. Feel free to ask more questions if something appears to be wrong. By the way you should be able to write std::cout<<U_; as well. Regarding the mailing list address: This is a "mailing list", not a "forum". You have been sending your emails to the address "lapackpp-devel-owner (at) lists.sourceforge.net" which is wrong; the correct email address to send your messages to is lap...@li... (no -owner)! Thanks. Christian Sonia Singhal schrieb: > hi, > > I think I caught my mistake. I didnt make a copy of the matrix before I > checked for the homogenous solution. :( > ~ sonia > > On 12/14/06, *Sonia Singhal * <son...@gm... > <mailto:son...@gm...>> wrote: > > Hi, > > Thanks for the reply. > As for posting it on the forum. I had sent the mail to the forum, I > have no clue how you have received the mail. I initially emailed it > without joining the list and got an error message, maybe thats the > reason you got it. > > As for the problem, even I am not familiar with the algorithms used > for svd and am not sure if the null spaces would be the same, but I > assumed that since MATLAB also uses LAPACK the answers would be the > same. > Even if the answers are not the same and I assume that the NULL > spaces are returned, then multiplying the original matrix A with a > row ( or column ) of VT ( or V ) beyond the rank should be zero. I > did this and I got a very high value when I used Norm_Inf(). Whereas > in MATLAB I get a very small value ( 10^-14). > > Also right now I was making small examples ( 3x4, 3x5 ) and what I > found was for some examples I am getting right answers and for some > they are wrong. By right and wrong I mean comparing both with matlab > and checking if A*VT(r,:) is zero. > > For example : > This code / exmaple gives the correct answers > > //------------------------------------------------------------------------------------------------------ > // Trying SVD > LaGenMatDouble ForSVD(3,5); > ForSVD(0,0) = 1; > ForSVD(0,1) = 2; > ForSVD(0,2) = 3; > ForSVD(0,3) = 4; > ForSVD(0,4) = 2; > ForSVD(1,0) = 2; > ForSVD(1,1) = 3; > ForSVD(1,2) = 9; > ForSVD(1,3) = 2; > ForSVD(1,4) = 0; > ForSVD(2,0) = 4; > ForSVD(2,1) = 5; > ForSVD(2,2) = 8; > ForSVD(2,3) = 7; > ForSVD(2,4) = 4; > LaVectorDouble S_(3); > LaGenMatDouble U_(3,3), VT_(5,5); > LaSVD_IP(ForSVD, S_, U_, VT_); > LaVectorDouble x_(5); > > for(i=0; i<5; ++i){ > x_(i) = VT_(4,i); > } > std::cout << "\tNorm_Inf(A*x)" << Norm_Inf(ForSVD*x_) << > std::endl; > std::cout << "U:" << std::endl; > for(int i=0; i<3; ++i){ > for(int j=0; j<3; ++j){ > std::cout << U_(i,j) << " "; > } > std::cout << std::endl; > } > std::cout << "V:" << std::endl; > for(int i=0; i<5; ++i){ > for(int j=0; j<5; ++j){ > std::cout << VT_(i,j) << " "; > } > std::cout << std::endl; > } > > // > ----------------------------------------------------------------------------------- > and this doesnt. > // > ----------------------------------------------------------------------------------- > > // Trying SVD > LaGenMatDouble ForSVD(3,5); > ForSVD(0,0) = 1; > ForSVD(0,1) = 2; > ForSVD(0,2) = 3; > ForSVD(0,3) = 4; > ForSVD(1,0) = 2; > ForSVD(1,1) = 3; > ForSVD(1,2) = 9; > ForSVD(1,3) = 2; > ForSVD(2,0) = 4; > ForSVD(2,1) = 5; > ForSVD(2,2) = 8; > ForSVD(2,3) = 7; > LaVectorDouble S_(3); > LaGenMatDouble U_(3,3), VT_(4,4); > LaSVD_IP(ForSVD, S_, U_, VT_); > LaVectorDouble x_(5); > > for(i=0; i<5; ++i){ > x_(i) = VT_(4,i); > } > std::cout << "\tNorm_Inf(A*x)" << Norm_Inf(ForSVD*x_) << > std::endl; > std::cout << "U:" << std::endl; > for(int i=0; i<3; ++i){ > for(int j=0; j<3; ++j){ > std::cout << U_(i,j) << " "; > } > std::cout << std::endl; > } > std::cout << "V:" << std::endl; > for(int i=0; i<4; ++i){ > for(int j=0; j<4; ++j){ > std::cout << VT_(i,j) << " "; > } > std::cout << std::endl; > } > // > ------------------------------------------------------------------------------------------------ > Thanks for your time, > ~ Sonia -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBRYJoP2XAi+BfhivFAQKzCQP7BvwUeKqGlbLSYrh2rVbWoy7yAFjYD5AT cBVEPecyYR1sX5ZN1Dj3CPRquGB1GcNexlnQfPJ9Tnawc4ZY4djjZa7BtOxXFzJq ZEfXlXbRiR1emMi/ikW5DLvvWPrkUGz9uCeA1MTIppL6xtcyd4Lui9PygAL+rrhq u19NPB9Le8k= =aaop -----END PGP SIGNATURE----- |