WPILibC++ 2023.4.3
erf_inv.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::erf_inv_decision (const T value, const T p, const T direc, const int iter_count) noexcept
 
template<typename T >
constexpr T internal::erf_inv_initial_val_coef_2 (const T a, const T p_term, const int order) noexcept
 
template<typename T >
constexpr T internal::erf_inv_initial_val_case_2 (const T a, const T p_term, const int order) noexcept
 
template<typename T >
constexpr T internal::erf_inv_initial_val_coef_1 (const T a, const T p_term, const int order) noexcept
 
template<typename T >
constexpr T internal::erf_inv_initial_val_case_1 (const T a, const T p_term, const int order) noexcept
 
template<typename T >
constexpr T internal::erf_inv_initial_val_int (const T a) noexcept
 
template<typename T >
constexpr T internal::erf_inv_initial_val (const T x) noexcept
 
template<typename T >
constexpr T internal::erf_inv_err_val (const T value, const T p) noexcept
 
template<typename T >
constexpr T internal::erf_inv_deriv_1 (const T value) noexcept
 
template<typename T >
constexpr T internal::erf_inv_deriv_2 (const T value, const T deriv_1) noexcept
 
template<typename T >
constexpr T internal::erf_inv_ratio_val_1 (const T value, const T p, const T deriv_1) noexcept
 
template<typename T >
constexpr T internal::erf_inv_ratio_val_2 (const T value, const T deriv_1) noexcept
 
template<typename T >
constexpr T internal::erf_inv_halley (const T ratio_val_1, const T ratio_val_2) noexcept
 
template<typename T >
constexpr T internal::erf_inv_recur (const T value, const T p, const T deriv_1, const int iter_count) noexcept
 
template<typename T >
constexpr T internal::erf_inv_recur_begin (const T initial_val, const T p) noexcept
 
template<typename T >
constexpr T internal::erf_inv_begin (const T p) noexcept
 
template<typename T >
constexpr return_t< T > erf_inv (const T p) noexcept
 Compile-time inverse Gaussian error function. More...
 

Function Documentation

◆ erf_inv()

template<typename T >
constexpr return_t< T > erf_inv ( const T  p)
constexprnoexcept

Compile-time inverse Gaussian error function.

Parameters
pa real-valued input with values in the unit-interval.
Returns
Computes the inverse Gaussian error function, a value \( x \) such that

\[ f(x) := \text{erf}(x) - p \]

is equal to zero, for a given p. GCE-Math finds this root using Halley's method:

\[ x_{n+1} = x_n - \frac{f(x_n)/f'(x_n)}{1 - 0.5 \frac{f(x_n)}{f'(x_n)} \frac{f''(x_n)}{f'(x_n)} } \]

where

\[ \frac{\partial}{\partial x} \text{erf}(x) = \exp(-x^2), \ \ \frac{\partial^2}{\partial x^2} \text{erf}(x) = -2x\exp(-x^2) \]