All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
grad_reg_inc_beta.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_BETA_HPP
#define STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_BETA_HPP
#include <stan/math/prim/scal/fun/grad_inc_beta.hpp>
#include <stan/math/prim/scal/fun/inc_beta.hpp>
#include <stan/math/prim/scal/fun/lbeta.hpp>
#include <cmath>
namespace stan {
namespace math {
// Gradient of the regularized incomplete beta function ibeta(a, b, z)
template<typename T>
void grad_reg_inc_beta(T& g1, T& g2, T a, T b, T z,
T digammaA, T digammaB, T digammaSum, T betaAB) {
using stan::math::inc_beta;
using stan::math::grad_inc_beta;
using std::exp;
using stan::math::lbeta;
T dBda = 0;
T dBdb = 0;
grad_inc_beta(dBda, dBdb, a, b, z);
T b1 = exp(lbeta(a, b)) * inc_beta(a, b, z);
g1 = (dBda - b1 * (digammaA - digammaSum)) / betaAB;
g2 = (dBdb - b1 * (digammaB - digammaSum)) / betaAB;
}
}
}
#endif
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–2015, Stan Development Team.