E.V.E
v2023.02.15
Loading...
Searching...
No Matches
Special functions

Detailed Description

Special functions.

This module provides implementation for various special functions

Most of them provide besides the regular call raw and fast options clls that are speedier but with possible limitations on corner cases response, valid range and accuracy, raw always being the most dirty.

These version are to be used with caution.

Required header:

#include <eve/module/special.hpp>

Variables

constexpr auto eve::beta = functor<beta_t>
 elementwise_callable object computing the beta function: \(\displaystyle \mathbf{B}(x, y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}\).
constexpr auto eve::betainc = functor<betainc_t>
 Computes the betainc incomplete function. \(\displaystyle \mbox{I}_s(x,y) = \frac{1}{\mbox{B}(x,y)}\int_0^s t^{x-1}(1-t)^{y-1}\mbox{d}t\).
constexpr auto eve::betainc_inv = functor<betainc_inv_t>
 elementwise_callable object computing the inverse relative to the first parameter of the beta incomplete function.
constexpr auto eve::cos_int = functor<cos_int_t>
 elementwise_callable object computing the cosine integral \( \mathbf{Ci}(x) = \displaystyle -\int_x^\infty \frac{\cos t}{t}\;\mbox{d}t\).
constexpr auto eve::dawson = functor<dawson_t>
 elementwise_callable object computing the Dawson function: \(\displaystyle D_+(x)=e^{-x^2}\int_0^{x} e^{t^2} \mbox{d}t\)
constexpr auto eve::digamma = functor<digamma_t>
 elementwise_callable object computing the Digamma function i.e. the logarithmic derivative of the \(\Gamma\) function.
constexpr auto eve::double_factorial = functor<double_factorial_t>
 elementwise_callable object computing the double factorial of n
constexpr auto eve::erf = functor<erf_t>
 elementwise_callable object computing the error function: \( \displaystyle \mbox{erf}(x)=\frac{2}{\sqrt\pi}\int_0^{x} e^{-t^2}\mbox{d}t\).
constexpr auto eve::erf_inv = functor<erf_inv_t>
 elementwise_callable object computing the inverse of the error function.
constexpr auto eve::erfc = functor<erfc_t>
 elementwise_callable object computing the complementary error function \( \displaystyle \mbox{erf}(x)=1-\frac{2}{\sqrt\pi}\int_0^{x} e^{-t^2}\mbox{d}t\)
constexpr auto eve::erfc_inv = functor<erfc_inv_t>
 Computes the inverse of the complementary error function.
constexpr auto eve::erfcx = functor<erfcx_t>
 Computes the normalized complementary error function \( \displaystyle \mbox{erfcx}(x) = e^{x^2} \mbox{erfc}(x)\).
constexpr auto eve::exp_int = functor<exp_int_t>
 elementwise_callable object computing the exponential integral \( \mathbf{E}_n(x) = \displaystyle \int_1^\infty \frac{e^{-xt}}{t^n}\;\mbox{d}t\).
constexpr auto eve::factorial = functor<factorial_t>
 elementwise_callable computing \(\displaystyle n! = \prod_{i=1}^n i\).
constexpr auto eve::gamma_p = functor<gamma_p_t>
 elementwise_callable object computing the normalized lower incomplete \(\Gamma\) function.
constexpr auto eve::gamma_p_inv = functor<gamma_p_inv_t>
 elementwise_callable object computing the inverse of the normalized lower incomplete \(\Gamma\) function.
constexpr auto eve::hurwitz = functor<hurwitz_t>
 elementwise_callable object computing the Hurwitz function i.e. \(\sum_{k=0}^\infty (k+z)^{-s}\), where any term with \(k+z = 0\) is excluded.
constexpr auto eve::lambert = functor<lambert_t>
 Computes the inverse of the function \( x \rightarrow xe^x \).
constexpr auto eve::lbeta = functor<lbeta_t>
 elementwise_callable object computing the natural logarithm of the beta function.
constexpr auto eve::lfactorial = functor<lfactorial_t>
 elementwise_callable object computing the natural logarithm of the factorial of unsigned integer values \(\displaystyle \log n! = \sum_{i=1}^n \log i\).
constexpr auto eve::log_abs_gamma = functor<log_abs_gamma_t>
 elementwise_callable object computing the natural logarithm of the absolute value of the \(\Gamma\) function.
constexpr auto eve::log_gamma = functor<log_gamma_t>
 elementwise_callable object computing the natural logarithm of the \(\Gamma\) function.
constexpr auto eve::lrising_factorial = functor<lrising_factorial_t>
 elementwise_callable object computing the natural logarithm of the rising Factorial function i.e. \(\log\left(\frac{\Gamma(x+a)}{\Gamma(x)}\right)\).
constexpr auto eve::omega = functor<omega_t>
 Computes the Wright \(\omega\) the inverse function of \( x \rightarrow \log x+x\).
constexpr auto eve::ω = functor<omega_t>
 Unicode alias for eve::omega, computing the Wright \(\omega\) function.
constexpr auto eve::polygamma = functor<polygamma_t>
 elementwise_callable object computing the Polygamma function i.e. the nth derivative of the digamma function
constexpr auto eve::rising_factorial = functor<rising_factorial_t>
 elementwise_callable object computing the rising Factorial function i.e. \(\frac{\Gamma(x+a)}{\Gamma(x)}\).
constexpr auto eve::signgam = functor<signgam_t>
 elementwise_callable object computing the sign of the \(\Gamma\) function.
constexpr auto eve::sin_int = functor<sin_int_t>
 elementwise_callable object computing the sine integral \( \mathbf{Si}(x) = \displaystyle \int_0^x \frac{\sin t}{t}\;\mbox{d}t\).
constexpr auto eve::stirling = functor<stirling_t>
 elementwise_callable object computing the Stirling approximation of the \(\Gamma\) function.
constexpr auto eve::tgamma = functor<tgamma_t>
 elementwise_callable object computing \(\displaystyle \Gamma(x)=\int_0^\infty t^{x-1}e^{-t}\mbox{d}t\).
constexpr auto eve::trigamma = functor<trigamma_t>
 elementwise_callable object computing the Trigamma function i.e. the second derivative of the \(\log\Gamma\) function.
constexpr auto eve::zeta = functor<zeta_t>
 Computes the Riemann \(\zeta\) function.

Variable Documentation

◆ beta

auto eve::beta = functor<beta_t>
inlineconstexpr

elementwise_callable object computing the beta function: \(\displaystyle \mathbf{B}(x, y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto beta(floating_value auto x, floating_value auto y) noexcept; // 1
// Lanes masking
constexpr auto beta[raw](floating_value auto x) noexcept; // 2
constexpr auto beta[fast](floating_value auto x) noexcept; // 2
constexpr auto beta[conditional_expr auto c](floating_value auto x, floating_value auto y) noexcept; // 3
constexpr auto beta[logical_value auto m](floating_value auto x, floating_value auto y) noexcept; // 3
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:134
constexpr auto raw
Performs the operation minimally, trading accuracy for speed.
Definition core.hpp:95
constexpr auto fast
Performs the operation faster than the regular call while keeping more accuracy than raw.
Definition core.hpp:79
constexpr auto beta
elementwise_callable object computing the beta function: .
Definition beta.hpp:79
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  1. \(\displaystyle \mathbf{B}(x,y) = \int_0^1 t^{x-1}(1-t)^{y-1}\mbox{d}t\)
  2. faster computations at accuracy price.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide pf = { 0.0f, 1.0f, 4.0f, 2.0f };
eve::wide qf = { 1.0f, 1.0f, 3.0f, 5.0f};
std::cout << "<- pf = " << qf << "\n";
std::cout << "<- qf = " << qf << "\n";
std::cout << "-> beta(pf, qf) = " << eve::beta(pf, qf) << "\n";
std::cout << "-> beta[ignore_last(2)](pf, qf)= " << eve::beta[eve::ignore_last(2)](pf, qf) << "\n";
std::cout << "-> beta[qf != 3.0f](pf, qf) = " << eve::beta[qf != 3.0f](pf, qf) << "\n";
}
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:361
Wrapper for SIMD registers.
Definition wide.hpp:94

◆ betainc

auto eve::betainc = functor<betainc_t>
inlineconstexpr

Computes the betainc incomplete function. \(\displaystyle \mbox{I}_s(x,y) = \frac{1}{\mbox{B}(x,y)}\int_0^s t^{x-1}(1-t)^{y-1}\mbox{d}t\).

Defined in header

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto betainc(floating_value auto s,
floating_value auto x, floating_value auto y) noexcept; // 1
// semantic modifiers
constexpr auto betainc[raw](/*any previous overload*/) noexcept; // 2
constexpr auto betainc[fast](/*any previous overload*/) noexcept; // 2
// Lanes masking
constexpr auto betainc[conditional_expr auto c](/*any previous overload*/) noexcept; // 3
constexpr auto betainc[logical_value auto m](/*any previous overload*/) noexcept; // 3
}
constexpr auto betainc
Computes the betainc incomplete function. .
Definition betainc.hpp:84

Parameters

Return value

  1. The value of the incomplete betainc function is returned.
  2. speedier computations at accuracy price,
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide pf = { 0.0f, 0.1f, 0.5f, 2.0f};
eve::wide qf = { 1.0f, 1.0f, 3.0f, 5.0f};
eve::wide rf = { 4.0f, 2.0f, 1.0f, 0.2f};
std::cout << "<- pf = " << pf << '\n';
std::cout << "<- qf = " << qf << '\n';
std::cout << "<- rf = " << rf << '\n';
std::cout << "-> betainc(pf, qf, rf) = " << eve::betainc(pf, qf, rf) << '\n';
std::cout << "-> betainc[ignore_last(2)](pf, qf, rf) = " << eve::betainc[eve::ignore_last(2)](pf, qf, rf) << '\n';
std::cout << "-> betainc[rf != 0.2f](pf, qf, rf) = " << eve::betainc[rf != 0.2](pf, qf, rf) << '\n';
}

◆ betainc_inv

auto eve::betainc_inv = functor<betainc_inv_t>
inlineconstexpr

elementwise_callable object computing the inverse relative to the first parameter of the beta incomplete function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
// Regular overload
constexpr auto betainc_inv(floating_value auto s,
floating_value auto x, floating_value auto y) noexcept; // 1
// semantic modifiers
constexpr auto betainc_inv[raw](/*any previous overload*/) noexcept; // 2
constexpr auto betainc_inv[fast](/*any previous overload*/) noexcept; // 2
// Lanes masking
constexpr auto betainc_inv[conditional_expr auto c](/*any previous overload*/) noexcept; // 3
constexpr auto betainc_inv[logical_value auto m](/*any previous overload*/) noexcept; // 3
}
constexpr auto betainc_inv
elementwise_callable object computing the inverse relative to the first parameter of the beta incompl...
Definition betainc_inv.hpp:87

Parameters

Return value

  1. The value of the inverse of the incomplete beta function is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide pf = { 0.0f, 0.1f, 0.5f, 2.0f};
eve::wide qf = { 1.0f, 1.0f, 3.0f, 5.0f};
eve::wide rf = { 4.0f, 2.0f, 1.0f, 0.2f};
std::cout << "<- pf = " << pf << '\n';
std::cout << "<- qf = " << qf << '\n';
std::cout << "<- rf = " << rf << '\n';
std::cout << "-> betainc_inv(pf, qf, rf) = " << eve::betainc_inv(pf, qf, rf) << '\n';
std::cout << "-> betainc_inv[ignore_last(2)](pf, qf, rf) = " << eve::betainc_inv[eve::ignore_last(2)](pf, qf, rf) << '\n';
std::cout << "-> betainc_inv[rf != 0.2f](pf, qf, rf) = " << eve::betainc_inv[rf != 0.2](pf, qf, rf) << '\n';
}

◆ cos_int

auto eve::cos_int = functor<cos_int_t>
inlineconstexpr

elementwise_callable object computing the cosine integral \( \mathbf{Ci}(x) = \displaystyle -\int_x^\infty \frac{\cos t}{t}\;\mbox{d}t\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto cos_int(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto cos_int[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 2
constexpr auto cos_int[logical_value auto m](/*any of the above overloads*/) noexcept; // 2
}
constexpr auto cos_int
elementwise_callable object computing the cosine integral .
Definition cos_int.hpp:74

Parameters

Return value

  1. The value of the cosine integral \( \mathbf{Ci}(x) = \displaystyle -\int_x^\infty \frac{\cos t}{t}\;\mbox{d}t\), is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide w = {0.0, -1.0, 1.0, 2.0, 50.0,
std::cout << "<- w = " << w << "\n";
std::cout << "-> cos_int(w) = " << eve::cos_int(w) << "\n";
std::cout << "-> cos_int[ignore_last(2)](w) = " << eve::cos_int[eve::ignore_last(2)](w) << "\n";
std::cout << "-> cos_int[w <= 2.0](w) = " << eve::cos_int[w <= 2.0](w) << "\n";
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition nan.hpp:67
constexpr auto inf
Computes the infinity ieee value.
Definition inf.hpp:67
constexpr auto minf
Computes the -infinity ieee value.
Definition minf.hpp:67
Lightweight type-wrapper.
Definition as.hpp:29

◆ dawson

auto eve::dawson = functor<dawson_t>
inlineconstexpr

elementwise_callable object computing the Dawson function: \(\displaystyle D_+(x)=e^{-x^2}\int_0^{x} e^{t^2} \mbox{d}t\)

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto dawson(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto dawson[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto dawson[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto dawson
elementwise_callable object computing the Dawson function:
Definition dawson.hpp:75

Parameters

Return value

  1. the value of the Dawson function: \(\displaystyle D_+(x)=e^{-x^2}\int_0^{x} e^{t^2} \mbox{d}t\) is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0f, -0.0f, -1.0f, 1.0f, 2.0f,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> dawson(wf) = " << eve::dawson(wf) << "\n";
std::cout << "-> dawson[ignore_last(2)](wf)= " << eve::dawson[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> dawson[wf != -1.0f](wf) = " << eve::dawson[wf != -1.0f](wf) << "\n";
}

◆ digamma

auto eve::digamma = functor<digamma_t>
inlineconstexpr

elementwise_callable object computing the Digamma function i.e. the logarithmic derivative of the \(\Gamma\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto digamma(floating_value auto x) noexcept; // 1
// Semantic modifiers
constexpr auto digamma[raw](floating_value auto x) noexcept; // 2
constexpr auto digamma[fast](floating_value auto x) noexcept; // 2
// Lanes masking
constexpr auto digamma[conditional_expr auto c](floating_value auto x) noexcept; // 3
constexpr auto digamma[logical_value auto m](floating_value auto x) noexcept; // 3
}
constexpr auto digamma
elementwise_callable object computing the Digamma function i.e. the logarithmic derivative of the fu...
Definition digamma.hpp:82

Parameters

Return value

  1. The value of the Digamma function: \(\psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}\) is returned.
  2. speedier computations at accuracy price inspired from pmineiro library but also ok for negative values.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.5, -1.5, 0.1, -1.0, 19.0, 25.0, 21.5, 10000.0};
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> digamma(wf) = " << eve::digamma(wf) << "\n";
std::cout << "-> digamma[ignore_last(2)](wf)= " << eve::digamma[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> digamma[wf > 0.0f](wf) = " << eve::digamma[wf > 0.0](wf) << "\n";
}

◆ double_factorial

auto eve::double_factorial = functor<double_factorial_t>
inlineconstexpr

elementwise_callable object computing the double factorial of n

THe double factorial is defined as \(\displaystyle (2n)!! = \prod_{i=1}^n (2i)\) and \(\displaystyle (2n+1)!! = \prod_{i=0}^n (2i+1)\)

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
template <unsigned_value T> constexpr as_wide_as_t<double,T> double_factorial(T x) noexcept; // 1
// Lanes masking
constexpr auto double_factorial[conditional_expr auto c](unsigned_value auto x) noexcept; // 2
constexpr auto double_factorial[logical_value auto m](unsigned_value auto x) noexcept; // 2
}
The concept unsigned_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:84
constexpr auto double_factorial
elementwise_callable object computing the double factorial of n
Definition double_factorial.hpp:77

Parameters

Return value

  1. The value of the double factorial of n is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wu = {1u, 2u, 3u, 4u, 5u, 6u, 181u, 182u};
std::cout << "<- wu = " << wu << "\n";
std::cout << "-> double_factorial(wu) = " << eve::double_factorial(wu) << "\n";
std::cout << "-> double_factorial[ignore_last(2)](wu)= " << eve::double_factorial[eve::ignore_last(2)](wu) << "\n";
std::cout << "-> double_factorial[wu != 182u](wu) = " << eve::double_factorial[wu != 182u](wu) << "\n";
}

◆ erf

auto eve::erf = functor<erf_t>
inlineconstexpr

elementwise_callable object computing the error function: \( \displaystyle \mbox{erf}(x)=\frac{2}{\sqrt\pi}\int_0^{x} e^{-t^2}\mbox{d}t\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto erf(floating_value auto x) noexcept; // 1
// Lanes masking
// Lanes masking
constexpr auto erf[raw](floating_value auto x) noexcept; // 2
constexpr auto erf[fast](floating_value auto x) noexcept; // 2
constexpr auto erf[conditional_expr auto c](floating_value auto x) noexcept; // 3
constexpr auto erf[logical_value auto m](floating_value auto x) noexcept; // 3
}
constexpr auto erf
elementwise_callable object computing the error function: .
Definition erf.hpp:84

Parameters

Return value

  1. The value of the error function is returned: \( \displaystyle \mbox{erf}(x)=\frac{2}{\sqrt\pi}\int_0^{x} e^{-t^2}\mbox{d}t\). In particular:
    • If the argument is \(\pm0\), \(\pm0\) is returned.
    • If the argument is \(\pm\infty\), \(\pm1\) is returned.
    • If the argument is Nan, nan returned.
  2. faster computations at accuracy price, based on atanh(erf(x)) expansion.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0f, -0.0f, -1.0f, 1.0f, 2.0f,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> erf(wf) = " << eve::erf(wf) << "\n";
std::cout << "-> erf[ignore_last(2)](wf)= " << eve::erf[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> erf[wf <= 2.0f](wf) = " << eve::erf[wf <= 2.0f](wf) << "\n";
}

◆ erf_inv

auto eve::erf_inv = functor<erf_inv_t>
inlineconstexpr

elementwise_callable object computing the inverse of the error function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto erf_inv(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto erf_inv[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto erf_inv[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto erf_inv
elementwise_callable object computing the inverse of the error function.
Definition erf_inv.hpp:74

Parameters

Return value

  1. The value y such that erf(y)==x is returned. For x outside of \([-1,1]\), the result is NaN.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = { 0.0, -0.0, 1.0, -1.0, -0.5, 0.5, 0.75, -0.75};
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> erf_inv(wf) = " << eve::erf_inv(wf) << "\n";
std::cout << "-> erf_inv[ignore_last(2)](wf)= " << eve::erf_inv[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> erf_inv[wf >= 0.0](wf) = " << eve::erf_inv[wf >= 0.0](wf) << "\n";
}

◆ erfc

auto eve::erfc = functor<erfc_t>
inlineconstexpr

elementwise_callable object computing the complementary error function \( \displaystyle \mbox{erf}(x)=1-\frac{2}{\sqrt\pi}\int_0^{x} e^{-t^2}\mbox{d}t\)

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto erfc(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto erfc[raw](floating_value auto x) noexcept; // 2
constexpr auto erfc[fast](floating_value auto x) noexcept; // 2
constexpr auto erfc[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto erfc[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto erfc
elementwise_callable object computing the complementary error function
Definition erfc.hpp:85

Parameters

Return value

  1. The value of the complementary error function: \( \displaystyle \mbox{erf}(x)=1-\frac{2}{\sqrt\pi}\int_0^{x} e^{-t^2}\mbox{d}t\). In particular:
    • If the argument is \(\pm0\), \(1\) is returned.
    • If the argument is \(\infty\), \(1\) is returned.
    • If the argument is \(-\infty\), \(2\) is returned.
    • If the argument is Nan, nan is returned.
  2. faster computations at accuracy price, based on atanh(erf(x)) expansion.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0f, -0.0f, -1.0f, 1.0f, 2.0f,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> erf(wf) = " << eve::erf(wf) << "\n";
std::cout << "-> erf[ignore_last(2)](wf)= " << eve::erf[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> erf[wf <= 2.0f](wf) = " << eve::erf[wf <= 2.0f](wf) << "\n";
}

◆ erfc_inv

auto eve::erfc_inv = functor<erfc_inv_t>
inlineconstexpr

Computes the inverse of the complementary error function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto erfc_inv(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto erfc_inv[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto erfc_inv[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto erfc_inv
Computes the inverse of the complementary error function.
Definition erfc_inv.hpp:78

Parameters

Return value

  1. The value of the inverse complementary error function is returned. In particular:
    • If the argument is \(\pm0\), \(1\) is returned.
    • If the argument is \(2\), \(-\infty\) is returned.
    • If the argument is \(0\), \(\infty\) is returned.
    • If the argument is NaN, NaN is returned.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<float> wf([](auto i, auto c)->float{ return 2*(i-c/2);});
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> erfc_inv(wf) = " << eve::erfc_inv(wf) << "\n";
std::cout << "-> erfc_inv[ignore_last(2)](wf)= " << eve::erfc_inv[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> erfc_inv[wf != -2.0f](wf) = " << eve::erfc_inv[wf != -2.0f](wf) << "\n";
}

◆ erfcx

auto eve::erfcx = functor<erfcx_t>
inlineconstexpr

Computes the normalized complementary error function \( \displaystyle \mbox{erfcx}(x) = e^{x^2} \mbox{erfc}(x)\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto erfcx(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto erfcx[raw](floating_value auto x) noexcept; // 2
constexpr auto erfcx[fast](floating_value auto x) noexcept; // 2
constexpr auto erfcx[conditional_expr auto c](floating_value auto x) noexcept; // 3
constexpr auto erfcx[logical_value auto m](floating_value auto x) noexcept; // 3
}
constexpr auto erfcx
Computes the normalized complementary error function .
Definition erfcx.hpp:78

Parameters

Return value

  1. The value of the normalized complementary error function: \( \displaystyle \mbox{erfcx}(x) = e^{x^2} \mbox{erfc}(x)\), is returned.
  2. faster computations at accuracy price.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0f, -0.0f, -1.0f, 1.0f, 2.0f,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> erfcx(wf) = " << eve::erfcx(wf) << "\n";
std::cout << "-> erfcx[ignore_last(2)](wf)= " << eve::erfcx[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> erfcx[wf > 0.0f](wf) = " << eve::erfcx[wf > 0.0f](wf) << "\n";
}

◆ exp_int

auto eve::exp_int = functor<exp_int_t>
inlineconstexpr

elementwise_callable object computing the exponential integral \( \mathbf{E}_n(x) = \displaystyle \int_1^\infty \frac{e^{-xt}}{t^n}\;\mbox{d}t\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto exp_int(floating_value auto x) noexcept; // 1
constexpr auto exp_int(unsigned_value auto n, floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto exp_int[raw](/*any of the above overloads*/) noexcept; // 2
constexpr auto exp_int[fast](/*any of the above overloads*/) noexcept; // 2
constexpr auto exp_int[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 3
constexpr auto exp_int[logical_value auto m](/*any of the above overloads*/) noexcept; // 3
}
constexpr auto exp_int
elementwise_callable object computing the exponential integral .
Definition exp_int.hpp:87

Parameters

Return value

  1. The value of the exponential integral \( \mathbf{E}_n(x) = \displaystyle \int_1^\infty \frac{e^{-xt}}{t^n}\;\mbox{d}t\), is returned.
  2. speedier computations at accuracy price.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.5, 1.5, 0.1, 1.0, 19.0, 25.0, 21.5, 10000.0};
eve::wide wi = {0, 1, 5, -2, 10, 6000, 0, 2};
std::cout << "<- wf = " << wf << "\n";
std::cout << "<- wi = " << wi << "\n";
std::cout << "-> exp_int(wf) = " << eve::exp_int(wf) << "\n";
std::cout << "-> exp_int(wi, wf) = " << eve::exp_int(wi, wf) << "\n";
std::cout << "-> exp_int[ignore_last(2)](wf)= " << eve::exp_int[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> exp_int[wf< 25.0](wf) = " << eve::exp_int[wf < 25.0](wf) << "\n";
}

◆ factorial

auto eve::factorial = functor<factorial_t>
inlineconstexpr

elementwise_callable computing \(\displaystyle n! = \prod_{i=1}^n i\).

Callable Signatures

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
template <value T> constexpr as_wide_as_t<double,T> factorial(T x) noexcept; // 1
// Semantic options
template <value T> constexpr as_wide_as_t<double,T> factorial[pedantic](T x) noexcept; // 2
// Lanes masking
constexpr auto factorial[conditional_expr auto c](value auto n) noexcept; // 3
constexpr auto factorial[logical_value auto m](value auto n) noexcept; // 3
}
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto pedantic
Follows the corner cases of the corresponding standard function.
Definition core.hpp:91
constexpr auto factorial
elementwise_callable computing .
Definition factorial.hpp:84

Parameters

Return value

  1. The value of \( n!\) is returned. If the entry is of integral type a double based floating_value is returned. The call return a Nan for any entry which is not a flint or not positive.
  2. With the pedantic option \(\Gamma(x+1)\) is returned. (more expansive)
  3. The operation is performed conditionally
Warning
This function will overflow as soon as the input is greater than 171 for integral or double entries and if the entry is greater than 34 for float.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<float> wf([](auto i, auto c)->float{ return 2*(i+c/2);});
eve::wide wf1{-3.0, 0.5, 3.0, 4.0};
eve::wide wi = {93, 25, 32, 180, 1, 2, 3, 4};
eve::wide<std::uint32_t> wu([](auto i, auto )->std::uint32_t{ return i;});
std::cout << "<- wf = " << wf << "\n";
std::cout << "<- wf1 = " << wf1<< "\n";
std::cout << "<- wi = " << wi << "\n";
std::cout << "<- wu = " << wu << "\n";
std::cout << "-> factorial(wf) = " << eve::factorial(wf) << "\n";
std::cout << "-> factorial(wi) = " << eve::factorial(wi) << "\n";
std::cout << "-> factorial(wu) = " << eve::factorial(wu) << "\n";
std::cout << "-> factorial(wf1) = " << eve::factorial(wf1) << "\n";
std::cout << "-> factorial[pedantic](wf1) = " << eve::factorial[eve::pedantic](wf1) << "\n";
}

◆ gamma_p

auto eve::gamma_p = functor<gamma_p_t>
inlineconstexpr

elementwise_callable object computing the normalized lower incomplete \(\Gamma\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto gamma_p(floating_value auto x, floating_value auto y) noexcept; // 1
// Lanes masking
constexpr auto gamma_p[conditional_expr auto c](floating_value auto x, floating_value auto y) noexcept; // 2
constexpr auto gamma_p[logical_value auto m](floating_value auto x, floating_value auto y) noexcept; // 2
}
constexpr auto gamma_p
elementwise_callable object computing the normalized lower incomplete function.
Definition gamma_p.hpp:77

Parameters

Return value

  1. The value of the normalized lower incomplete \(\Gamma\) function: \(\displaystyle \frac{1}{\Gamma(x)}\int_0^{y} t^{x-1}e^{-t}\mbox{d}t\) is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wk = {1.0e-3, 0.3, 0.75, 5.5};
eve::wide wp = {10.0, 0.5, 20.7, 1.0};
std::cout << "<- wk = " << wk << "\n";
std::cout << "<- wp = " << wp << "\n";
std::cout << "-> gamma_p(wk, wp) = " << eve::gamma_p(wk, wp) << "\n";
std::cout << "-> gamma_p[ignore_last(2)](wk, wp)= " << eve::gamma_p[eve::ignore_last(2)](wk, wp) << "\n";
std::cout << "-> gamma_p[wk > 0.5](wk, wp) = " << eve::gamma_p[wk > 0.5](wk, wp) << "\n";
}

◆ gamma_p_inv

auto eve::gamma_p_inv = functor<gamma_p_inv_t>
inlineconstexpr

elementwise_callable object computing the inverse of the normalized lower incomplete \(\Gamma\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto gamma_p_inv(floating_value auto x, floating_value auto y) noexcept; // 1
// Lanes masking
constexpr auto gamma_p_inv[conditional_expr auto c](floating_value auto x, floating_value auto y) noexcept; // 2
constexpr auto gamma_p_inv[logical_value auto m](floating_value auto x, floating_value auto y) noexcept; // 2
}
constexpr auto gamma_p_inv
elementwise_callable object computing the inverse of the normalized lower incomplete function.
Definition gamma_p_inv.hpp:80

Parameters

Return value

  1. The value of the inverse of the normalized lower incomplete \(\Gamma\) function relative to the first parameter is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wk = {1.0e-3, 0.3, 0.75, 5.5};
eve::wide wp = {10.0, 0.5, 20.7, 1.0};
std::cout << "<- wk = " << wk << "\n";
std::cout << "<- wp = " << wp << "\n";
std::cout << "-> gamma_p(wk, wp) = " << eve::gamma_p(wk, wp) << "\n";
std::cout << "-> gamma_p[ignore_last(2)](wk, wp)= " << eve::gamma_p[eve::ignore_last(2)](wk, wp) << "\n";
std::cout << "-> gamma_p[wk > 0.5](wk, wp) = " << eve::gamma_p[wk > 0.5](wk, wp) << "\n";
}

◆ hurwitz

auto eve::hurwitz = functor<hurwitz_t>
inlineconstexpr

elementwise_callable object computing the Hurwitz function i.e. \(\sum_{k=0}^\infty (k+z)^{-s}\), where any term with \(k+z = 0\) is excluded.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto hurwitz(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto hurwitz[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto hurwitz[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto hurwitz
elementwise_callable object computing the Hurwitz function i.e. , where any term with is excluded.
Definition hurwitz.hpp:73

Parameters

Return value

  1. The value of the Hurwitz function: \(\sum_{k=0}^\infty (k+z)^{-s}\), where any term with \(k+z = 0\) is excluded.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<double, eve::fixed<4>> z{0.125, 15, -2.45, 1.0};
for(int i=2; i < 5 ; ++i)
{
std::cout << eve::hurwitz(i, z) << std::endl;
}
// using w_t = eve::wide<double, eve::fixed<1>>;
// std::cout << eve::hurwitz(3.0, 15.0) << std::endl;
// std::cout << " ================================ "<< std::endl;
// std::cout << eve::hurwitz(3.0, w_t(15.0)) << std::endl;
}

◆ lambert

auto eve::lambert = functor<lambert_t>
inlineconstexpr

Computes the inverse of the function \( x \rightarrow xe^x \).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto lambert(floating_value auto x) ; noexcept; // 1
// Lanes masking
constexpr auto lambert[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto lambert[logical_value auto m](floating_value auto x) noexcept; // 2
! }
constexpr auto lambert
Computes the inverse of the function .
Definition lambert.hpp:75

Parameters

Return value

  1. A tuple of the two branch values of the Lambert function is returned with the following considerations:
    • The branches are not defined for input less than \(e^{-1}\) in that case the values returned are NaN.
    • If the inputs are positive, only one branch exist and the two returned values are equal.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {-1.0, -0.367879441171441, 0.0, -0.2, 0.2, -0.0, 3.0, 100.0};
std::cout << "-> lambert(wf) = " << eve::lambert(wf) << "\n";
}

◆ lbeta

auto eve::lbeta = functor<lbeta_t>
inlineconstexpr

elementwise_callable object computing the natural logarithm of the beta function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto lbeta(floating_value auto x, floating_value auto y) noexcept; // 1
// Lanes masking
constexpr auto lbeta[raw](floating_value auto x) noexcept; // 2
constexpr auto lbeta[fast](floating_value auto x) noexcept; // 2
constexpr auto lbeta[conditional_expr auto c](floating_value auto x, floating_value auto y) noexcept; // 3
constexpr auto lbeta[logical_value auto m](floating_value auto x, floating_value auto y) noexcept; // 3
}
constexpr auto lbeta
elementwise_callable object computing the natural logarithm of the beta function.
Definition lbeta.hpp:78

Parameters

Return value

  1. the natural logarithm of the beta function.
  2. faster computations at accuracy price.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide pf = { 0.0f, 1.0f, 4.0f, 2.0f };
eve::wide qf = { 1.0f, 1.0f, 3.0f, 5.0f};
std::cout << "<- pf = " << qf << "\n";
std::cout << "<- qf = " << qf << "\n";
std::cout << "-> lbeta(pf, qf) = " << eve::lbeta(pf, qf) << "\n";
std::cout << "-> lbeta[ignore_last(2)](pf, qf)= " << eve::lbeta[eve::ignore_last(2)](pf, qf) << "\n";
std::cout << "-> lbeta[qf != 3.0f](pf, qf) = " << eve::lbeta[qf != 3.0f](pf, qf) << "\n";
}

◆ lfactorial

auto eve::lfactorial = functor<lfactorial_t>
inlineconstexpr

elementwise_callable object computing the natural logarithm of the factorial of unsigned integer values \(\displaystyle \log n! = \sum_{i=1}^n \log i\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
template <value T> constexpr as_wide_as_t<double,T> lfactorial(T x) noexcept; // 1
// Semantic options
template <value T> constexpr as_wide_as_t<double,T> lfactorial[pedantic](T x) noexcept; // 2
// Lanes masking
constexpr auto factorial[conditional_expr auto c](value auto n) noexcept; // 3
constexpr auto factorial[logical_value auto m](value auto n) noexcept; // 3
}
constexpr auto lfactorial
elementwise_callable object computing the natural logarithm of the factorial of unsigned integer valu...
Definition lfactorial.hpp:85

Parameters

Return value

  1. The value of \( \log n!\) is returned with the following considerations:
    • If the entry is an integral value, the result element type is always double to try to avoid overflow as possible.
    • If the entry is a floating point value which must be a flint, the result is of the same type as the entry.
    • If n elements are nor integer nor flint the result is NaN.
  2. With the pedantic option \(\log(\Gamma(x+1))\) is returned.
  3. The operation is performed conditionally

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<float> wf([](auto i, auto c)->float{ return 2*(i+c/2);});
eve::wide wf1{-3.0, 0.5, 3.0, 4.0};
eve::wide wi = {93, 25, 32, 180, 1, 2, 3, 4};
eve::wide<std::uint32_t> wu([](auto i, auto )->std::uint32_t{ return i;});
std::cout << "<- wf = " << wf << "\n";
std::cout << "<- wf1 = " << wf1 << "\n";
std::cout << "<- wi = " << wi << "\n";
std::cout << "<- wu = " << wu << "\n";
std::cout << "-> lfactorial(wf) = " << eve::lfactorial(wf) << "\n";
std::cout << "-> lfactorial(wi) = " << eve::lfactorial(wi) << "\n";
std::cout << "-> lfactorial(wu) = " << eve::lfactorial(wu) << "\n";
std::cout << "-> lfactorial(wf1) = " << eve::lfactorial(wf1) << "\n";
std::cout << "-> lfactorial[pedantic](wf1) = " << eve::lfactorial[eve::pedantic](wf1) << "\n";
}

◆ log_abs_gamma

auto eve::log_abs_gamma = functor<log_abs_gamma_t>
inlineconstexpr

elementwise_callable object computing the natural logarithm of the absolute value of the \(\Gamma\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto log_abs_gamma(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto log_abs_gamma[raw](floating_value auto x) noexcept; // 2
constexpr auto log_abs_gamma[fast](floating_value auto x) noexcept; // 2
constexpr auto log_abs_gamma[conditional_expr auto c](floating_value auto x) noexcept; // 3
constexpr auto log_abs_gamma[logical_value auto m](floating_value auto x) noexcept; // 3
}
constexpr auto log_abs_gamma
elementwise_callable object computing the natural logarithm of the absolute value of the function.
Definition log_abs_gamma.hpp:76

Parameters

Return value

  1. the value of the logarithm of the absolute value of the \(\Gamma\) function is returned.
  2. faster computations at accuracy price based on "An accurate approximation formula for gamma function" of Zhen-Hang Yang and Jing-Feng Tian.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.5f, -1.5f, -1.0f, 1.0f, 5.0f,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> log_abs_gamma(wf) = " << eve::log_abs_gamma(wf) << "\n";
std::cout << "-> log_abs_gamma[ignore_last(2)](wf) = " << eve::log_abs_gamma[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> log_abs_gamma[wf != 2.0f](wf) = " << eve::log_abs_gamma[wf != 2.0f](wf) << "\n";
}

◆ log_gamma

auto eve::log_gamma = functor<log_gamma_t>
inlineconstexpr

elementwise_callable object computing the natural logarithm of the \(\Gamma\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto log_gamma(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto log_gamma[raw](floating_value auto x) noexcept; // 2
constexpr auto log_gamma[fast](floating_value auto x) noexcept; // 2
constexpr auto log_gamma[conditional_expr auto c](floating_value auto x) noexcept; // 3
constexpr auto log_gamma[logical_value auto m](floating_value auto x) noexcept; // 3
}
constexpr auto log_gamma
elementwise_callable object computing the natural logarithm of the function.
Definition log_gamma.hpp:78

Parameters

Return value

  1. The value of the logarithm of the \(\Gamma\) function is returned. this callable returns NaN if eve::gamma(x) is less than zero.
  2. faster computations at accuracy price based on "An accurate approximation formula for gamma function" of Zhen-Hang Yang and Jing-Feng Tian.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<float> wf([](auto i, auto c)->float{ return 2*(i+c/2);});
eve::wide bads{0.0, -0.0, -1.0, -2.5};
std::cout << "<- wf = " << wf << "\n";
std::cout << "<- bads = " << bads << "\n";
std::cout << "-> log_gamma(wf) = " << eve::log_gamma(wf) << "\n";
std::cout << "-> log_gamma[ignore_last(2)](wf)= " << eve::log_gamma[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> log_gamma[wf != 12.0f](wf) = " << eve::log_gamma[wf != 12.0f](wf) << "\n";
std::cout << "-> log_gamma(bads) = " << eve::log_gamma(bads)<< "\n";
}

◆ lrising_factorial

auto eve::lrising_factorial = functor<lrising_factorial_t>
inlineconstexpr

elementwise_callable object computing the natural logarithm of the rising Factorial function i.e. \(\log\left(\frac{\Gamma(x+a)}{\Gamma(x)}\right)\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
template<typename I, typename T> constexpr as_wide_as_t<T, I> lrising_factorial(I a, T x) noexcept; // 1
// Lanes masking
constexpr auto lrising_factorial[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 2
constexpr auto lrising_factorial[logical_value auto m](/*any of the above overloads*/) noexcept; // 2
// Semantic options
constexpr auto lrising_factoriale[raw]/*any of the above overloads*/) noexcept; // 3
constexpr auto lrising_factoriale[fast]/*any of the above overloads*/) noexcept; // 3
constexpr auto lrising_factorialee[pedantic](/*any of the above overloads*/) noexcept; // 4
}
constexpr auto lrising_factorial
elementwise_callable object computing the natural logarithm of the rising Factorial function i....
Definition lrising_factorial.hpp:88

Parameters

Return value

  1. The value of the natural logarithm of the rising_factorial is returned( a and x must be strictly positive).
  2. The operation is performed conditionally.
  3. speedier, less accurate and return a Nan if a and a+x are not both positive.
  4. The pedantic option uses reflection tricks and computes the function for all real a and x, and in fact computes the logarithm of the absolute value of the Pochammer symbol \(\log\left|\frac{\Gamma(x+a)}{\Gamma(x)}\right|\) returning nan only if the result is really undefined.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide n = {1, 2, -3, 7};
eve::wide p = {1.0f, 1.5f, 2.0f, 2.5f};
std::cout << "<- n = " << n << "\n";
std::cout << "<- p = " << p << "\n";
std::cout << "-> lrising_factorial(n, p) = " << eve::lrising_factorial(n, p) << "\n";
std::cout << "-> lrising_factorial[ignore_last(2)](n, p)= " << eve::lrising_factorial[eve::ignore_last(2)](n, p) << "\n";
std::cout << "-> lrising_factorial[n != 2](n, p) = " << eve::lrising_factorial[n != 2](n, p) << "\n";
std::cout << "-> lrising_factorial[raw](n, p) = " << eve::lrising_factorial[eve::raw](n, p) << "\n";
std::cout << "-> lrising_factorial[pedantic](n, p) = " << eve::lrising_factorial[eve::pedantic](n, p) << "\n";
}

◆ omega

auto eve::omega = functor<omega_t>
inlineconstexpr

Computes the Wright \(\omega\) the inverse function of \( x \rightarrow \log x+x\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto omega(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto omega[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto omega[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto omega
Computes the Wright the inverse function of .
Definition omega.hpp:75

Parameters

Return value

  1. The value of the Wright \(\omega\) function is returned (the inverse function of \( x \rightarrow \log x+x\)) is returned.
  2. The operation is performed conditionally.

ω can be used as an alias.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf{-10.0, -2.0, -0.5, 0.0, 0.2, 0.5, 10.0, 100.0};
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> omega(wf) = " << eve::omega(wf) << "\n";
std::cout << "-> omega[ignore_last(2)](wf)= " << eve::omega[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> omega[wf != -2.0f](wf) = " << eve::omega[wf != -2.0f](wf) << "\n";
std::cout << "-> \u03c9(wf) (unicode alias) = " << eve::ω(wf) << "\n";
}
constexpr auto ω
Unicode alias for eve::omega, computing the Wright function.
Definition omega.hpp:76

◆ polygamma

auto eve::polygamma = functor<polygamma_t>
inlineconstexpr

elementwise_callable object computing the Polygamma function i.e. the nth derivative of the digamma function

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto polygamma(scalar_value auto n, floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto polygamma[conditional_expr auto c](scalar_value auto n, floating_value auto x) noexcept; // 2
constexpr auto polygamma[logical_value auto m](scalar_value auto n, floating_value auto x) noexcept; // 2
}
Specify that a type represents a scalar value The concept scalar_value<T> is satisfied if and only if...
Definition scalar.hpp:138
constexpr auto polygamma
elementwise_callable object computing the Polygamma function i.e. the nth derivative of the digamma f...
Definition polygamma.hpp:78

Parameters

Return value

  1. The value of the Polygamma function: \(\psi(n, x) = \frac{\mbox{d}^{n+1}}{\mbox{d}x^{n+1}}\log\Gamma(x)\) is returned.
  2. The operation is performed conditionally.
Note
Only integral (or flint) positive values of n correspond to the proper polygamma definition. You can use non integral values but the function result may be different to the standard definitions of polygamma extensions.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<double, eve::fixed<4>> z{0.125, 15, -2.45, 1.0};
for(int i=0; i < 5 ; ++i)
{
std::cout << eve::polygamma(i, z) << std::endl;
}
}

◆ rising_factorial

auto eve::rising_factorial = functor<rising_factorial_t>
inlineconstexpr

elementwise_callable object computing the rising Factorial function i.e. \(\frac{\Gamma(x+a)}{\Gamma(x)}\).

Defined in header

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
template<typename I, typename T> constexpr as_wide_as_t<T, I> rising_factorial(I a, T x) noexcept; // 1
// Lanes masking
constexpr auto rising_factorial[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 2
constexpr auto rising_factorial[logical_value auto m](/*any of the above overloads*/) noexcept; // 2
// Semantic options
constexpr auto rising_factoriale[raw]/*any of the above overloads*/) noexcept; // 3
constexpr auto rising_factorialee[pedantic](/*any of the above overloads*/) noexcept; // 4
}
constexpr auto rising_factorial
elementwise_callable object computing the rising Factorial function i.e. .
Definition rising_factorial.hpp:86

Parameters

Return value

  1. The value of the rising_factorial is returned( a and x must be strictly positive).
  2. The operation is performed conditionally.
  3. The raw option uses the crude formula with all its limitations and inaccuracies and return a Nan if a and a+x are not both positive.
  4. The pedantic option uses reflection tricks and computes the function for all real a and x, returning nan if the result is really undefined.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide n = {1, 2, -3, 7};
eve::wide p = {1.0f, 1.5f, 2.0f, 2.5f};
std::cout << "<- n = " << n << "\n";
std::cout << "<- p = " << p << "\n";
std::cout << "-> rising_factorial(n, p) = " << eve::rising_factorial(n, p) << "\n";
std::cout << "-> rising_factorial[ignore_last(2)](n, p)= " << eve::rising_factorial[eve::ignore_last(2)](n, p) << "\n";
std::cout << "-> rising_factorial[n != 2.0f](n, p) = " << eve::rising_factorial[n != 2.0f](n, p) << "\n";
std::cout << "-> rising_factorial[raw](n, p) = " << eve::rising_factorial[eve::raw](n, p) << "\n";
std::cout << "-> rising_factorial[pedantic](n, p) = " << eve::rising_factorial[eve::pedantic](n, p) << "\n";
}

◆ signgam

auto eve::signgam = functor<signgam_t>
inlineconstexpr

elementwise_callable object computing the sign of the \(\Gamma\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto signgam(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto signgam[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto signgam[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto signgam
elementwise_callable object computing the sign of the function.
Definition signgam.hpp:72

Parameters

Return value

  1. The value of eve::sign(eve::tgamma(x)) is returned (without computing eve::tgamma(x));
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf{0.5f, -1.5f, -1.0f, 1.0f, -2.5f,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> signgam(wf) = " << eve::signgam(wf) << "\n";
std::cout << "-> signgam[ignore_last(2)](wf)= " << eve::signgam[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> signgam[wf != -1.5f](wf) = " << eve::signgam[wf != -1.5f](wf) << "\n";
}

◆ sin_int

auto eve::sin_int = functor<sin_int_t>
inlineconstexpr

elementwise_callable object computing the sine integral \( \mathbf{Si}(x) = \displaystyle \int_0^x \frac{\sin t}{t}\;\mbox{d}t\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto sin_int(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto sin_int[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 2
constexpr auto sin_int[logical_value auto m](/*any of the above overloads*/) noexcept; // 2
}
constexpr auto sin_int
elementwise_callable object computing the sine integral .
Definition sin_int.hpp:74

Parameters

Return value

  1. The value of the sine integral \( \mathbf{E}_n(x) = \displaystyle \int_0^x \frac{\sin t}{t}\;\mbox{d}t\), is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide w = {0.0, -1.0, 1.0, 2.0, 50.0,
std::cout << "<- w = " << w << "\n";
std::cout << "-> sin_int(w) = " << eve::sin_int(w) << "\n";
std::cout << "-> sin_int[ignore_last(2)](w) = " << eve::sin_int[eve::ignore_last(2)](w) << "\n";
std::cout << "-> sin_int[w <= 2.0](w) = " << eve::sin_int[w <= 2.0](w) << "\n";
}

◆ stirling

auto eve::stirling = functor<stirling_t>
inlineconstexpr

elementwise_callable object computing the Stirling approximation of the \(\Gamma\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto stirling(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto stirling[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto stirling[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto stirling
elementwise_callable object computing the Stirling approximation of the function.
Definition stirling.hpp:73

Parameters

Return value

  1. The value of 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, is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<float> wf([](auto i, auto c)->float{ return 2*(i+float(c)/3);});
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> stirling(wf) = " << eve::stirling(wf) << "\n";
std::cout << "-> stirling[ignore_last(2)](wf)= " << eve::stirling[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> stirling[wf != 6.0f](wf) = " << eve::stirling[wf != 6.0f](wf) << "\n";
}

◆ tgamma

auto eve::tgamma = functor<tgamma_t>
inlineconstexpr

elementwise_callable object computing \(\displaystyle \Gamma(x)=\int_0^\infty t^{x-1}e^{-t}\mbox{d}t\).

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto tgamma(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto tgamma[raw](floating_value auto x) noexcept; // 2
constexpr auto tgamma[fast](floating_value auto x) noexcept; // 2
constexpr auto tgamma[conditional_expr auto c](floating_value auto x) noexcept; // 3
constexpr auto tgamma[logical_value auto m](floating_value auto x) noexcept; // 3
}
constexpr auto tgamma
elementwise_callable object computing .
Definition tgamma.hpp:80

Parameters

Return value

  1. The value of \(\Gamma\) is returned.
  2. faster computations at accuracy price based on "An accurate approximation formula for gamma function" of Zhen-Hang Yang and Jing-Feng Tian.
  3. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.5f, -1.5f, -1.0f, 1.0f, 5.0f,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> tgamma(wf) = " << eve::tgamma(wf) << "\n";
std::cout << "-> tgamma[ignore_last(2)](wf)= " << eve::tgamma[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> tgamma[wf > 0.0f](wf) = " << eve::tgamma[wf > 0.0f](wf) << "\n";
}

◆ trigamma

auto eve::trigamma = functor<trigamma_t>
inlineconstexpr

elementwise_callable object computing the Trigamma function i.e. the second derivative of the \(\log\Gamma\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto trigamma(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto trigamma[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto trigamma[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto trigamma
elementwise_callable object computing the Trigamma function i.e. the second derivative of the functi...
Definition trigamma.hpp:70

Parameters

Return value

  1. The value of the Trigamma function: \(\psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}\) is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 0
#include <eve/module/special.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide wf = {0.5, 1.0, 1.5, 2.0, 3.0, 10.0, 0.25, 100.0};
std::cout << std::setprecision(15);
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> trigamma(wf) = " << eve::trigamma(wf) << "\n";
std::cout << "-> trigamma[wf > 1.0](wf) = " << eve::trigamma[wf > 1.0](wf) << "\n";
}

◆ zeta

auto eve::zeta = functor<zeta_t>
inlineconstexpr

Computes the Riemann \(\zeta\) function.

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto zeta(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto zeta[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto zeta[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto zeta
Computes the Riemann function.
Definition zeta.hpp:73

Parameters

Return value

  1. The value of the Riemann function defined as \(\displaystyle \zeta(s)=\sum_{n=0}^\infty \frac1{n^s}\) for \(s > 1\) and using analytic continuation elsewhere, is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<float> wf([](auto i, auto c)->float{ return 2*(i-c/2);});
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> zeta(wf) = " << eve::zeta(wf) << "\n";
std::cout << "-> zeta[ignore_last(2)](wf)= " << eve::zeta[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> zeta[wf != -2.0f](wf) = " << eve::zeta[wf != -2.0f](wf) << "\n";
}