On Tue, 18 Mar 2008 12:48:31 -0700 (PDT) Lou Pecora <[EMAIL PROTECTED]> wrote: > I have run into a failure of complex SVD in numpy > (version='1.0.3.1'). The error is: > > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy/linalg/linalg.py", > line 767, in svd > raise LinAlgError, 'SVD did not converge' > numpy.linalg.linalg.LinAlgError: SVD did not converge > > The matrix is complex 36 x 36. Very slight changes in > the matrix components (~ one part in 10^4) are enough > to make the error go away. I have never seen this > before and it goes against the fact (I think it's a > mathematical fact) that SVD always exists. A > hard-coded upper limit on the iteration number allowed > somewhere in the SVD C code seems to be the problem. > Read on. > > A google search turned up a few messages, included > this one from 2002 where the same error occurred > infrequently, but randomly (it seemed): > > ---------------------------------------------- > One online message in August 2002: > > Ok, so after several hours of trying to read that > code, I found > the parameter that needs to be tuned. In case anyone > has this > problem and finds this thread a year from now, here's > your hint: > >File: Src/dlapack_lite.c > Subroutine: dlasd4_ > Line: 22562 > > There's a for loop there that limits the number of > iterations to > 20. Increasing this value to 50 allows my matrix to > converge. > I have not bothered to test what the "best" value for > this number > is, though. In any case, it appears the number just > exists to > prevent infinite loops, and 50 isn't really that much > closer to > infinity than 20.... (Actually, I'm just going to set > it to 100 > so I don't have to think about it ever again.) > > Damian Menscher > -- > -=#| Physics Grad Student & SysAdmin @ U Illinois > Urbana-Champaign |#=- > -=#| 488 LLP, 1110 W. Green St, Urbana, IL 61801 > Ofc:(217)333-0038 |#=- > -=#| 1412 DCL, Workstation Services Group, CITES > Ofc:(217)244-3862 |#=- > -=#| <menscher at uiuc.edu> www.uiuc.edu/~menscher/ >Fax:(217)333-9819 |#=- > -------------------------------------------------- > > I have looked in Src/dlapack_lite.c and line 22562 is > no longer a line that sets a max. iterations > parameter. There are several set in the file, but > that code is hard to figure (sort of a Fortran-in-C > hybrid). > > Here's one, for example: > > maxit = *n * 6 * *n; // Line 887 > > I have no idea which parameter to tweak. Apparently > this error is still in numpy (at least to my version). > Does anyone have a fix? Should I start a ticket (I > think this is what people do)? Any help appreciated. >
Please can you post your matrix (in MatrixMarket format io.mmwrite) to the list. Cheers, Nils _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion