Element-wise Functions

Array API specification for element-wise functions.

Objects in API

abs(x, /)

Calculates the absolute value for each element x_i of the input array x.

acos(x, /)

Calculates an implementation-dependent approximation of the principal value of the inverse cosine for each element x_i of the input array x.

acosh(x, /)

Calculates an implementation-dependent approximation to the inverse hyperbolic cosine for each element x_i of the input array x.

add(x1, x2, /)

Calculates the sum for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

asin(x, /)

Calculates an implementation-dependent approximation of the principal value of the inverse sine for each element x_i of the input array x.

asinh(x, /)

Calculates an implementation-dependent approximation to the inverse hyperbolic sine for each element x_i in the input array x.

atan(x, /)

Calculates an implementation-dependent approximation of the principal value of the inverse tangent for each element x_i of the input array x.

atan2(x1, x2, /)

Calculates an implementation-dependent approximation of the inverse tangent of the quotient x1/x2, having domain [-infinity, +infinity] x [-infinity, +infinity] (where the x notation denotes the set of ordered pairs of elements (x1_i, x2_i)) and codomain [-π, +π], for each pair of elements (x1_i, x2_i) of the input arrays x1 and x2, respectively.

atanh(x, /)

Calculates an implementation-dependent approximation to the inverse hyperbolic tangent for each element x_i of the input array x.

bitwise_and(x1, x2, /)

Computes the bitwise AND of the underlying binary representation of each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

bitwise_left_shift(x1, x2, /)

Shifts the bits of each element x1_i of the input array x1 to the left by appending x2_i (i.e., the respective element in the input array x2) zeros to the right of x1_i.

bitwise_invert(x, /)

Inverts (flips) each bit for each element x_i of the input array x.

bitwise_or(x1, x2, /)

Computes the bitwise OR of the underlying binary representation of each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

bitwise_right_shift(x1, x2, /)

Shifts the bits of each element x1_i of the input array x1 to the right according to the respective element x2_i of the input array x2.

bitwise_xor(x1, x2, /)

Computes the bitwise XOR of the underlying binary representation of each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

ceil(x, /)

Rounds each element x_i of the input array x to the smallest (i.e., closest to -infinity) integer-valued number that is not less than x_i.

clip(x, /, min=None, max=None)

Clamps each element x_i of the input array x to the range [min, max].

conj(x, /)

Returns the complex conjugate for each element x_i of the input array x.

copysign(x1, x2, /)

Composes a floating-point value with the magnitude of x1_i and the sign of x2_i for each element of the input array x1.

cos(x, /)

Calculates an implementation-dependent approximation to the cosine for each element x_i of the input array x.

cosh(x, /)

Calculates an implementation-dependent approximation to the hyperbolic cosine for each element x_i in the input array x.

divide(x1, x2, /)

Calculates the division of each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

equal(x1, x2, /)

Computes the truth value of x1_i == x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

exp(x, /)

Calculates an implementation-dependent approximation to the exponential function for each element x_i of the input array x (e raised to the power of x_i, where e is the base of the natural logarithm).

expm1(x, /)

Calculates an implementation-dependent approximation to exp(x)-1 for each element x_i of the input array x.

floor(x, /)

Rounds each element x_i of the input array x to the greatest (i.e., closest to +infinity) integer-valued number that is not greater than x_i.

floor_divide(x1, x2, /)

Rounds the result of dividing each element x1_i of the input array x1 by the respective element x2_i of the input array x2 to the greatest (i.e., closest to +infinity) integer-value number that is not greater than the division result.

greater(x1, x2, /)

Computes the truth value of x1_i > x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

greater_equal(x1, x2, /)

Computes the truth value of x1_i >= x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

hypot(x1, x2, /)

Computes the square root of the sum of squares for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

imag(x, /)

Returns the imaginary component of a complex number for each element x_i of the input array x.

isfinite(x, /)

Tests each element x_i of the input array x to determine if finite.

isinf(x, /)

Tests each element x_i of the input array x to determine if equal to positive or negative infinity.

isnan(x, /)

Tests each element x_i of the input array x to determine whether the element is NaN.

less(x1, x2, /)

Computes the truth value of x1_i < x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

less_equal(x1, x2, /)

Computes the truth value of x1_i <= x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

log(x, /)

Calculates an implementation-dependent approximation to the natural (base e) logarithm for each element x_i of the input array x.

log1p(x, /)

Calculates an implementation-dependent approximation to log(1+x), where log refers to the natural (base e) logarithm, for each element x_i of the input array x.

log2(x, /)

Calculates an implementation-dependent approximation to the base 2 logarithm for each element x_i of the input array x.

log10(x, /)

Calculates an implementation-dependent approximation to the base 10 logarithm for each element x_i of the input array x.

logaddexp(x1, x2, /)

Calculates the logarithm of the sum of exponentiations log(exp(x1) + exp(x2)) for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

logical_and(x1, x2, /)

Computes the logical AND for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

logical_not(x, /)

Computes the logical NOT for each element x_i of the input array x.

logical_or(x1, x2, /)

Computes the logical OR for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

logical_xor(x1, x2, /)

Computes the logical XOR for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

maximum(x1, x2, /)

Computes the maximum value for each element x1_i of the input array x1 relative to the respective element x2_i of the input array x2.

minimum(x1, x2, /)

Computes the minimum value for each element x1_i of the input array x1 relative to the respective element x2_i of the input array x2.

multiply(x1, x2, /)

Calculates the product for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

negative(x, /)

Computes the numerical negative of each element x_i (i.e., y_i = -x_i) of the input array x.

nextafter(x1, x2, /)

Returns the next representable floating-point value for each element x1_i of the input array x1 in the direction of the respective element x2_i of the input array x2.

not_equal(x1, x2, /)

Computes the truth value of x1_i != x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

positive(x, /)

Computes the numerical positive of each element x_i (i.e., y_i = +x_i) of the input array x.

pow(x1, x2, /)

Calculates an implementation-dependent approximation of exponentiation by raising each element x1_i (the base) of the input array x1 to the power of x2_i (the exponent), where x2_i is the corresponding element of the input array x2.

real(x, /)

Returns the real component of a complex number for each element x_i of the input array x.

reciprocal(x, /)

Returns the reciprocal for each element x_i of the input array x.

remainder(x1, x2, /)

Returns the remainder of division for each element x1_i of the input array x1 and the respective element x2_i of the input array x2.

round(x, /)

Rounds each element x_i of the input array x to the nearest integer-valued number.

sign(x, /)

Returns an indication of the sign of a number for each element x_i of the input array x.

signbit(x, /)

Determines whether the sign bit is set for each element x_i of the input array x.

sin(x, /)

Calculates an implementation-dependent approximation to the sine for each element x_i of the input array x.

sinh(x, /)

Calculates an implementation-dependent approximation to the hyperbolic sine for each element x_i of the input array x.

square(x, /)

Squares each element x_i of the input array x.

sqrt(x, /)

Calculates the principal square root for each element x_i of the input array x.

subtract(x1, x2, /)

Calculates the difference for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

tan(x, /)

Calculates an implementation-dependent approximation to the tangent for each element x_i of the input array x.

tanh(x, /)

Calculates an implementation-dependent approximation to the hyperbolic tangent for each element x_i of the input array x.

trunc(x, /)

Rounds each element x_i of the input array x to the nearest integer-valued number that is closer to zero than x_i.