Mathematical Functions

Trigonometric functions

mars.tensor.sin Trigonometric sine, element-wise.
mars.tensor.cos Cosine element-wise.
mars.tensor.tan Compute tangent element-wise.
mars.tensor.arcsin Inverse sine, element-wise.
mars.tensor.arccos Trigonometric inverse cosine, element-wise.
mars.tensor.arctan Trigonometric inverse tangent, element-wise.
mars.tensor.hypot Given the “legs” of a right triangle, return its hypotenuse.
mars.tensor.arctan2 Element-wise arc tangent of x1/x2 choosing the quadrant correctly.
mars.tensor.degrees Convert angles from radians to degrees.
mars.tensor.radians Convert angles from degrees to radians.
mars.tensor.deg2rad Convert angles from degrees to radians.
mars.tensor.rad2deg Convert angles from radians to degrees.

Hyperbolic functions

mars.tensor.sinh Hyperbolic sine, element-wise.
mars.tensor.cosh Hyperbolic cosine, element-wise.
mars.tensor.tanh Compute hyperbolic tangent element-wise.
mars.tensor.arcsinh Inverse hyperbolic sine element-wise.
mars.tensor.arccosh Inverse hyperbolic cosine, element-wise.
mars.tensor.arctanh Inverse hyperbolic tangent element-wise.

Rounding

mars.tensor.around Evenly round to the given number of decimals.
mars.tensor.round_ Evenly round to the given number of decimals.
mars.tensor.rint Round elements of the tensor to the nearest integer.
mars.tensor.fix Round to nearest integer towards zero.
mars.tensor.floor Return the floor of the input, element-wise.
mars.tensor.ceil Return the ceiling of the input, element-wise.
mars.tensor.trunc Return the truncated value of the input, element-wise.

Sums, products, differences

mars.tensor.prod Return the product of tensor elements over a given axis.
mars.tensor.sum Sum of tensor elements over a given axis.
mars.tensor.nanprod Return the product of array elements over a given axis treating Not a Numbers (NaNs) as ones.
mars.tensor.nansum Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero.
mars.tensor.cumprod Return the cumulative product of elements along a given axis.
mars.tensor.cumsum Return the cumulative sum of the elements along a given axis.
mars.tensor.nancumprod Return the cumulative product of tensor elements over a given axis treating Not a Numbers (NaNs) as one.
mars.tensor.nancumsum Return the cumulative sum of tensor elements over a given axis treating Not a Numbers (NaNs) as zero.
mars.tensor.diff Calculate the n-th discrete difference along the given axis.
mars.tensor.ediff1d The differences between consecutive elements of a tensor.

Exponential and logarithms

mars.tensor.exp Calculate the exponential of all elements in the input tensor.
mars.tensor.expm1 Calculate exp(x) - 1 for all elements in the tensor.
mars.tensor.exp2 Calculate 2**p for all p in the input tensor.
mars.tensor.log Natural logarithm, element-wise.
mars.tensor.log10 Return the base 10 logarithm of the input tensor, element-wise.
mars.tensor.log2 Base-2 logarithm of x.
mars.tensor.log1p Return the natural logarithm of one plus the input tensor, element-wise.
mars.tensor.logaddexp Logarithm of the sum of exponentiations of the inputs.
mars.tensor.logaddexp2 Logarithm of the sum of exponentiations of the inputs in base-2.

Other special functions

mars.tensor.i0 Modified Bessel function of the first kind, order 0.
mars.tensor.sinc Return the sinc function.

Floating point routines

mars.tensor.signbit Returns element-wise True where signbit is set (less than zero).
mars.tensor.copysign Change the sign of x1 to that of x2, element-wise.
mars.tensor.frexp Decompose the elements of x into mantissa and twos exponent.
mars.tensor.ldexp Returns x1 * 2**x2, element-wise.
mars.tensor.nextafter Return the next floating-point value after x1 towards x2, element-wise.
mars.tensor.spacing Return the distance between x and the nearest adjacent number.

Arithmetic operations

mars.tensor.add Add arguments element-wise.
mars.tensor.reciprocal Return the reciprocal of the argument, element-wise.
mars.tensor.positive Numerical positive, element-wise.
mars.tensor.negative Numerical negative, element-wise.
mars.tensor.multiply Multiply arguments element-wise.
mars.tensor.divide Divide arguments element-wise.
mars.tensor.power First tensor elements raised to powers from second tensor, element-wise.
mars.tensor.subtract Subtract arguments, element-wise.
mars.tensor.true_divide Returns a true division of the inputs, element-wise.
mars.tensor.floor_divide Return the largest integer smaller or equal to the division of the inputs.
mars.tensor.float_power First tensor elements raised to powers from second array, element-wise.
mars.tensor.fmod Return the element-wise remainder of division.
mars.tensor.mod Return element-wise remainder of division.
mars.tensor.modf Return the fractional and integral parts of a tensor, element-wise.
mars.tensor.remainder Return element-wise remainder of division.

Handling complex numbers

mars.tensor.angle Return the angle of the complex argument.
mars.tensor.real Return the real part of the complex argument.
mars.tensor.imag Return the imaginary part of the complex argument.
mars.tensor.conj Return the complex conjugate, element-wise.

Miscellaneous

mars.tensor.clip Clip (limit) the values in a tensor.
mars.tensor.sqrt Return the positive square-root of an tensor, element-wise.
mars.tensor.cbrt Return the cube-root of an tensor, element-wise.
mars.tensor.square Return the element-wise square of the input.
mars.tensor.absolute Calculate the absolute value element-wise.
mars.tensor.sign Returns an element-wise indication of the sign of a number.
mars.tensor.maximum Element-wise maximum of tensor elements.
mars.tensor.minimum Element-wise minimum of tensor elements.
mars.tensor.fmax Element-wise maximum of array elements.
mars.tensor.fmin Element-wise minimum of array elements.
mars.tensor.nan_to_num Replace nan with zero and inf with large finite numbers.