[Numpy-discussion] boolean matrix bug?

Alan G Isaac aisaac@american....
Wed Oct 3 11:03:33 CDT 2007


Shouldn't x**0 be boolean for a boolean matrix?

Cheers,
Alan Isaac

>>> import numpy
>>> numpy.__version__
'1.0.3.1'
>>> x = numpy.mat('1 1;1 0',dtype='bool')
>>> x**0
matrix([[ 1.,  0.],
        [ 0.,  1.]])
>>> x**1
matrix([[ True,  True],
        [ True, False]], dtype=bool)
>>> x**2
matrix([[ True,  True],
        [ True,  True]], dtype=bool)
>>>





More information about the Numpy-discussion mailing list