What is the difference between numpy.power or ** for negative exponents and / when working with arrays? and why does numpy.power not act element-wise as described in the documentation.
For example, using python 2.7.3:
>>> from __future__ import division
>>> import numpy as np
>>> A = arange(9).reshape(3,3)
>>> A
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
It appears that ** and numpy.power are not acting element-wise when the exponent is negative
>>> A**-1
array([[-9223372036854775808, 1, 0],
[ 0, 0, 0],
[ 0, 0, 0]])
>>> np.power(A, -1)
array([[-9223372036854775808, 1, 0],
[ 0, 0, 0],
[ 0, 0, 0]])
Whereas / is acting element-wise
>>> 1/A
array([[ inf, 1. , 0.5 ],
[ 0.33333333, 0.25 , 0.2 ],
[ 0.16666667, 0.14285714, 0.125 ]])
I have no such problems when the exponent is positive. Why does it behave differently for negative exponents?