ndarray
ndarray copied to clipboard
[Feature Request] More powerful `power` like `numpy.power`
#1042 has added element-wise power methods powi
and powf
. But they only accept one parameter.
In NumPy, numpy.power
receives two arrays, x1
and x2
. The latter could be a number or an array and performs power with different exponents.
An example from: https://numpy.org/doc/stable/reference/generated/numpy.power.html#numpy.power
x1 = np.arange(6)
x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0]
np.power(x1, x2)
# array([ 0., 1., 8., 27., 16., 5.])
Though we may archive this using an iterator, a more powerful function might fill the gap for users coming from NumPy.