I'm writing unit tests for a module that contains matrices. I was
surprised that these are True:

>> import numpy.matlib as mp
>> x = mp.matrix([[mp.nan]])
>> x.any()
   True
>> x.all()
   True

My use case is (x == y).all() where x and y are the same matrix except
that x contains one NaN. Certianly x and y are not equal.

>> x = mp.asmatrix(range(4)).reshape(2,2)
>> y = mp.asmatrix(range(4)).reshape(2,2)
>> x[0,0] = mp.nan
>> (x == y).all()
   True
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to