E.V.E  0.1-beta

◆ absmin

eve::absmin = {}
inlineconstexpr

Callable object computing the absmin operation.

Required header: #include <eve/function/absmin.hpp>

Members Functions

Member Effect
operator() the absmin operation
operator[] Construct a conditional version of current function object

template< value T, value ...Ts> auto operator()( T x,Ts... args ) const noexcept
requires (compatible_values< T, Ts > && ...);
Definition: value.hpp:31

Parameters

x, args: values

Return value

the elementwise absolute value of the minimum is returned.

The call absmin(x, args...) is equivalent to abs(min(x, args...))

The result type is the common compatible type of the parameters.

Warning
If any element of the inputs is a Nan, the corresponding output element is system-dependent.

auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::absmin

Parameters

cond : conditional expression

Return value

A Callable object so that the expression absmin[cond](x, ...) is equivalent to if_else(cond,absmin(x, ...),x)


Supported decorators

  • eve::pedantic

    Required header: #include <eve/function/pedantic/absmin.hpp>

    The call pedantic(absmin)(x, args...) is equivalent to abs(pedantic(min)(x, args...))

  • eve::numeric

    Required header: #include <eve/function/numeric/absmin.hpp>

    The call numeric(absmin)(x, args...) is equivalent toabs(numeric(min)(x, args...))`

  • eve::diff, eve::diff_1st, eve::diff_nth

    Required header: #include <eve/function/diff/absmin.hpp>

    The expression diff< N >(absmin)(x,args,...) computes the partial derivative relative to the Nth parameter. If the parameters are \(x_1, ..., x_n\) and their absmin is \(m\), the value returned is elementwise \(\mathrm{sign}(x_N)\) if \(m\) is equal to \(|x_N|\) else 0.

Example

See it live on Compiler Explorer

#include <eve/function/absmin.hpp>
#include <eve/function/pedantic/absmin.hpp>
#include <eve/function/numeric/absmin.hpp>
#include <eve/wide.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, 1.0f, -2.0f, 2.0f,
wide_ft qf = {4.0f, 1.0f, -1.0f, 0.0f, -3.0f,
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> absmin(pf, qf) = " << eve::absmin(pf, qf) << '\n'
<< "-> pedantic(absmin)(pf, qf) = " << eve::pedantic(eve::absmin)(pf, qf) << '\n'
<< "-> numeric(absmin)(pf, qf) = " << eve::numeric(eve::absmin)(pf, qf) << '\n';
float xf = -4.0f;
float yf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> absmin(xf, yf) = " << eve::absmin(xf, yf) << '\n'
<< "-> pedantic(absmin)(xf, yf) = " << eve::pedantic(eve::absmin)(xf, yf) << '\n'
<< "-> numeric(absmin)(xf, yf) = " << eve::numeric(eve::absmin)(xf, yf) << '\n';
return 0;
}
constexpr callable_absmin_ absmin
Callable object computing the absmin operation.
Definition: absmin.hpp:98
constexpr callable_nan_ nan
Callable object computing the nan value.
Definition: nan.hpp:52
constexpr callable_minf_ minf
Callable object computing the negative infinity value.
Definition: minf.hpp:55
constexpr callable_inf_ inf
Callable object computing the infinity ieee value.
Definition: inf.hpp:54
constexpr pedantic_type const pedantic
Higher-order Callable Object imbuing more standard semantic onto other Callable Objects.
Definition: pedantic.hpp:56
constexpr numeric_type const numeric
Higher-order Callable Object imbuing non invalid return preference semantic onto other Callable Objec...
Definition: numeric.hpp:52
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65