numpy.
ufunc
Functions that operate element by element on whole arrays.
To see the documentation for a specific ufunc, use info. For example, np.info(np.sin). Because ufuncs are written in C (for speed) and linked into Python with NumPy’s ufunc facility, Python’s help() function finds this page whenever help() is called on a ufunc.
info
np.info(np.sin)
A detailed explanation of ufuncs can be found in the docs for Universal functions (ufunc).
Calling ufuncs: op(*x[, out], where=True, **kwargs)
op(*x[, out], where=True, **kwargs)
Apply op to the arguments *x elementwise, broadcasting the arguments.
The broadcasting rules are:
Dimensions of length 1 may be prepended to either array.
Arrays may be repeated along dimensions of length 1.
Input arrays.
Alternate array object(s) in which to put the result; if provided, it must have a shape that the inputs broadcast to. A tuple of arrays (possible only as a keyword argument) must have length equal to the number of outputs; use None for uninitialized outputs to be allocated by the ufunc.
This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.
out=None
For other keyword-only arguments, see the ufunc docs.
r will have the shape that the arrays in x broadcast to; if out is provided, it will be returned. If not, r will be allocated and may contain uninitialized values. If the function has more than one output, then the result will be a tuple of arrays.
identity
The identity value.
nargs
The number of arguments.
nin
The number of inputs.
nout
The number of outputs.
ntypes
The number of types.
signature
Definition of the core elements a generalized ufunc operates on.
types
Returns a list with types grouped input->output.
Methods
__call__(*args, **kwargs)
__call__
Call self as a function.
accumulate(array[, axis, dtype, out])
accumulate
Accumulate the result of applying the operator to all elements.
at(a, indices[, b])
at
Performs unbuffered in place operation on operand ‘a’ for elements specified by ‘indices’.
outer(A, B, /, **kwargs)
outer
Apply the ufunc op to all pairs (a, b) with a in A and b in B.
reduce(array[, axis, dtype, out, keepdims, …])
reduce
Reduces array’s dimension by one, by applying ufunc along one axis.
array
reduceat(array, indices[, axis, dtype, out])
reduceat
Performs a (local) reduce with specified slices over a single axis.