Universal Functions (ufunc)#
Mars tensor provides universal functions(a.k.a ufuncs) to support various elementwise operations. Mars tensor’s ufunc supports following features of Numpy’s one:
Broadcasting
Output type determination
Casting rules
Mars tensor’s ufunc currently does not support methods
like reduce
, accumulate
, reduceat
, outer
, and at
.
Available ufuncs#
Math operations#
Add arguments element-wise. |
|
Subtract arguments, element-wise. |
|
Multiply arguments element-wise. |
|
Divide arguments element-wise. |
|
Logarithm of the sum of exponentiations of the inputs. |
|
Logarithm of the sum of exponentiations of the inputs in base-2. |
|
Returns a true division of the inputs, element-wise. |
|
Return the largest integer smaller or equal to the division of the inputs. |
|
Numerical negative, element-wise. |
|
First tensor elements raised to powers from second tensor, element-wise. |
|
Return element-wise remainder of division. |
|
Return element-wise remainder of division. |
|
Return the element-wise remainder of division. |
|
Calculate the absolute value element-wise. |
|
Round elements of the tensor to the nearest integer. |
|
Returns an element-wise indication of the sign of a number. |
|
Calculate the exponential of all elements in the input tensor. |
|
Calculate 2**p for all p in the input tensor. |
|
Natural logarithm, element-wise. |
|
Base-2 logarithm of x. |
|
Return the base 10 logarithm of the input tensor, element-wise. |
|
Calculate |
|
Return the natural logarithm of one plus the input tensor, element-wise. |
|
Return the positive square-root of an tensor, element-wise. |
|
Return the element-wise square of the input. |
|
Return the reciprocal of the argument, element-wise. |
Trigonometric functions#
Trigonometric sine, element-wise. |
|
Cosine element-wise. |
|
Compute tangent element-wise. |
|
Inverse sine, element-wise. |
|
Trigonometric inverse cosine, element-wise. |
|
Trigonometric inverse tangent, element-wise. |
|
Element-wise arc tangent of |
|
Given the "legs" of a right triangle, return its hypotenuse. |
|
Hyperbolic sine, element-wise. |
|
Hyperbolic cosine, element-wise. |
|
Compute hyperbolic tangent element-wise. |
|
Inverse hyperbolic sine element-wise. |
|
Inverse hyperbolic cosine, element-wise. |
|
Inverse hyperbolic tangent element-wise. |
|
Convert angles from degrees to radians. |
|
Convert angles from radians to degrees. |
Bit-twiddling functions#
Compute the bit-wise AND of two tensors element-wise. |
|
Compute the bit-wise OR of two tensors element-wise. |
|
Compute the bit-wise XOR of two arrays element-wise. |
|
Compute bit-wise inversion, or bit-wise NOT, element-wise. |
|
Shift the bits of an integer to the left. |
|
Shift the bits of an integer to the right. |
Comparison functions#
Return the truth value of (x1 > x2) element-wise. |
|
Return the truth value of (x1 >= x2) element-wise. |
|
Return the truth value of (x1 < x2) element-wise. |
|
Return the truth value of (x1 =< x2) element-wise. |
|
Return (x1 != x2) element-wise. |
|
Return (x1 == x2) element-wise. |
|
Compute the truth value of x1 AND x2 element-wise. |
|
Compute the truth value of x1 OR x2 element-wise. |
|
Compute the truth value of x1 XOR x2, element-wise. |
|
Compute the truth value of NOT x element-wise. |
|
Element-wise maximum of tensor elements. |
|
Element-wise minimum of tensor elements. |
|
Element-wise maximum of array elements. |
|
Element-wise minimum of array elements. |
Floating point values#
Test element-wise for finiteness (not infinity or not Not a Number). |
|
Test element-wise for positive or negative infinity. |
|
Test element-wise for NaN and return result as a boolean tensor. |
|
Returns element-wise True where signbit is set (less than zero). |
|
Change the sign of x1 to that of x2, element-wise. |
|
Return the next floating-point value after x1 towards x2, element-wise. |
|
Return the fractional and integral parts of a tensor, element-wise. |
|
Returns x1 * 2**x2, element-wise. |
|
Decompose the elements of x into mantissa and twos exponent. |
|
Return the element-wise remainder of division. |
|
Return the floor of the input, element-wise. |
|
Return the ceiling of the input, element-wise. |
|
Return the truncated value of the input, element-wise. |