NDArray or a scalar as the second argument and broadcast as needed.
add
Add arguments element-wise.
Returns:
NDArray — Element-wise sum of the inputs.
subtract
Subtract arguments element-wise.
Returns:
NDArray — Element-wise difference x1 - x2.
multiply
Multiply arguments element-wise.
Returns:
NDArray — Element-wise product.
divide
Divide arguments element-wise (true division).
Returns:
NDArray — Element-wise quotient x / divisor.
true_divide
Alias fordivide. Returns true (floating-point) division.
floor_divide
Element-wise floor division. Returns the largest integer less than or equal to the division.
Returns:
NDArray — Element-wise floor of x / divisor.
mod
Element-wise modulo (remainder of floor division). Equivalent toremainder.
Returns:
NDArray — Element-wise remainder.
remainder
Element-wise remainder of division. Equivalent tomod.
Returns:
NDArray — Element-wise remainder of x1 / x2.
fmod
Element-wise remainder using C-libraryfmod. The result has the same sign as the dividend.
Returns:
NDArray — Element-wise C-style remainder.
divmod
Return element-wise quotient and remainder simultaneously.
Returns:
[NDArray, NDArray] — Tuple of [quotient, remainder].
power
Element-wise exponentiation.
Returns:
NDArray — Element-wise x1 ** x2.
pow
Alias forpower.
float_power
Element-wise power, always returning float64 results.
Returns:
NDArray — Element-wise x1 ** x2 as float64.
sqrt
Return the non-negative square root of each element.
Returns:
NDArray — Element-wise square root.
square
Return the element-wise square.
Returns:
NDArray — Element-wise x * x.
cbrt
Return the cube root of each element.
Returns:
NDArray — Element-wise cube root.
absolute
Compute the absolute value element-wise.
Returns:
NDArray — Element-wise absolute value.
abs
Alias forabsolute.
fabs
Compute the absolute value element-wise (float version). Identical toabsolute for real-valued arrays.
Returns:
NDArray — Element-wise absolute value as float.
sign
Return the element-wise sign:-1 for negative, 0 for zero, 1 for positive.
Returns:
NDArray — Element-wise sign indication.
negative
Numerical negative, element-wise.
Returns:
NDArray — Element-wise -x.
positive
Numerical positive, element-wise. Returns a copy.
Returns:
NDArray — Copy of the input array.
reciprocal
Return the reciprocal (1/x) of each element.
Returns:
NDArray — Element-wise 1 / x.
heaviside
Compute the Heaviside step function. Returns0 where x1 < 0, x2 where x1 == 0, and 1 where x1 > 0.
Returns:
NDArray — Element-wise Heaviside step function.
gcd
Return the greatest common divisor of|x1| and |x2|, element-wise.
Returns:
NDArray — Element-wise GCD.
lcm
Return the least common multiple of|x1| and |x2|, element-wise.
Returns:
NDArray — Element-wise LCM.
frexp
Decompose each element into mantissa and exponent, such thatx = mantissa * 2**exponent.
Returns:
[NDArray, NDArray] — Tuple of [mantissa, exponent] arrays.
ldexp
Computex1 * 2**x2, element-wise. The inverse of frexp.
Returns:
NDArray — Element-wise x1 * 2**x2.
modf
Return the fractional and integer parts of each element.
Returns:
[NDArray, NDArray] — Tuple of [fractional_part, integer_part].