Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Louisa
Posts:
2
Registered:
10/4/11
|
|
Re: ZGESVD for highly ill-conditioned matrix
Posted:
Sep 13, 2012 10:37 AM
|
|
On Sep 13, 4:23 am, Ganesh Diwan <gcdi...@gmail.com> wrote: > Hello, > > My apologies if the question sounds too trivial but I am new to LAPACK and can't figure out what's going wrong with the code. Ok, so here it goes. > I need to solve for x in Ax = b system where the matrix A (about 100 x 100 size ) is square,( but could also be rectangular sometimes ), complex, dense, and highly ill-conditioned (condition number \kappa ~ 10E+017 ). The best way to solve such a system is obviously SVD. > > First I computed the SVD using Matlab, then obtained the inverse of A to get solution vector x ( A-1b ) and that gives me the correct answer ( I am solving a problem for which theoretical solution is available). > > But when I tried to solve the same problem with ZGESVD, I get a wrong solution. Wrong decomposition? Obviously! Yes, the matrix entries for U and V from ZGESVD and MATLAB ([u,s,v] = svd(A)) are very different. Only a few entries from upper left corner of U and V match (that too only upto 4 or 5 deciamal places). Surprisingly, I get a very good comparison between ZGESVD and Matlab for singular vector S. > > When I test the ZGESVD code for a small matrix with a reasonable \kappa (~ 10E+001 ) ( a randomly generated matrix from Matlab ), the comparison is very good for U, V and S (the numbers match to double precision ). I am not sure what goes wrong when I try this with a bigger and highly ill-conditioned complex matrix using ZGESVD. > > I checked for the correctness of the input that is given to ZGESVD (precision, sequence of arguments etc. ), everything looks OK. Not sure why I can?t get the correct SVD from ZGESVD when Matlab uses same routine for its SVD command. Is there anything I am missing?
Some code? Let's see your Fortran.
|
|
|
|