numpy Operator Overloading
The original numpy operators are stored in upy.operators.original_numpy_ops, while the numpy operators are actually overlaoded with ufunc classes from the module upy.operators. The ufunc classes resemble the original operators as far as possible, with the exception of undarray handling.
The ufuncWrap class
-
class upy.operators.ufuncWrap(ufunc_name, overload)[source]
Wraps numpy ufuncs. Behaves like the original, with the exception
that __call__() will be overloaded.
-
ufuncWrap.__init__(ufunc_name, overload)[source]
UFUNC is the ufunc to be wrapped. OVERLOAD is the name (string)
of the undarray method to be used in overloading __call__().
-
ufuncWrap.__call__(a, b, *args, **kwargs)[source]
When B is an undarray, call B.overload(a), else .ufunc(a, b).
-
ufuncWrap.__getattr__(attr)[source]
Return getattr(.ufunc, ATTR).
-
ufuncWrap.__str__()[source]
-
ufuncWrap.__repr__()[source]
Arithmetic operators
-
class upy.operators.Add[source]
-
upy.add
-
class upy.operators.Subtract[source]
-
upy.subtract
-
class upy.operators.Multiply[source]
-
upy.multiply
-
class upy.operators.Divide[source]
-
upy.divide
-
class upy.operators.Power[source]
-
upy.power
Comparison operators
-
class upy.operators.Less[source]
-
upy.less
-
class upy.operators.LessEqual[source]
-
upy.less_equal
-
class upy.operators.Greater[source]
-
upy.greater
-
class upy.operators.GreaterEqual[source]
-
upy.greater_equal
-
class upy.operators.Equal[source]
-
Equal.__call__(a, b, *args, **kwargs)[source]
-
upy.equal
-
class upy.operators.NotEqual[source]
-
NotEqual.__call__(a, b, *args, **kwargs)[source]