E.V.E  0.1-beta

◆ dec

eve::dec = {}
inlineconstexpr

Callable object computing the dec unary operation.

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

Members Functions

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

auto operator()( value auto x ) const noexcept;
Definition: value.hpp:31

Parameters

x: value.

Return value

Computes elementwise a value with the same type as x. The result is x-1.


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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

  • saturated

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

    The call saturated(dec)(x) computes the saturated opposite of x. The only interest of this behaviour is that for integral type T saturated(dec)(Valmin< T >()) returns Valmin< T >().

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

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

    The expression diff(dec)(x) computes the derivative of the function at x.

Example

See it live on Compiler Explorer

#include <eve/function/dec.hpp>
#include <eve/wide.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <eve/constant/mindenormal.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.0f, -2.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> eve::dec(pf) = " << eve::dec(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> eve::dec(xf) = " << eve::dec(xf) << '\n';
return 0;
}
constexpr callable_dec_ dec
Callable object computing the dec unary operation.
Definition: dec.hpp:84
Wrapper for SIMD registers.
Definition: wide.hpp:65