LinearAlgebraError: SVD did not converge

Damian Menscher menscher+python at uiuc.edu
Tue Aug 27 13:25:20 EDT 2002


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

>> I'm trying to get the SVD inverse of a matrix, so I'm calling
>> LinearAlgebra.generalized_inverse(M, rcond).  But sometimes it
>> bombs out with the error "LinearAlgebraError: SVD did not
>> converge".  Seems odd that it would die, considering Numerical
>> Recipes states "SVD... (theoretically) cannot fail...." (section
>>  15.4).

> Keep in mind they're talking about it not failing to solve a least-squares 
> problem, not not failing in general for an arbitrary inversion problem. The 
> SVD decomposition always exists, but that doesn't mean that the inverse does.
> What SVD buys you is the clear identification of the redundant directions, and 
> with this information you can (in the context of least squares fitting) make 
> an informed decision on what to do with them rather than trying to get a 
> delicate cancellation of arbitrarily large constants in the original problem.

> In your case, you should try to identify where the problem is by computing the 
> SVD decomposition of your matrix first on its own, and looking at the 
> singular value spectrum. What's the largest to smallest ratio? That's the 
> condition number of your matrix, and a large one will be an indication that 
> your matrix is nearly singular (numerically), hence hell to invert. If that's 
> the case, you'll need to think a bit about your problem, since chances are a 
> black box inverter will always fail with a near-singular matrix.

Thanks for the response, but actually the error actually is from the
singular_value_decomposition() routine.  It doesn't matter whether
I call it (my usual mode of operation) or let generalized_inverse()
call it.

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

Damian Menscher [is frustrated]
-- 
-=#| 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 |#=-



More information about the Python-list mailing list