| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

grad_reg_inc_beta.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_BETA_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_BETA_HPP
3
4 #include <stan/math/prim/scal/fun/grad_inc_beta.hpp>
5 #include <stan/math/prim/scal/fun/inc_beta.hpp>
6 #include <stan/math/prim/scal/fun/lbeta.hpp>
7 #include <cmath>
8
9 namespace stan {
10 namespace math {
11
12 // Gradient of the regularized incomplete beta function ibeta(a, b, z)
13 template<typename T>
14 void grad_reg_inc_beta(T& g1, T& g2, T a, T b, T z,
15 T digammaA, T digammaB, T digammaSum, T betaAB) {
16 using stan::math::inc_beta;
17 using stan::math::grad_inc_beta;
18 using std::exp;
19 using stan::math::lbeta;
20
21 T dBda = 0;
22 T dBdb = 0;
23 grad_inc_beta(dBda, dBdb, a, b, z);
24 T b1 = exp(lbeta(a, b)) * inc_beta(a, b, z);
25 g1 = (dBda - b1 * (digammaA - digammaSum)) / betaAB;
26 g2 = (dBdb - b1 * (digammaB - digammaSum)) / betaAB;
27 }
28
29 }
30 }
31 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::lbeta
fvar< T > lbeta(const fvar< T > &x1, const fvar< T > &x2)
Definition: lbeta.hpp:16
stan::math::inc_beta
fvar< T > inc_beta(const fvar< T > &a, const fvar< T > &b, const fvar< T > &x)
Definition: inc_beta.hpp:20
stan::math::grad_inc_beta
void grad_inc_beta(stan::math::fvar< T > &g1, stan::math::fvar< T > &g2, stan::math::fvar< T > a, stan::math::fvar< T > b, stan::math::fvar< T > z)
Definition: grad_inc_beta.hpp:24
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
grad_inc_beta.hpp
lbeta.hpp
inc_beta.hpp
stan::math::grad_reg_inc_beta
void grad_reg_inc_beta(T &g1, T &g2, T a, T b, T z, T digammaA, T digammaB, T digammaSum, T betaAB)
Definition: grad_reg_inc_beta.hpp:14

[ Stan Home Page ] © 2011–2016, Stan Development Team.