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_iof the input arrayx(i.e., the element-wise result has the same magnitude as the respective element inxbut 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 elementx_iof the input arrayx. 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 elementx_iof the input arrayx.- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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 elementx_iof the input arrayx. 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 elementx_iin the input arrayx.- 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 elementx_iof the input arrayx. 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 thexnotation 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 arraysx1andx2, respectively. Each element-wise result is expressed in radians.The mathematical signs of
x1_iandx2_idetermine 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).
- 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 elementx_iof the input arrayx.- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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_iof the input arrayx1to the left by appendingx2_i(i.e., the respective element in the input arrayx2) zeros to the right ofx1_i.
- bitwise_invert(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]
Inverts (flips) each bit for each element
x_iof the input arrayx.- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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_iof the input arrayx1to the right according to the respective elementx2_iof the input arrayx2.
- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- ceil(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]
Rounds each element
x_iof the input arrayxto the smallest (i.e., closest to-infinity) integer-valued number that is not less thanx_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 elementx_iof the input arrayx. Each elementx_iis 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 elementx_iin the input arrayx.- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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_ifor each elementx1_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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 elementx_iof the input arrayx(eraised to the power ofx_i, whereeis 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 elementx_iof the input arrayx.- 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_iof the input arrayxto the greatest (i.e., closest to+infinity) integer-valued number that is not greater thanx_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_iof the input arrayx1by the respective elementx2_iof the input arrayx2to the greatest (i.e., closest to+infinity) integer-value number that is not greater than the division result.
- 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_ifor each elementx1_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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_ifor each elementx1_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- isfinite(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]
Tests each element
x_iof the input arrayxto determine if finite (i.e., notNaNand 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_iof the input arrayxto 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_iof the input arrayxto determine whether the element isNaN.- 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_ifor each elementx1_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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_ifor each elementx1_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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 elementx_iof the input arrayx.- 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), wherelogrefers to the natural (basee) logarithm, having domain[-1, +infinity]and codomain[-infinity, +infinity], for each elementx_iof the input arrayx.- 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
2logarithm, having domain[0, +infinity]and codomain[-infinity, +infinity], for each elementx_iof the input arrayx.- 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
10logarithm, having domain[0, +infinity]and codomain[-infinity, +infinity], for each elementx_iof the input arrayx.- 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 elementx1_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- logical_not(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]
Computes the logical NOT for each element
x_iof the input arrayx.- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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 arrayx.- 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_ifor each elementx1_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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 arrayx.- 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 arrayx1to the power ofx2_i(the exponent), wherex2_iis the corresponding element of the input arrayx2.
- 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_iof the input arrayx1and the respective elementx2_iof the input arrayx2.
- round(x: heat.array_api._array_object.Array, /) heat.array_api._array_object.Array[source]
Rounds each element
x_iof the input arrayxto 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_iof the input arrayx.- 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 elementx_iof the input arrayx. Each elementx_iis 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 elementx_iof the input arrayx.- 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 elementx_iof the input arrayx.- 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 elementx_iof the input arrayx.- 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_iof the input arrayx1with the respective elementx2_iof the input arrayx2.
- 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 elementx_iof the input arrayx. Each elementx_iis 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 elementx_iof the input arrayx.- 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_iof the input arrayxto the integer-valued number that is closest to but no greater thanx_i.- Parameters:
x (Array) – Input array. Must have a numeric data type.