1 #ifndef STAN__AGRAD__REV__FUNCTIONS__GAMMA_Q_HPP
2 #define STAN__AGRAD__REV__FUNCTIONS__GAMMA_Q_HPP
11 #include <boost/math/special_functions/gamma.hpp>
12 #include <boost/math/special_functions/digamma.hpp>
18 class gamma_q_vv_vari :
public op_vv_vari {
20 gamma_q_vv_vari(vari* avi, vari* bvi) :
21 op_vv_vari(stan::math::
gamma_q(avi->val_,bvi->val_),
30 * boost::math::gamma_p_derivative(avi_->val_, bvi_->val_);
34 class gamma_q_vd_vari :
public op_vd_vari {
36 gamma_q_vd_vari(vari* avi,
double b) :
37 op_vd_vari(stan::math::
gamma_q(avi->val_,b),
48 class gamma_q_dv_vari :
public op_dv_vari {
50 gamma_q_dv_vari(
double a, vari* bvi) :
51 op_dv_vari(stan::math::
gamma_q(a,bvi->val_),
56 * boost::math::gamma_p_derivative(ad_, bvi_->val_);
63 return var(
new gamma_q_vv_vari(a.
vi_,b.
vi_));
68 return var(
new gamma_q_vd_vari(a.
vi_,b));
73 return var(
new gamma_q_dv_vari(a,b.
vi_));
fvar< T > tgamma(const fvar< T > &x)
vari * vi_
Pointer to the implementation of this variable.
fvar< T > gamma_q(const fvar< T > &x1, const fvar< T > &x2)
double gradRegIncGamma(double a, double z, double g, double dig, double precision=1e-6)
Independent (input) and dependent (output) variables for gradients.
fvar< T > digamma(const fvar< T > &x)