E.V.E  0.1-beta

◆ powm1

eve::powm1 = {}
inlineconstexpr

Callable object computing powm1: \(x^y-1\).

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

Members Functions

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

template< floating_real_value T, floating_real_value T> auto operator()( T x, U y ) const noexcept;

Parameters

x, y: floating real value.

Return value

Returns the elementwise power minus one, with good accuracy, even when y is very small, or when x is close to 1.


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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

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

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

    The expression diff_1st(powm1)(x,y) and diff_2nd(powm1)(x,y) computes the partial derivatives of \(f\), where \(f\) is the function \((x,y) \rightarrow \ x^y-1\).

Example

See it live on Compiler Explorer

#include <eve/function/powm1.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.1f, 1.10f, -2.3f, 2.0f,
wide_ft qf = {4.0f, 1.0f, -1.0f, 0.0f, -0.5f,
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> powm1(pf, qf) = " << eve::powm1(pf, qf) << '\n';
float xf = 4.0f;
float yf = -1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> powm1(xf, yf) = " << eve::powm1(xf, yf) << '\n';
return 0;
}
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 callable_powm1_ powm1
Callable object computing powm1: .
Definition: powm1.hpp:78
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65