[Numpy-discussion] SVD error in Numpy. Bug?

Lou Pecora lou_boog2000@yahoo....
Tue Mar 18 14:48:31 CDT 2008

I have run into a failure of complex SVD in numpy
(version='').  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.
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
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

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,
Python 2.4.4.

-- 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 mailing list