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