An error of matrix inversion using NumPy

Robin Becker robin at reportlab.com
Wed Apr 4 09:58:49 EDT 2007


lancered wrote:
> Hi dear all,
..........
> matrices are correct.
> 
>        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.
.......

presumably the matrix KK is actually some kind of normal matrix obtained from 
the data. So you have say n variables and m observations the data matrix is than 
an n x m real valued thing say D then you want the inverse of something like D'D 
ie an n by n thing. Typically the data D is de-meaned and normalized by the 
column norms so that you end up with a fairly well scaled problem.

A long time ago I used Numeric+python to do exactly this sort of calculation 
with excellent results and the matrices were as large or larger eg 100 x 100 and 
above. I don't think the underlying numeric routines have changed that much. If 
your matrix is symmetric then you should certainly be using

Even if you can't post the matrix, perhaps you should indicate how you proceed 
from data to matrix. Another problem is that a large determinant is no guarantee 
of stability for the inversion. If the largest eigenvalue is 10**100 and the 
smallest 10**-200 I probably have an ill determined problem; surprisingly easy 
to achieve :(
-- 
Robin Becker




More information about the Python-list mailing list