E.V.E  0.1-beta

◆ stirling

eve::stirling = {}
inlineconstexpr

Callable object computing an approximation of the \(\Gamma\) function by \(\displaystyle \Gamma(x) \approx \sqrt{2 \pi} x^{x-\frac12} e^{-x} \left( 1 + \frac1{x} P(\frac1{x})\right)\), where \(P\) is a polynomial.

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

Members Functions

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

template< value T, floating_value U > auto operator()( Tx ) const noexcept;

Parameters

x: floating real value.

Return value

Returns elementwise \(\sqrt{2 \pi} x^{x-\frac12} e^{-x} \left( 1 + \frac1{x} P(\frac1{x})\right)\)


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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/stirling.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, -0.0f, -1.0f, 10.0f, 20.0f,
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> stirling(pf) = " << eve::stirling(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> stirling(xf) = " << eve::stirling(xf) << '\n';
return 0;
}
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 callable_stirling_ stirling
Callable object computing an approximation of the function by , where is a polynomial.
Definition: stirling.hpp:73
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65