heat.array_api._elementwise_functions

Module Contents

abs(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates the absolute value for each element x_i of the input array x (i.e., the element-wise result has the same magnitude as the respective element in x but has positive sign).

Parameters:

x (Array) – Input array. Must have a numeric data type.

acos(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation of the principal value of the inverse cosine, having domain [-1, +1] and codomain [+0, +π], for each element x_i of the input array x. Each element-wise result is expressed in radians.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

acosh(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the inverse hyperbolic cosine, having domain [+1, +infinity] and codomain [+0, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array whose elements each represent the area of a hyperbolic sector. Must have a floating-point data type.

add(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:
  • x1 (Array) – First input array. Must have a numeric data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a numeric data type.

asin(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation of the principal value of the inverse sine, having domain [-1, +1] and codomain [-π/2, +π/2] for each element x_i of the input array x. Each element-wise result is expressed in radians.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

asinh(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the inverse hyperbolic sine, having domain [-infinity, +infinity] and codomain [-infinity, +infinity], for each element x_i in the input array x.

Parameters:

x (Array) – Input array whose elements each represent the area of a hyperbolic sector. Must have a floating-point data type.

atan(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an implementation-dependent approximation of the principal value of the inverse tangent, having domain [-infinity, +infinity] and codomain [-π/2, +π/2], for each element x_i of the input array x. Each element-wise result is expressed in radians.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

atan2(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an 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. Each element-wise result is expressed in radians.

The mathematical signs of x1_i and x2_i determine the quadrant of each element-wise result. The quadrant (i.e., branch) is chosen such that each element-wise result is the signed angle in radians between the ray ending at the origin and passing through the point (1,0) and the ray ending at the origin and passing through the point (x2_i, x1_i).

Parameters:
  • x1 (Array) – Input array corresponding to the y-coordinates. Must have a floating-point data type.

  • x2 (Array) – Input array corresponding to the x-coordinates. Must be compatible with x1 and have a floating-point data type.

atanh(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the inverse hyperbolic tangent, having domain [-1, +1] and codomain [-infinity, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array whose elements each represent the area of a hyperbolic sector. Must have a floating-point data type.

bitwise_and(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have an integer or boolean data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have an integer or boolean data type.

bitwise_left_shift(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have an integer data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have an integer data type. Each element must be greater than or equal to 0.

bitwise_invert(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:

x (Array) – Input array. Must have an integer or boolean data type.

bitwise_or(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have an integer or boolean data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have an integer or boolean data type.

bitwise_right_shift(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have an integer data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have an integer data type. Each element must be greater than or equal to 0.

bitwise_xor(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have an integer or boolean data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have an integer or boolean data type.

ceil(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:

x (Array) – Input array. Must have a numeric data type.

cos(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the cosine, having domain (-infinity, +infinity) and codomain [-1, +1], for each element x_i of the input array x. Each element x_i is assumed to be expressed in radians.

Parameters:

x (Array) – Input array whose elements are each expressed in radians. Must have a floating-point data type.

cosh(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the hyperbolic cosine, having domain [-infinity, +infinity] and codomain [-infinity, +infinity], for each element x_i in the input array x.

Parameters:

x (Array) – Input array whose elements each represent a hyperbolic angle. Must have a floating-point data type.

divide(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:
  • x1 (Array) – Dividend input array. Must have a numeric data type.

  • x2 (Array) – Divisor input array. Must be compatible with x1 and have a numeric data type.

equal(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array.

  • x2 (Array) – Second input array. Must be compatible with x1.

exp(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the exponential function, having domain [-infinity, +infinity] and codomain [+0, +infinity], 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).

Parameters:

x (Array) – Input array. Must have a floating-point data type.

expm1(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to exp(x)-1, having domain [-infinity, +infinity] and codomain [-1, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

floor(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:

x (Array) – Input array. Must have a numeric data type.

floor_divide(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a numeric data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a numeric data type.

greater(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a numeric data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a numeric data type.

greater_equal(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a numeric data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a numeric data type.

isfinite(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Tests each element x_i of the input array x to determine if finite (i.e., not NaN and not equal to positive or negative infinity).

Parameters:

x (Array) – Input array. Must have a numeric data type.

isinf(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:

x (Array) – Input array. Must have a numeric data type.

isnan(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:

x (Array) – Input array. Must have a numeric data type.

less(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a numeric data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a numeric data type.

less_equal(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a numeric data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a numeric data type.

log(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the natural (base e) logarithm, having domain [0, +infinity] and codomain [-infinity, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

log1p(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to log(1+x), where log refers to the natural (base e) logarithm, having domain [-1, +infinity] and codomain [-infinity, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

log2(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the base 2 logarithm, having domain [0, +infinity] and codomain [-infinity, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

log10(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the base 10 logarithm, having domain [0, +infinity] and codomain [-infinity, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

logaddexp(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a floating-point data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a floating-point data type.

logical_and(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a boolean data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a boolean data type.

logical_not(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:

x (Array) – Input array. Must have a boolean data type.

logical_or(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a boolean data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a boolean data type.

logical_xor(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array. Must have a boolean data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a boolean data type.

multiply(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:
  • x1 (Array) – First input array. Must have a numeric data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a numeric data type.

negative(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:

x (Array) – Input array. Must have a numeric data type.

not_equal(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – First input array.

  • x2 (Array) – Second input array. Must be compatible with x1.

positive(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:

x (Array) – Input array. Must have a numeric data type.

pow(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an 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.

Parameters:
  • x1 (Array) – First input array whose elements correspond to the exponentiation base. Must have a numeric data type.

  • x2 (Array) – Second input array whose elements correspond to the exponentiation exponent. Must be compatible with x1 and have a numeric data type.

remainder(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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.

Parameters:
  • x1 (Array) – Dividend input array. Must have a numeric data type.

  • x2 (Array) – Divisor input array. Must be compatible with x1 and have a numeric data type.

round(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:

x (Array) – Input array. Must have a numeric data type.

sign(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:

x (Array) – Input array. Must have a numeric data type.

sin(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the sine, having domain (-infinity, +infinity) and codomain [-1, +1], for each element x_i of the input array x. Each element x_i is assumed to be expressed in radians.

Parameters:

x (Array) – Input array whose elements are each expressed in radians. Must have a floating-point data type.

sinh(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the hyperbolic sine, having domain [-infinity, +infinity] and codomain [-infinity, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array whose elements each represent a hyperbolic angle. Must have a floating-point data type.

square(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Squares (x_i * x_i) each element x_i of the input array x.

Parameters:

x (Array) – Input array. Must have a numeric data type.

sqrt(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates the square root, having domain [0, +infinity] and codomain [0, +infinity], for each element x_i of the input array x.

Parameters:

x (Array) – Input array. Must have a floating-point data type.

subtract(x1: heat.array_api._array_object.Array, x2: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

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

Parameters:
  • x1 (Array) – First input array. Must have a numeric data type.

  • x2 (Array) – Second input array. Must be compatible with x1 and have a numeric data type.

tan(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the tangent, having domain (-infinity, +infinity) and codomain (-infinity, +infinity), for each element x_i of the input array x. Each element x_i is assumed to be expressed in radians.

Parameters:

x (Array) – Input array whose elements are each expressed in radians. Must have a floating-point data type.

tanh(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Calculates an approximation to the hyperbolic tangent, having domain [-infinity, +infinity] and codomain [-1, +1], for each element x_i of the input array x.

Parameters:

x (Array) – Input array whose elements each represent a hyperbolic angle. Must have a floating-point data type.

trunc(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]

Rounds each element x_i of the input array x to the integer-valued number that is closest to but no greater than x_i.

Parameters:

x (Array) – Input array. Must have a numeric data type.