Mathematical Functions¶

Trigonometric functions¶

 cupy.sin Elementwise sine function. cupy.cos Elementwise cosine function. cupy.tan Elementwise tangent function. cupy.arcsin Elementwise inverse-sine function (a.k.a. cupy.arccos Elementwise inverse-cosine function (a.k.a. cupy.arctan Elementwise inverse-tangent function (a.k.a. cupy.hypot Computes the hypoteneous of orthogonal vectors of given length. cupy.arctan2 Elementwise inverse-tangent of the ratio of two arrays. cupy.degrees Converts angles from radians to degrees elementwise. cupy.radians Converts angles from degrees to radians elementwise. cupy.unwrap Unwrap by changing deltas between values to 2*pi complement. cupy.deg2rad Converts angles from degrees to radians elementwise. cupy.rad2deg Converts angles from radians to degrees elementwise.

Hyperbolic functions¶

 cupy.sinh Elementwise hyperbolic sine function. cupy.cosh Elementwise hyperbolic cosine function. cupy.tanh Elementwise hyperbolic tangent function. cupy.arcsinh Elementwise inverse of hyperbolic sine function. cupy.arccosh Elementwise inverse of hyperbolic cosine function. cupy.arctanh Elementwise inverse of hyperbolic tangent function.

Rounding¶

 cupy.around Rounds to the given number of decimals. cupy.round_ cupy.rint Rounds each element of an array to the nearest integer. cupy.fix If given value x is positive, it return floor(x). cupy.floor Rounds each element of an array to its floor integer. cupy.ceil Rounds each element of an array to its ceiling integer. cupy.trunc Rounds each element of an array towards zero.

Sums, products, differences¶

 cupy.prod Returns the product of an array along given axes. cupy.sum Returns the sum of an array along given axes. cupy.cumprod Returns the cumulative product of an array along a given axis. cupy.cumsum Returns the cumulative sum of an array along a given axis. cupy.nansum Returns the sum of an array along given axes treating Not a Numbers (NaNs) as zero. cupy.nanprod Returns the product of an array along given axes treating Not a Numbers (NaNs) as zero. cupy.diff Calculate the n-th discrete difference along the given axis.

Exponents and logarithms¶

 cupy.exp Elementwise exponential function. cupy.expm1 Computes exp(x) - 1 elementwise. cupy.exp2 Elementwise exponentiation with base 2. cupy.log Elementwise natural logarithm function. cupy.log10 Elementwise common logarithm function. cupy.log2 Elementwise binary logarithm function. cupy.log1p Computes log(1 + x) elementwise. cupy.logaddexp Computes log(exp(x1) + exp(x2)) elementwise. cupy.logaddexp2 Computes log2(exp2(x1) + exp2(x2)) elementwise.

Other special functions¶

 cupy.i0 Modified Bessel function of the first kind, order 0. cupy.sinc Elementwise sinc function.

Floating point routines¶

 cupy.signbit Tests elementwise if the sign bit is set (i.e. cupy.copysign Returns the first argument with the sign bit of the second elementwise. cupy.frexp Decomposes each element to mantissa and two’s exponent. cupy.ldexp Computes x1 * 2 ** x2 elementwise. cupy.nextafter Computes the nearest neighbor float values towards the second argument.

Arithmetic operations¶

 cupy.add Adds two arrays elementwise. cupy.reciprocal Computes 1 / x elementwise. cupy.negative Takes numerical negative elementwise. cupy.multiply Multiplies two arrays elementwise. cupy.divide Elementwise true division (i.e. cupy.power Computes x1 ** x2 elementwise. cupy.subtract Subtracts arguments elementwise. cupy.true_divide Elementwise true division (i.e. cupy.floor_divide Elementwise floor division (i.e. cupy.fmod Computes the remainder of C division elementwise. cupy.mod Computes the remainder of Python division elementwise. cupy.modf Extracts the fractional and integral parts of an array elementwise. cupy.remainder Computes the remainder of Python division elementwise. cupy.divmod

Handling complex numbers¶

 cupy.angle Returns the angle of the complex argument. cupy.real Returns the real part of the elements of the array. cupy.imag Returns the imaginary part of the elements of the array. cupy.conj Returns the complex conjugate, element-wise.

Miscellaneous¶

 cupy.clip Clips the values of an array to a given interval. cupy.sqrt Elementwise square root function. cupy.cbrt Elementwise cube root function. cupy.square Elementwise square function. cupy.absolute Elementwise absolute value function. cupy.sign Elementwise sign function. cupy.maximum Takes the maximum of two arrays elementwise. cupy.minimum Takes the minimum of two arrays elementwise. cupy.fmax Takes the maximum of two arrays elementwise. cupy.fmin Takes the minimum of two arrays elementwise. cupy.nan_to_num Elementwise nan_to_num function. cupy.blackman Returns the Blackman window. cupy.hamming Returns the Hamming window. cupy.hanning Returns the Hanning window.