Mathematical functions¶
Basic functions:
|
absolute value |
|
absolute value of floating point values |
|
remainder of the floating point division operation |
|
signed remainder of the division operation |
|
smaller of two batches |
|
larger of two batches |
|
smaller of two batches of floating point values |
|
larger of two batches of floating point values |
|
positive difference |
|
clipping operation |
Exponential functions:
|
natural exponential function |
|
base 2 exponential function |
|
base 10 exponential function |
|
natural exponential function, minus one |
|
natural logarithm function |
|
base 2 logarithm function |
|
base 10 logarithm function |
|
natural logarithm of one plus function |
Power functions:
|
power function |
|
reciprocal square root function |
|
square root function |
|
cubic root function |
|
hypotenuse function |
Trigonometric functions:
|
sine function |
|
cosine function |
|
sine and cosine function |
|
tangent function |
|
arc sine function |
|
arc cosine function |
|
arc tangent function |
|
arc tangent function, determining quadrants |
Hyperbolic functions:
|
hyperbolic sine function |
|
hyperbolic cosine function |
|
hyperbolic tangent function |
|
inverse hyperbolic sine function |
|
inverse hyperbolic cosine function |
|
inverse hyperbolic tangent function |
Error functions:
|
error function |
|
complementary error function |
|
gamma function |
|
natural logarithm of the gamma function |
Nearint operations:
|
nearest integers not less |
|
nearest integers not greater |
|
nearest integers not greater in magnitude |
|
nearest integers, rounding away from zero |
|
nearest integers using current rounding mode |
|
nearest integers using current rounding mode |
- template <class T, class A>
-
batch<T, A>
xsimd::abs(batch<T, A> const &x)¶ Computes the absolute values of each scalar in the batch
x.- Return
the absolute values of
x.- Parameters
x: batch of integer or floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::cbrt(batch<T, A> const &x)¶ Computes the cubic root of the batch
x.- Return
the cubic root of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::clip(batch<T, A> const &x, batch<T, A> const &lo, batch<T, A> const &hi)¶ Clips the values of the batch
xbetween those of the batchesloandhi.- Return
the result of the clipping.
- Parameters
x: batch of scalar values.lo: batch of scalar values.hi: batch of scalar values.
- template <class T, class A>
-
batch<T, A>
xsimd::exp(batch<T, A> const &x)¶ Computes the natural exponential of the batch
x.- Return
the natural exponential of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::exp10(batch<T, A> const &x)¶ Computes the base 10 exponential of the batch
x.- Return
the base 10 exponential of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::exp2(batch<T, A> const &x)¶ Computes the base 2 exponential of the batch
x.- Return
the base 2 exponential of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::expm1(batch<T, A> const &x)¶ Computes the natural exponential of the batch
x, minus one.- Return
the natural exponential of
x, minus one.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::fabs(batch<T, A> const &x)¶ Computes the absolute values of each scalar in the batch
x.- Return
the absolute values of
x.- Parameters
x: batch floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::fdim(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the positive difference between
xandy, that is,max(0, x-y).- Return
the positive difference.
- Parameters
x: batch of floating point values.y: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::fmax(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the larger values of the batches
xandy.- Return
a batch of the larger values.
- Parameters
x: a batch of integer or floating point values.y: a batch of integer or floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::fmin(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the smaller values of the batches
xandy.- Return
a batch of the smaller values.
- Parameters
x: a batch of integer or floating point values.y: a batch of integer or floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::fmod(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the modulo of the batch
xby the batchy.- Return
the result of the modulo.
- Parameters
x: batch involved in the modulo.y: batch involved in the modulo.
- template <class T, class A>
-
batch<T, A>
xsimd::hypot(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the square root of the sum of the squares of the batches
x, andy.- Return
the square root of the sum of the squares of
xandy.- Parameters
x: batch of floating point values.y: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::log(batch<T, A> const &x)¶ Computes the natural logarithm of the batch
x.- Return
the natural logarithm of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::log2(batch<T, A> const &x)¶ Computes the base 2 logarithm of the batch
x.- Return
the base 2 logarithm of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::log10(batch<T, A> const &x)¶ Computes the base 10 logarithm of the batch
x.- Return
the base 10 logarithm of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::log1p(batch<T, A> const &x)¶ Computes the natural logarithm of one plus the batch
x.- Return
the natural logarithm of one plus
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::max(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the larger values of the batches
xandy.- Return
a batch of the larger values.
- Parameters
x: a batch of integer or floating point values.y: a batch of integer or floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::min(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the smaller values of the batches
xandy.- Return
a batch of the smaller values.
- Parameters
x: a batch of integer or floating point values.y: a batch of integer or floating point values.
- template <class T, class A>
-
complex_batch_type_t<batch<T, A>>
xsimd::polar(batch<T, A> const &r, batch<T, A> const &theta = batch<T, A>{})¶ Returns a complex batch with magnitude
rand phase angletheta.- Return
rexp(i *theta).- Parameters
r: The magnitude of the desired complex result.theta: The phase angle of the desired complex result.
- template <class T, class A>
-
batch<T, A>
xsimd::pow(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the value of the batch
xraised to the powery.- Return
xraised to the powery.- Parameters
x: batch of floating point values.y: batch of floating point values.
- template <class T, class ITy, class A, class = typename std::enable_if<std::is_integral<ITy>::value, void>::type>
-
batch<T, A>
xsimd::pow(batch<T, A> const &x, ITy y)¶ Computes the value of the batch
xraised to the powery.- Return
xraised to the powery.- Parameters
x: batch of integral values.y: batch of integral values.
- template <class T, class A>
-
batch<T, A>
xsimd::remainder(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the remainder of dividing
xbyy.- Return
the result of the addition.
- Parameters
x: batch of scalar valuesy: batch of scalar values
- template <class T, class A>
-
batch<T, A>
xsimd::rsqrt(batch<T, A> const &x)¶ Computes an estimate of the inverse square root of the batch
x.- Warning
Unlike most xsimd function, this does not return the same result as the equivalent scalar operation, trading accuracy for speed.
- Return
the inverse square root of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::sqrt(batch<T, A> const &x)¶ Computes the square root of the batch
x.- Return
the square root of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::acos(batch<T, A> const &x)¶ Computes the arc cosine of the batch
x.- Return
the arc cosine of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::acosh(batch<T, A> const &x)¶ Computes the inverse hyperbolic cosine of the batch
x.- Return
the inverse hyperbolic cosine of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::asin(batch<T, A> const &x)¶ Computes the arc sine of the batch
x.- Return
the arc sine of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::asinh(batch<T, A> const &x)¶ Computes the inverse hyperbolic sine of the batch
x.- Return
the inverse hyperbolic sine of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::atan(batch<T, A> const &x)¶ Computes the arc tangent of the batch
x.- Return
the arc tangent of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::atan2(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the arc tangent of the batch
x/y, using the signs of the arguments to determine the correct quadrant.- Return
the arc tangent of
x/y.- Parameters
x: batch of floating point values.y: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::atanh(batch<T, A> const &x)¶ Computes the inverse hyperbolic tangent of the batch
x.- Return
the inverse hyperbolic tangent of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::cos(batch<T, A> const &x)¶ Computes the cosine of the batch
x.- Return
the cosine of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::cosh(batch<T, A> const &x)¶ computes the hyperbolic cosine of the batch
x.- Return
the hyperbolic cosine of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::sin(batch<T, A> const &x)¶ Computes the sine of the batch
x.- Return
the sine of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
std::pair<batch<T, A>, batch<T, A>>
xsimd::sincos(batch<T, A> const &x)¶ Computes the sine and the cosine of the batch
x.This method is faster than calling sine and cosine independently.
- Return
a pair containing the sine then the cosine of batch
x- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::sinh(batch<T, A> const &x)¶ Computes the hyperbolic sine of the batch
x.- Return
the hyperbolic sine of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::tan(batch<T, A> const &x)¶ Computes the tangent of the batch
x.- Return
the tangent of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::tanh(batch<T, A> const &x)¶ Computes the hyperbolic tangent of the batch
x.- Return
the hyperbolic tangent of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::ceil(batch<T, A> const &x)¶ Computes the batch of smallest integer values not less than scalars in
x.- Return
the batch of smallest integer values not less than
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::floor(batch<T, A> const &x)¶ Computes the batch of largest integer values not greater than scalars in
x.- Return
the batch of largest integer values not greater than
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::nearbyint(batch<T, A> const &x)¶ Rounds the scalars in
xto integer values (in floating point format), using the current rounding mode.- Return
the batch of nearest integer values.
- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<as_integer_t<T>, A>
xsimd::nearbyint_as_int(batch<T, A> const &x)¶ Rounds the scalars in
xto integer values (in integer format) using the current rounding mode.- Return
the batch of nearest integer values.
- Warning
For very large values the conversion to int silently overflows.
- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::rint(batch<T, A> const &x)¶ Rounds the scalars in
xto integer values (in floating point format), using the current rounding mode.- Return
the batch of rounded values.
- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::round(batch<T, A> const &x)¶ Computes the batch of nearest integer values to scalars in
x(in floating point format), rounding halfway cases away from zero, regardless of the current rounding mode.- Return
the batch of nearest integer values.
- Parameters
x: batch of flaoting point values.
- template <class T, class A>
-
batch<T, A>
xsimd::trunc(batch<T, A> const &x)¶ Computes the batch of nearest integer values not greater in magnitude than scalars in
x.- Return
the batch of nearest integer values not greater in magnitude than
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::erf(batch<T, A> const &x)¶ Computes the error function of the batch
x.- Return
the error function of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::erfc(batch<T, A> const &x)¶ Computes the complementary error function of the batch
x.- Return
the error function of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::ldexp(const batch<T, A> &x, const batch<as_integer_t<T>, A> &y)¶ Computes the multiplication of the floating point number
xby 2 raised to the powery.- Return
a batch of floating point values.
- Parameters
x: batch of floating point values.y: batch of integer values.
- template <class T, class A>
-
batch<T, A>
xsimd::lgamma(batch<T, A> const &x)¶ Computes the natural logarithm of the gamma function of the batch
x.- Return
the natural logarithm of the gamma function of
x.- Parameters
x: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::nextafter(batch<T, A> const &x, batch<T, A> const &y)¶ Computes the next representable floating-point value following x in the direction of y.
- Return
xraised to the powery.- Parameters
x: batch of floating point values.y: batch of floating point values.
- template <class T, class A>
-
batch<T, A>
xsimd::tgamma(batch<T, A> const &x)¶ Computes the gamma function of the batch
x.- Return
the gamma function of
x.- Parameters
x: batch of floating point values.