WPILibC++ 2023.4.3-108-ge5452e3
incomplete_beta_inv.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::incomplete_beta_inv_decision (const T value, const T alpha_par, const T beta_par, const T p, const T direc, const T lb_val, const int iter_count) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_1_tval (const T p) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_1_int_begin (const T t_val) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_1_int_ab1 (const T alpha_par, const T beta_par) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_1_int_ab2 (const T alpha_par, const T beta_par) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_1_int_h (const T ab_term_1) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_1_int_w (const T value, const T ab_term_2, const T h_term) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_1_int_end (const T alpha_par, const T beta_par, const T w_term) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_1 (const T alpha_par, const T beta_par, const T t_val, const T sgn_term) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_2_s1 (const T alpha_par, const T beta_par) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_2_s2 (const T alpha_par, const T beta_par) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val_2 (const T alpha_par, const T beta_par, const T p, const T s_1, const T s_2) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_initial_val (const T alpha_par, const T beta_par, const T p) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_err_val (const T value, const T alpha_par, const T beta_par, const T p) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_deriv_1 (const T value, const T alpha_par, const T beta_par, const T lb_val) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_deriv_2 (const T value, const T alpha_par, const T beta_par, const T deriv_1) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_ratio_val_1 (const T value, const T alpha_par, const T beta_par, const T p, const T deriv_1) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_ratio_val_2 (const T value, const T alpha_par, const T beta_par, const T deriv_1) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_halley (const T ratio_val_1, const T ratio_val_2) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_recur (const T value, const T alpha_par, const T beta_par, const T p, const T deriv_1, const T lb_val, const int iter_count) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_begin (const T initial_val, const T alpha_par, const T beta_par, const T p, const T lb_val) noexcept
 
template<typename T >
constexpr T internal::incomplete_beta_inv_check (const T alpha_par, const T beta_par, const T p) noexcept
 
template<typename T1 , typename T2 , typename T3 , typename TC = common_t<T1,T2,T3>>
constexpr TC internal::incomplete_beta_inv_type_check (const T1 a, const T2 b, const T3 p) noexcept
 
template<typename T1 , typename T2 , typename T3 >
constexpr common_t< T1, T2, T3 > incomplete_beta_inv (const T1 a, const T2 b, const T3 p) noexcept
 Compile-time inverse incomplete beta function. More...
 

Function Documentation

◆ incomplete_beta_inv()

template<typename T1 , typename T2 , typename T3 >
constexpr common_t< T1, T2, T3 > incomplete_beta_inv ( const T1  a,
const T2  b,
const T3  p 
)
constexprnoexcept

Compile-time inverse incomplete beta function.

Parameters
aa real-valued, non-negative input.
ba real-valued, non-negative input.
pa real-valued input with values in the unit-interval.
Returns
Computes the inverse incomplete beta function, a value \( x \) such that

\[ f(x) := \frac{\text{B}(x;\alpha,\beta)}{\text{B}(\alpha,\beta)} - p \]

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} \left(\frac{\text{B}(x;\alpha,\beta)}{\text{B}(\alpha,\beta)}\right) = \frac{1}{\text{B}(\alpha,\beta)} x^{\alpha-1} (1-x)^{\beta-1} \]

\[ \frac{\partial^2}{\partial x^2} \left(\frac{\text{B}(x;\alpha,\beta)}{\text{B}(\alpha,\beta)}\right) = \frac{1}{\text{B}(\alpha,\beta)} x^{\alpha-1} (1-x)^{\beta-1} \left( \frac{\alpha-1}{x} - \frac{\beta-1}{1 - x} \right) \]