[Numpy-discussion] matrix problem: float to matrix power

Alan G Isaac aisaac at american.edu
Wed Oct 31 02:40:27 EDT 2007


>>> 1.0**numpy.array([1,2,3])
array([ 1.,  1.,  1.])
>>> 1.0**numpy.mat([1,2,3])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for ** or pow(): 'float' and 'matrix'

Why the restriction for matrices?

Same question for matrices conformable for broadcasting:
why not produce the equivalent of the array result?

Cheers,
Alan Isaac






More information about the NumPy-Discussion mailing list