An error of matrix inversion using NumPy
bjourne at gmail.com
Wed Apr 4 15:37:05 CEST 2007
On 4 Apr 2007 06:15:18 -0700, lancered <wangday at gmail.com> wrote:
> During the calculation, I noticed an apparent error of
> inverion of a 19x19 matrix. Denote this matrix as KK, U=KK^ -1, I
> found the product of U and KK is not equivalent to unit matrix! This
> apparently violate the definition of inversion. The inversion is
> through the function linalg.inv().
Could it have something to do with floating point accuracy?
>>> r = matrix([[random.random() * 9999 for x in range(19)] for y in range(19)])
>>> allclose(linalg.inv(r) * r, identity(19))
> 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.
Please post it.
More information about the Python-list