[Numpy-discussion] boolean matrix bug?

Alan G Isaac aisaac at american.edu
Wed Oct 3 12:03:33 EDT 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