You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Numpy ufuncs are things like np.add and np.equal, currently we support arithmetic methods via the standard Python operands like + (through __add__) but not the equivalent ufunc.
I discovered this issue because the following doesn't work:
In addition some things like np.maximum and np.isinf might be quite nice to have working without having to access .data, also if we implement __array_ufunc__ we can have those things return quantities.
Describe the bug
Numpy ufuncs are things like
np.add
andnp.equal
, currently we support arithmetic methods via the standard Python operands like+
(through__add__
) but not the equivalent ufunc.I discovered this issue because the following doesn't work:
In addition some things like
np.maximum
andnp.isinf
might be quite nice to have working without having to access.data
, also if we implement__array_ufunc__
we can have those things return quantities.See Recommendations for implementing binary operations in the NEP for how I think we need to go about this.
The overview is:
__array_ufunc__
.__add__
etc, call the numpy ufunc, i.e.__add__
callsnp.add
.NotImplemented
if the other operand has__array_ufunc__ = None
.The text was updated successfully, but these errors were encountered: