E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches
Arithmetic operations

Detailed Description

Core arithmetic functions

These functions allows performing some basic arithmetics operations with greater accuracy even when and upgraded type is not available.

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 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::dec = functor<dec_t>
 elementwise_callable object returning the input decremented by 1.
 
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 elementwise the dot product of the two parameters.
 
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::flush_denormal = functor<flush_denormal_t>
 elementwise_callable object computing flushing denormal values to 0.
 
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_callablecomputing the product of its arguments. ! ! @groupheader{Header file} ! ! @code //! #include <eve/module/core.hpp> //! @endcode ! ! @groupheader{Callable Signatures} ! ! @code //! namespace eve //! { //! // Regular overloads //! constexpr auto mul(value auto x, value auto ... xs) noexcept; // 1 //! constexpr auto mul(kumi::non_empty_product_type auto const& tup) noexcept; // 2 //! //! // Lanes masking //! constexpr auto mul[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 3 //! constexpr auto mul[logical_value auto m](/*any of the above overloads*/) noexcept; // 3 //! //! // Semantic options //! constexpr auto mul[saturated](/*any of the above overloads*/) noexcept; // 4 //! constexpr auto mul[lower](/*any of the above overloads*/) noexcept; // 5 //! constexpr auto mul[upper](/*any of the above overloads*/) noexcept; // 6 //! constexpr auto mul[lower][strict](/*any of the above overloads*/) noexcept; // 5 //! constexpr auto mul[upper][strict](/*any of the above overloads*/) noexcept; // 6 //! constexpr auto sub[widen](/*any of the above overloads*/) noexcept; // 7 //! } //! @endcode ! ! **Parameters** ! ! *... xs: [real](@ref eve::value) arguments. ! *tup: [non empty tuple](@ref kumi::non_empty_product_type) of arguments. ! *c: [Conditional expression](@ref eve::conditional_expr) masking the operation. ! *m: [Logical value](@ref eve::logical_value) masking the operation. ! ! **Return value** ! ! The value of the product of the arguments is returned. ! 1. Take care that for floating entries, the multiplication is not perfectly associative due to rounding errors. ! This call performs multiplications in reverse incoming order. ! 2. equivalent to the call on the elements of the tuple. ! 3. [The operation is performed conditionnaly](@ref conditional) ! 4. The callmulsaturatedcomputes a saturated version ofmul. ! Take care that for signed integral entries this kind of multiplication is not associative at all. ! This call perform saturated multiplications in reverse incoming order. ! 5. The product is computed in a 'round toward \f$-\infty\f$ mode. The result is guaranted ! to be less or equal to the exact one (except for Nans). Combined withstrictthe option ! ensures generally faster computation, but strict inequality. ! 6. The product is computed in a 'round toward \f$\infty\f$ mode. The result is guaranted ! to be greater or equal to the exact one (except for Nans). Combined withstrictthe option ! ensures generally faster computation, but strict inequality. ! 7. The operation is computed in the double sized element type (if available). ! This decorator has no effect on double and 64 bits integrals. ! ! @note ! Although the infix notation with*is supported for two parameters, the*` operator on standard scalar types is the original one and so can lead to automatic promotion.
 
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 absolute value of the maximal element.
 
constexpr auto eve::negabsmin = functor<negabsmin_t>
 tuple_callable computing the 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::of_class = functor<of_class_t>
 strict_elementwise_callable object computing classification of elements of the input.
 
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>
 mimick 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 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::trunc = functor<trunc_t>
 elementwise_callable object computing the integral part of x with the same sign as x.
 
constexpr auto eve::atan2 = functor<atan2_t>
 elementwise_callable object computing the arc tangent using the signs of the arguments to determine the correct quadrant.
 
constexpr auto eve::atan2d = functor<atan2d_t>
 elementwise_callable object computing the arc tangent in degrees using the signs of the arguments to determine the correct quadrant.
 
constexpr auto eve::atan2pi = functor<atan2pi_t>
 elementwise_callable object computing the arc tangent in degrees using the signs of the arguments to determine the correct quadrant.