numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
set_numeric_ops(op1=func1, op2=func2, ...)
deprecated

For the general case, use :c:func:`PyUFunc_ReplaceLoopBySignature`. For ndarray subclasses, define the __array_ufunc__ method and override the relevant ufunc.

Notes

.. WARNING:: 
    Use with care!  Incorrect usage may lead to memory errors.

A function replacing an operator cannot make use of that operator. For example, when replacing add, you may not use + . Instead, directly call ufuncs.

Parameters

op1, op2, ... : callable

Each op = func pair describes an operator to be replaced. For example, add = lambda x, y: np.add(x, y) % 5 would replace addition by modulus 5 addition.

Returns

saved_ops : list of callables

A list of all operators, stored before making replacements.

Set numerical operators for array objects.

Examples

>>> def add_mod5(x, y):
...  return np.add(x, y) % 5 ...
>>> old_funcs = np.set_numeric_ops(add=add_mod5)
>>> x = np.arange(12).reshape((3, 4))
... x + x array([[0, 2, 4, 1], [3, 0, 2, 4], [1, 3, 0, 2]])
>>> ignore = np.set_numeric_ops(**old_funcs) # restore operators
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : None#None
type: <class 'builtin_function_or_method'>
Commit: