[Numpy-discussion] A bug in scipy.linalg.lu_factor?

Paulo J. S. Silva pjssilva at ime.usp.br
Thu Jan 25 12:06:23 CST 2007


Hello,

I am trying to write some unit tests to my new "Automatic matrix" code
and I think I bumped into a bug in scipy.linalg.lu_factor. If you give a
matrix to it, it doesn't honor the overwrite_a option:

In [1]:import numpy as num

In [2]:M = num.mat(num.random.rand(2,2))

In [3]:print M
[[ 0.33267781  0.2100424 ]
 [ 0.61852696  0.32244386]]

In [4]:import scipy.linalg as la

In [5]:LU, P = la.lu_factor(M, overwrite_a=0); print M
[[ 0.33267781  0.63136882]
 [ 0.61852696 -0.06807478]]

In [6]:LU, P = la.lu_factor(M, overwrite_a=0); print M
[[ 0.63136882  0.52691517]
 [-0.06807478  0.6543966 ]]

As you can see the matrix is changed by calling the function.

can anyone confirm this? I am running numpy 1.0.1 and scipy 0.5.2.

Best,

Paulo



More information about the Numpy-discussion mailing list