LinearAlgebraError: SVD did not converge

Damian Menscher menscher+python at
Tue Aug 27 21:18:33 CEST 2002

Fernando P?rez <fperez528 at> wrote:
> Damian Menscher wrote:

>> You say "the SVD decomposition always exists".  I agree.  But
>> apparently LinearAlgebra.singular_value_decomposition() doesn't
>> know that.

> Mmmhh, then it looks like it's time to debug 
> LinearAlgebra.singular_value_decomposition(). Not exactly what you wanted to 
> hear, is it? :)

Yeah, I tried that.  But the routine doesn't actually do any work.
It just calls lapack_lite.dgesdd.  And, that's just a .so file.  I
downloaded the source, and it's really scary stuff.  Porting a
Fortran math library to C and then calling it from Python is not
the best way to get readable code!

> Sorry I can't give a better answer at this point. Why don't you try computing 
> the SVD of your matrix (you said it was 26x26 only) in Mathematica or 
> something? It might hint at where the problem is. Other than that all I can 
> say is, roll up your sleeves and fix the Numeric SVD routine. Many will thank 
> you :)

Very unpleasant.  I'm reluctantly considering giving Mathematica a
shot, just to see how it responds.

Printing out the singular values the routine comes up with just
before it realizes it "didn't converge" indicates the condition
number of the matrix is about 1e8.  That corresponds well with the
other matrices I'm inverting.  Given that it apparently is taking
an iterative approach, my current plan is to modify the code to
increase the max number of iterations.

> FWIW, I've used the Numeric SVD without problems, so at least in some cases it 
> works.

Yes, it works fine for most matrices I give it.  It's just that
I'm giving it thousands of matrices, and the occasional failures
are a big headache.

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> Fax:(217)333-9819 |#=-

More information about the Python-list mailing list