Core arithmetic functions
These functions allows performing some basic arithmetic operations and some less basic.
abs, absmax, absmin, add, agm, average, ceil, chi, clamp, copysign, cosine_similarity, covariance, dec, dist, div, dot, fdim, floor, fmod, frac, fracscale, heaviside, inc, lerp, manhattan, max, maxabs, maxmag, min, minabs, minmag, minmax, minus, modf, mul, nearest, negabsmax, negabsmin, negate,negatenz, negmaxabs, negminabs, oneminus, rat, rec, reldist, rem, remainder, round, roundscale, rsqrt, saturate, sign, sign_alternate signnz, sqr, sqrt, sub, sum_of_squares, trunc, variance, welford_average, welford_covariance, welford_variance.
Variables | |
| constexpr auto | eve::abs = functor<abs_t> |
| elementwise_callable object computing the absolute value of the parameter. | |
| constexpr auto | eve::absmax = functor<absmax_t> |
| tuple_callable computing the absolute value of the maximal element. | |
| constexpr auto | eve::absmin = functor<absmin_t> |
| tuple_callable computing the absolute value of the minimal element. | |
| constexpr auto | eve::add = functor<add_t> |
| tuple_callable computing the sum of its arguments. | |
| constexpr auto | eve::agm = functor<agm_t> |
| elementwise_callable object computing the arithmetic-geometric mean. | |
| constexpr auto | eve::average = functor<average_t> |
| tuple_callable computing the arithmetic mean of its arguments. | |
| constexpr auto | eve::ceil = functor<ceil_t> |
| strict_elementwise_callable object computing the smallest integer not less than the input. | |
| constexpr auto | eve::chi = functor<chi_t> |
| callable indicatrix of the interval \([lo, hi[\) or of the set for which the invocable returns true. | |
| constexpr auto | eve::clamp = functor<clamp_t> |
| elementwise_callable clamping the value between two bounds. | |
| constexpr auto | eve::copysign = functor<copysign_t> |
| elementwise_callable object computing the composition of a value with the magnitude of the first parameter and the bit of sign of the second one. | |
| constexpr auto | eve::cosine_similarity = functor<cosine_similarity_t> |
| elementwise_callable object computing the elementwise cosine_similarity of the vector of the first half parameters by the vector of the last half. | |
| constexpr auto | eve::covariance = functor<covariance_t> |
| elementwise_callable object computing the elementwise covariance product of the vector of the first half parameters by the vector of the last half. | |
| constexpr auto | eve::cumfun = functor<cumfun_t> |
| callable converting a pack of values into a tuple of the cumulative application of a two parameter eve function defining an abelian monoid. | |
| constexpr auto | eve::cumprod = functor<cumprod_t> |
| callable converting a pack of values into a tuple of the cumulative product of its values. | |
| constexpr auto | eve::cumsum = functor<cumsum_t> |
| callable converting a pack of values into a tuple of the cumulative sum of its values. | |
| constexpr auto | eve::cumtrapz = functor<cumtrapz_t> |
| callable converting a pack of values into a tuple of the cumulative trapezoidal of its values. | |
| constexpr auto | eve::dec = functor<dec_t> |
| elementwise_callable object returning the input decremented by 1. | |
| constexpr auto | eve::diff = functor<diff_t> |
| tuple_callable computing the nth adjacent differences of its arguments. | |
| constexpr auto | eve::dist = functor<dist_t> |
| elementwise_callable object computing the distance of its arguments. | |
| constexpr auto | eve::div = functor<div_t> |
| elementwise_callable object computing the division of multiple values. | |
| constexpr auto | eve::dot = functor<dot_t> |
| elementwise_callable object computing the elementwise dot product of the vector of the first half parameter by thevector of the last half. | |
| constexpr auto | eve::fdim = functor<fdim_t> |
| elementwise_callable computing the positive difference between the two parameters. | |
| constexpr auto | eve::floor = functor<floor_t> |
| elementwise_callable object computing the largest integer not greater than the input. | |
| constexpr auto | eve::fmod = functor<fmod_t> |
| elementwise_callable object mimicking the std::fmod function for floating values. | |
| constexpr auto | eve::frac = functor<frac_t> |
| elementwise_callable computing the fractional part of the input. | |
| constexpr auto | eve::fracscale = functor<fracscale_t> |
| strict_elementwise_callable object computing the reduced part of the scaled input. | |
| constexpr auto | eve::heaviside = functor<heaviside_t> |
| elementwise_callable that return 1 if the input is greater than a threshold else 0. | |
| constexpr auto | eve::inc = functor<inc_t> |
| elementwise_callable object returning the input incremented by 1. | |
| constexpr auto | eve::lerp = functor<lerp_t> |
| Computes the linear interpolation. | |
| constexpr auto | eve::manhattan = functor<manhattan_t> |
| tuple_callable object computing the manhattan norm ( \(l_1\)) of its arguments. | |
| constexpr auto | eve::max = functor<max_t> |
| Computes the maximum of its arguments. | |
| constexpr auto | eve::maxabs = functor<maxabs_t> |
| Computes the maximum of the absolute value norm ( \(l_\infty\)) of its arguments. | |
| constexpr auto | eve::maxmag = functor<maxmag_t> |
| Computes the value for which the maximum of the absolute value of its arguments is obtained. | |
| constexpr auto | eve::min = functor<min_t> |
| Computes the minimum of its arguments. | |
| constexpr auto | eve::minabs = functor<minabs_t> |
| Computes the minimum of the absolute value of its arguments. | |
| constexpr auto | eve::minmag = functor<minmag_t> |
| Computes the value for which the minimum of the absolute value of its arguments is obtained. | |
| constexpr auto | eve::minmax = functor<minmax_t> |
| Computes the minimum and maximum of its arguments. | |
| constexpr auto | eve::minus = functor<minus_t> |
| Computes the opposite of the parameter that must be signed. | |
| constexpr auto | eve::modf = functor<modf_t> |
| elementwise_callable object computing the elementwise pair of fractional and integral parts of the value, | |
| constexpr auto | eve::mul = functor<mul_t> |
| tuple_callable computing the product of its arguments. | |
| constexpr auto | eve::nearest = functor<nearest_t> |
| strict_elementwise_callable object computing the nearest integer to the input. | |
| constexpr auto | eve::negabsmax = functor<negabsmax_t> |
| tuple_callable computing the negated absolute value of the maximal element. | |
| constexpr auto | eve::negabsmin = functor<negabsmin_t> |
| tuple_callable computing the negated absolute value of the minimal element. | |
| constexpr auto | eve::negate = functor<negate_t> |
| elementwise_callable object computing the product of the first parameter by the sign of the second. | |
| constexpr auto | eve::negatenz = functor<negatenz_t> |
| elementwise_callable object computing the product of the first parameter by the never zero sign of the second. | |
| constexpr auto | eve::negmaxabs = functor<negmaxabs_t> |
| tuple_callable object computing the negated value of the element of maximal absolute value. | |
| constexpr auto | eve::negminabs = functor<negminabs_t> |
| tuple_callable computing the negated value of the element of minimal absolute value. | |
| constexpr auto | eve::oneminus = functor<oneminus_t> |
| elementwise_callable computing the value of one minus the input. | |
| constexpr auto | eve::rat = functor<rat_t> |
| elementwise_callable object computing a rational approximation. | |
| constexpr auto | eve::rec = functor<rec_t> |
| Computes the inverse of the parameter. | |
| constexpr auto | eve::reldist = functor<reldist_t> |
| elementwise_callable object computing the relative distance of its arguments. | |
| constexpr auto | eve::rem = functor<rem_t> |
| elementwise_callable object computing the remainder after division. | |
| constexpr auto | eve::remainder = functor<remainder_t> |
| mimic the std::remainder function for floating values. | |
| constexpr auto | eve::round = functor<round_t> |
| Computes the integer nearest to the input. | |
| constexpr auto | eve::roundscale = functor<roundscale_t> |
| strict_elementwise_callable object computing the scaled input rounding. | |
| constexpr auto | eve::rsqrt = functor<rsqrt_t> |
| Computes the inverse of the square root of the parameter. | |
| constexpr auto | eve::saturate = functor<saturate_t> |
| strict_elementwise_callable computing the saturation of a value in a type. | |
| constexpr auto | eve::sign = functor<sign_t> |
| elementwise_callable object computing the sign of the parameter. | |
| constexpr auto | eve::sign_alternate = functor<sign_alternate_t> |
| Computes \((-1)^n\). | |
| constexpr auto | eve::signnz = functor<signnz_t> |
| elementwise_callable object computing the never zero sign of the parameter. | |
| constexpr auto | eve::sqr = functor<sqr_t> |
| Computes the square of the parameter. | |
| constexpr auto | eve::sqrt = functor<sqrt_t> |
| Computes the elementwise square root of the parameter. | |
| constexpr auto | eve::sub = functor<sub_t> |
| tuple_callable computing the difference of its first argument with the sum of the others. | |
| constexpr auto | eve::sum_of_squares = functor<sum_of_squares_t> |
| tuple_callable object computing the sum of the squared values of its arguments. | |
| constexpr auto | eve::trapz = functor<trapz_t> |
| tuple_callable object applying the trapezoidal composite rule to its arguments. | |
| constexpr auto | eve::trunc = functor<trunc_t> |
| elementwise_callable object computing the integral part of x with the same sign as x. | |
| constexpr auto | eve::unfold = functor<unfold_t> |
| tuple_callable utility to convert a pack of values into a tuple of scalar values. | |
| constexpr auto | eve::variance = functor<variance_t> |
| tuple_callable computing the variance of its arguments. | |
| constexpr auto | eve::welford_average = functor<welford_average_t> |
| tuple_callable computing the arithmetic mean of its arguments with the Welford algorithm, along with the number of elements involved. | |
| constexpr auto | eve::welford_covariance = functor<welford_covariance_t> |
| elementwise_callable object computing the elementwise welford_covariance product of the vector of the first half parameter by thevector of the last half. | |
| constexpr auto | eve::welford_variance = functor<welford_variance_t> |
| tuple_callable computing the variance of its arguments with the Welford algorithm, along with their average, second centered moment and count. | |
| constexpr auto | eve::neville = functor<neville_t> |
| callable computing the value of the interpolation polynomial \(p\) of degree n, satisfying: \(p(x_i) = y_i\) for \(i = 0..n\) | |
|
inlineconstexpr |
elementwise_callable object computing the absolute value of the parameter.
Parameters
Return value
|
inlineconstexpr |
tuple_callable computing the absolute value of the maximal element.
Parameters
Return value
The absolute value of the maximal element is returned.
|
inlineconstexpr |
tuple_callable computing the absolute value of the minimal element.
Parameters
Return value
The absolute value of the minimal element is returned.
|
inlineconstexpr |
tuple_callable computing the sum of its arguments.
Parameters
Return value
The value of the sum of the arguments is returned.
{kahan summation](https://en.wikipedia.org/wiki/Kahan_summation_algorithm)
|
inlineconstexpr |
elementwise_callable object computing the arithmetic-geometric mean.
Parameters
Return value
|
inlineconstexpr |
tuple_callable computing the arithmetic mean of its arguments.
Parameters
Return value
The value of the arithmetic mean of the arguments is returned.
For two integral parameters half the sum of x and y. No overflow occurs. If the sum is odd, the result is a rounded value at a distance guaranteed to be less than or equal to 0.5 of the average floating value, but may differ by unity from the truncation given by (x+y)/2. Moreover, as some architectures provide simd intrinsics to perform the operation, the scalar results may differ by one unit from simd ones which are system dependent.
However the lower (respectively upward) options can be used to ensure the result is equivalent to the integral conversion of floor((x+y)/2), (respectively ceil((x+y)/2)).
|
inlineconstexpr |
strict_elementwise_callable object computing the smallest integer not less than the input.
Defined in Header
Parameters
Return value
|
inlineconstexpr |
callable indicatrix of the interval \([lo, hi[\) or of the set for which the invocable returns true.
Defined in Header
Parameters
Return value
|
inlineconstexpr |
elementwise_callable clamping the value between two bounds.
Defined in Header
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the composition of a value with the magnitude of the first parameter and the bit of sign of the second one.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the elementwise cosine_similarity of the vector of the first half parameters by the vector of the last half.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the elementwise covariance product of the vector of the first half parameters by the vector of the last half.
Parameters
Return value
|
inlineconstexpr |
callable converting a pack of values into a tuple of the cumulative application of a two parameter eve function defining an abelian monoid.
Parameters
Return value
|
inlineconstexpr |
callable converting a pack of values into a tuple of the cumulative product of its values.
Parameters
Return value
|
inlineconstexpr |
callable converting a pack of values into a tuple of the cumulative sum of its values.
Parameters
Return value
|
inlineconstexpr |
callable converting a pack of values into a tuple of the cumulative trapezoidal of its values.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object returning the input decremented by 1.
Parameters
Return value
|
inlineconstexpr |
tuple_callable computing the nth adjacent differences of its arguments.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the distance of its arguments.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the division of multiple values.
Parameters
Return value
div[left](a, b) is semantically equivalent to div(b, a)
The relevant cases are just in fact the division by 0 for integral types in which case the result is eve::valmin(as(x)) or [valmax(as(x))](ref eve::valmax) according to the dividend sign, and the division of valmin(as(x)) by -1 that produces valmax(as(x)).
|
inlineconstexpr |
elementwise_callable object computing the elementwise dot product of the vector of the first half parameter by thevector of the last half.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable computing the positive difference between the two parameters.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the largest integer not greater than the input.
Parameters
Return value
1. The largest integer not greater than `x`.
The standard proposes 4 rounding modes namely: `FE_TONEAREST`, `FE_DOWNWARD`, `FE_UPWARD`,
`FE_TOWARDZERO`. This function object implements the `FE_DOWNWARD` version.
2. [The operation is performed conditionally](@ref conditional).
3. `almost` allows a fuzzy interpretation of ceil associated to a scalar tolerance.
- with an integral value `tol`: computes the floor of the next nth
representable value in the `x` type.
- with a floating value `tol`: computes the floor with a tolerance `tol`
using Hagerty's FL5 function.
4. with no tolerance value, the call is equivalent to `ceil[tolerance = 3*eps(as(x))(x)`
|
inlineconstexpr |
elementwise_callable object mimicking the std::fmod function for floating values.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable computing the fractional part of the input.
Parameters
Return value
|
inlineconstexpr |
strict_elementwise_callable object computing the reduced part of the scaled input.
The call is equivalent to a0-roundscale(a0,scale)
Parameters
Return value
|
inlineconstexpr |
elementwise_callable that return 1 if the input is greater than a threshold else 0.
Defined in Header
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object returning the input incremented by 1.
Parameters
Return value
|
inlineconstexpr |
Computes the linear interpolation.
Parameters
Return value
|
inlineconstexpr |
tuple_callable object computing the manhattan norm ( \(l_1\)) of its arguments.
Parameters
Return value
|
inlineconstexpr |
Computes the maximum of its arguments.
Parameters
Return value
|
inlineconstexpr |
Computes the maximum of the absolute value norm ( \(l_\infty\)) of its arguments.
Parameters
Return value
|
inlineconstexpr |
Computes the value for which the maximum of the absolute value of its arguments is obtained.
Parameters
Return value
|
inlineconstexpr |
Computes the minimum of its arguments.
Parameters
Return value
|
inlineconstexpr |
Computes the minimum of the absolute value of its arguments.
Parameters
Return value
|
inlineconstexpr |
Computes the value for which the minimum of the absolute value of its arguments is obtained.
Parameters
Return value
|
inlineconstexpr |
Computes the minimum and maximum of its arguments.
Parameters
Return value
Masked Call
The call eve::minmax[mask](x, ...) provides a masked version of minmax which is equivalent to if_else(mask, minmax(x, ...), zip(x, x))
Example
|
inlineconstexpr |
Computes the opposite of the parameter that must be signed.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the elementwise pair of fractional and integral parts of the value,
Parameters
Return value
|
inlineconstexpr |
tuple_callable computing the product of its arguments.
Parameters
Return value
The value of the product of the arguments is returned.
|
inlineconstexpr |
strict_elementwise_callable object computing the nearest integer to the input.
Return value
|
inlineconstexpr |
tuple_callable computing the negated absolute value of the maximal element.
Parameters
Return value
The negated absolute value of the maximal element is returned.
|
inlineconstexpr |
tuple_callable computing the negated absolute value of the minimal element.
Parameters
Return value
The negated absolute value of the minimal element is returned.
|
inlineconstexpr |
elementwise_callable object computing the product of the first parameter by the sign of the second.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the product of the first parameter by the never zero sign of the second.
Parameters
Return value
|
inlineconstexpr |
tuple_callable object computing the negated value of the element of maximal absolute value.
Parameters
Return value
The negated value of the element of maximal absolute value is returned.
|
inlineconstexpr |
tuple_callable computing the negated value of the element of minimal absolute value.
Parameters
Return value
The negated value of the element of minimal absolute value is returned.
|
inlineconstexpr |
callable computing the value of the interpolation polynomial \(p\) of degree n, satisfying: \(p(x_i) = y_i\) for \(i = 0..n\)
Parameters
Return value
|
inlineconstexpr |
elementwise_callable computing the value of one minus the input.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing a rational approximation.
Parameters
Return value
A tuple-like whose members have the same type as x, containing the numerator and denominator of the rational number approximating x.
|
inlineconstexpr |
Computes the inverse of the parameter.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the relative distance of its arguments.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the remainder after division.
Parameters
Return value
|
inlineconstexpr |
mimic the std::remainder function for floating values.
Parameters
Return value
|
inlineconstexpr |
Computes the integer nearest to the input.
Parameters
Return value
|
inlineconstexpr |
strict_elementwise_callable object computing the scaled input rounding.
Parameters
Return value
|
inlineconstexpr |
Computes the inverse of the square root of the parameter.
Parameters
Return value
|
inlineconstexpr |
strict_elementwise_callable computing the saturation of a value in a type.
Defined in Header
Parameters
Return value
For an x type U, the call saturate(x, as_<Target>{}) returns elementwise a value of element type U which is x clamped between the smallest and largest values of the Target
|
inlineconstexpr |
elementwise_callable object computing the sign of the parameter.
Parameters
Return value
|
inlineconstexpr |
Computes \((-1)^n\).
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the never zero sign of the parameter.
Parameters
Return value
|
inlineconstexpr |
Computes the square of the parameter.
Parameters
Return value
|
inlineconstexpr |
Computes the elementwise square root of the parameter.
Parameters
Return value
|
inlineconstexpr |
tuple_callable computing the difference of its first argument with the sum of the others.
Parameters
Return value
The value of the difference of its first argument with the sum of the others
|
inlineconstexpr |
tuple_callable object computing the sum of the squared values of its arguments.
Parameters
Return value
|
inlineconstexpr |
tuple_callable object applying the trapezoidal composite rule to its arguments.
Parameters
Return value
|
inlineconstexpr |
elementwise_callable object computing the integral part of x with the same sign as x.
Parameters
Return value
|
inlineconstexpr |
tuple_callable utility to convert a pack of values into a tuple of scalar values.
Parameters
Return value
|
inlineconstexpr |
tuple_callable computing the variance of its arguments.
Parameters
Return value
The value of the variance of the arguments is returned.
|
inlineconstexpr |
tuple_callable computing the arithmetic mean of its arguments with the Welford algorithm, along with the number of elements involved.
Parameters
Return value
A struct containing The value of the arithmetic mean and the number of elements on which the mean was calculated is returned.
This struct is convertible to the average floating value. and possess two fields average and count.
|
inlineconstexpr |
elementwise_callable object computing the elementwise welford_covariance product of the vector of the first half parameter by thevector of the last half.
Parameters
|
inlineconstexpr |
tuple_callable computing the variance of its arguments with the Welford algorithm, along with their average, second centered moment and count.
Parameters
Return value