25#ifndef _gcem_incomplete_beta_inv_HPP
26#define _gcem_incomplete_beta_inv_HPP
33 const T direc,
const T lb_val,
const int iter_count)
noexcept;
47 return( p > T(0.5) ? \
60 return( t_val - ( T(2.515517) + T(0.802853)*t_val + T(0.010328)*t_val*t_val ) \
61 / ( T(1) + T(1.432788)*t_val + T(0.189269)*t_val*t_val + T(0.001308)*t_val*t_val*t_val ) );
70 return( T(1)/(2*alpha_par - T(1)) + T(1)/(2*beta_par - T(1)) );
79 return( T(1)/(2*beta_par - T(1)) - T(1)/(2*alpha_par - T(1)) );
88 return( T(2) / ab_term_1 );
99 - ab_term_2*((
value*
value - T(3))/T(6) + T(5)/T(6) - T(2)/(T(3)*h_term)) );
108 return( alpha_par / (alpha_par + beta_par*exp(2*w_term)) );
137 return(
pow(alpha_par/(alpha_par+beta_par),alpha_par) / alpha_par );
146 return(
pow(beta_par/(alpha_par+beta_par),beta_par) / beta_par );
155 return( p <= s_1/(s_1 + s_2) ?
pow(p*(s_1+s_2)*alpha_par,T(1)/alpha_par) :
156 T(1) -
pow(p*(s_1+s_2)*beta_par,T(1)/beta_par) );
167 return( (alpha_par > T(1) && beta_par > T(1)) ?
171 p < T(0.5) ? T(1) : T(-1) ) :
209 exp( (alpha_par - T(1))*
log(
value) + (beta_par - T(1))*
log(T(1) -
value) - lb_val ) );
218 return( deriv_1*((alpha_par - T(1))/
value - (beta_par - T(1))/(T(1) -
value)) );
245 return( ratio_val_1 /
max( T(0.8),
min( T(1.2), T(1) - T(0.5)*ratio_val_1*ratio_val_2 ) ) );
252 const T lb_val,
const int iter_count)
264 ), lb_val, iter_count) );
271 const T lb_val,
const int iter_count)
278 lb_val, iter_count+1) :
301 any_nan(alpha_par, beta_par, p) ? \
302 GCLIM<T>::quiet_NaN() :
310 alpha_par,beta_par,p,
lbeta(alpha_par,beta_par)) );
313template<
typename T1,
typename T2,
typename T3,
typename TC = common_t<T1,T2,T3>>
343template<
typename T1,
typename T2,
typename T3>
#define GCEM_INCML_BETA_INV_MAX_ITER
Definition: gcem_options.hpp:169
UnitType abs(const UnitType x) noexcept
Compute absolute value.
Definition: math.h:721
auto sqrt(const UnitType &value) noexcept -> unit_t< square_root< typename units::traits::unit_t_traits< UnitType >::unit_type >, typename units::traits::unit_t_traits< UnitType >::underlying_type, linear_scale >
computes the square root of value
Definition: math.h:483
dimensionless::scalar_t log(const ScalarUnit x) noexcept
Compute natural logarithm.
Definition: math.h:349
constexpr common_return_t< T1, T2, T3 > incomplete_beta(const T1 a, const T2 b, const T3 z) noexcept
Compile-time regularized incomplete beta function.
Definition: incomplete_beta.hpp:188
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.
Definition: incomplete_beta_inv.hpp:346
constexpr common_return_t< T1, T2 > lbeta(const T1 a, const T2 b) noexcept
Compile-time log-beta function.
Definition: lbeta.hpp:36
constexpr common_t< T1, T2 > max(const T1 x, const T2 y) noexcept
Compile-time pairwise maximum function.
Definition: max.hpp:35
constexpr common_t< T1, T2 > min(const T1 x, const T2 y) noexcept
Compile-time pairwise minimum function.
Definition: min.hpp:35
Definition: Eigen_Colamd.h:50
constexpr T incomplete_beta_inv_initial_val_1_int_ab1(const T alpha_par, const T beta_par) noexcept
Definition: incomplete_beta_inv.hpp:67
constexpr T incomplete_beta_inv_initial_val_2_s2(const T alpha_par, const T beta_par) noexcept
Definition: incomplete_beta_inv.hpp:143
constexpr T incomplete_beta_inv_initial_val_1_int_begin(const T t_val) noexcept
Definition: incomplete_beta_inv.hpp:57
constexpr T 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
Definition: incomplete_beta_inv.hpp:152
constexpr TC incomplete_beta_inv_type_check(const T1 a, const T2 b, const T3 p) noexcept
Definition: incomplete_beta_inv.hpp:316
constexpr T 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
Definition: incomplete_beta_inv.hpp:224
constexpr T incomplete_beta_inv_initial_val_1_int_ab2(const T alpha_par, const T beta_par) noexcept
Definition: incomplete_beta_inv.hpp:76
constexpr T incomplete_beta_inv_check(const T alpha_par, const T beta_par, const T p) noexcept
Definition: incomplete_beta_inv.hpp:297
constexpr T incomplete_beta_inv_initial_val_1_int_w(const T value, const T ab_term_2, const T h_term) noexcept
Definition: incomplete_beta_inv.hpp:94
constexpr T incomplete_beta_inv_deriv_1(const T value, const T alpha_par, const T beta_par, const T lb_val) noexcept
Definition: incomplete_beta_inv.hpp:200
constexpr T incomplete_beta_inv_initial_val_2_s1(const T alpha_par, const T beta_par) noexcept
Definition: incomplete_beta_inv.hpp:134
constexpr T 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
Definition: incomplete_beta_inv.hpp:270
constexpr T incomplete_beta_inv_initial_val_1_int_end(const T alpha_par, const T beta_par, const T w_term) noexcept
Definition: incomplete_beta_inv.hpp:105
constexpr T incomplete_beta_inv_halley(const T ratio_val_1, const T ratio_val_2) noexcept
Definition: incomplete_beta_inv.hpp:242
constexpr T incomplete_beta_inv_ratio_val_2(const T value, const T alpha_par, const T beta_par, const T deriv_1) noexcept
Definition: incomplete_beta_inv.hpp:233
constexpr T incomplete_beta_inv_begin(const T initial_val, const T alpha_par, const T beta_par, const T p, const T lb_val) noexcept
Definition: incomplete_beta_inv.hpp:286
constexpr T 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
Definition: incomplete_beta_inv.hpp:251
constexpr T incomplete_beta_inv_err_val(const T value, const T alpha_par, const T beta_par, const T p) noexcept
Definition: incomplete_beta_inv.hpp:191
constexpr T incomplete_beta_inv_deriv_2(const T value, const T alpha_par, const T beta_par, const T deriv_1) noexcept
Definition: incomplete_beta_inv.hpp:215
constexpr T incomplete_beta_inv_initial_val_1(const T alpha_par, const T beta_par, const T t_val, const T sgn_term) noexcept
Definition: incomplete_beta_inv.hpp:114
constexpr T incomplete_beta_inv_initial_val(const T alpha_par, const T beta_par, const T p) noexcept
Definition: incomplete_beta_inv.hpp:164
constexpr T incomplete_beta_inv_initial_val_1_tval(const T p) noexcept
Definition: incomplete_beta_inv.hpp:44
constexpr bool any_nan(const T1 x, const T2 y) noexcept
Definition: is_nan.hpp:45
constexpr T incomplete_beta_inv_initial_val_1_int_h(const T ab_term_1) noexcept
Definition: incomplete_beta_inv.hpp:85
constexpr common_t< T1, T2 > pow(const T1 base, const T2 exp_term) noexcept
Compile-time power function.
Definition: pow.hpp:76