An error of matrix inversion using NumPy

Travis Oliphant oliphant.travis at ieee.org
Wed Apr 4 14:08:18 EDT 2007


lancered wrote:
> 
> 
>        So,  can you tell me what goes wrong?  Is this a bug in
> Numpy.linalg? How to deal with this situation?  If you need, I can
> post the matrix I used below, but it is so long,so not at the moment.
>

As you discovered, it is very likely your problem is a very high 
condition number.

The easiest thing to do is to use

numpy.linalg.pinv

to perform a pseudo-inverse which will only use the singular-values that 
are well-conditioned to compute the inverse.

This will still not give you an exact identity, but at least you will 
know you aren't amplifiying low-valued singular vectors.

-Travis






More information about the Python-list mailing list