E.V.E  0.1-beta

◆ rec

eve::rec = {}
inlineconstexpr

Callable object computing the rec operation.

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

Members Functions

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

template< value T > auto operator()( T x ) const noexcept;

Parameters

x: value.

Return value

Computes elementwise the inverse of x.

For real integral value x is semantically equivalent to:


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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

  • eve::raw The call raw(rec)(x), call a proper system intrinsic if one exists, but with possibly very poor accuracy in return. Otherwise it uses the non decorated call.
  • eve::diff, eve::diff_1st, eve::diff_nth

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

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

Example

See it live on Compiler Explorer

#include <eve/function/diff/rec.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, 2.0f, 10.0f, 200.0f, 1000.0f,
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> eve::diff(eve::rec)(pf) = " << eve::diff(eve::rec)(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> eve::diff(eve::rec)(xf) = " << eve::diff(eve::rec)(xf) << '\n';
return 0;
}
constexpr callable_rec_ rec
Callable object computing the rec operation.
Definition: rec.hpp:85
constexpr callable_nan_ nan
Callable object computing the nan value.
Definition: nan.hpp:52
constexpr callable_inf_ inf
Callable object computing the infinity ieee value.
Definition: inf.hpp:54
constexpr diff_type< 1 > const diff
Higher-order Callable Object imbuing derivative semantics onto other Callable Objects.
Definition: derivative.hpp:59
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65