[Numpy-discussion] SVD error in Numpy. Bug?
Tue Mar 18 14:48:31 CDT 2008
I have run into a failure of complex SVD in numpy
(version='22.214.171.124'). The error is:
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.
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
problem and finds this thread a year from now, here's
There's a for loop there that limits the number of
20. Increasing this value to 50 allows my matrix to
I have not bothered to test what the "best" value for
is, though. In any case, it appears the number just
prevent infinite loops, and 50 isn't really that much
infinity than 20.... (Actually, I'm just going to set
it to 100
so I don't have to think about it ever again.)
-=#| Physics Grad Student & SysAdmin @ U Illinois
-=#| 488 LLP, 1110 W. Green St, Urbana, IL 61801
-=#| 1412 DCL, Workstation Services Group, CITES
-=#| <menscher at uiuc.edu> www.uiuc.edu/~menscher/
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
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.
I'm using a Mac Book Pro (Intel chip), system 10.4.11,
-- Lou Pecora, my views are my own.
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the Numpy-discussion