1 #ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_GAMMA_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_GAMMA_HPP
27 T delta = s / (a * a);
28 while (
fabs(delta) > precision) {
32 delta = s / ((k + a) * (k + a));
34 throw domain_error(
"stan::math::gradRegIncGamma not converging");
36 return gamma_p(a, z) * ( dig - l ) +
exp( a * l ) * S / g;
int isinf(const stan::math::var &a)
Checks if the given number is infinite.
fvar< T > fabs(const fvar< T > &x)
fvar< T > log(const fvar< T > &x)
T grad_reg_inc_gamma(T a, T z, T g, T dig, T precision=1e-6)
bool isinf(const stan::math::var &v)
Checks if the given number is infinite.
fvar< T > exp(const fvar< T > &x)
void domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
fvar< T > gamma_p(const fvar< T > &x1, const fvar< T > &x2)
double e()
Return the base of the natural logarithm.