All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
inc_beta.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_FWD_SCAL_FUN_INC_BETA_HPP
#define STAN_MATH_FWD_SCAL_FUN_INC_BETA_HPP
#include <boost/math/special_functions/beta.hpp>
#include <stan/math/prim/scal/fun/grad_reg_inc_beta.hpp>
#include <stan/math/fwd/scal/fun/grad_inc_beta.hpp>
#include <stan/math/fwd/scal/fun/pow.hpp>
#include <stan/math/fwd/scal/fun/exp.hpp>
#include <stan/math/fwd/scal/fun/lbeta.hpp>
#include <stan/math/fwd/scal/fun/digamma.hpp>
#include <stan/math/fwd/core.hpp>
#include <stan/math/prim/scal/fun/lbeta.hpp>
#include <stan/math/prim/scal/fun/digamma.hpp>
namespace stan {
namespace math {
template<typename T>
inline fvar<T> inc_beta(const fvar<T>& a,
const fvar<T>& b,
const fvar<T>& x) {
using stan::math::digamma;
using stan::math::grad_reg_inc_beta;
using stan::math::inc_beta;
using stan::math::lbeta;
using stan::math::digamma;
using stan::math::lbeta;
using stan::math::pow;
using std::exp;
using std::pow;
T d_a; T d_b; T d_x;
grad_reg_inc_beta(d_a, d_b, a.val_, b.val_, x.val_,
digamma(a.val_), digamma(b.val_),
digamma(a.val_+b.val_),
exp(lbeta(a.val_, b.val_)));
d_x = pow((1-x.val_), b.val_-1)*pow(x.val_, a.val_-1)
/ exp(lbeta(a.val_, b.val_));
return fvar<T>(inc_beta(a.val_, b.val_, x.val_),
a.d_ * d_a + b.d_ * d_b + x.d_ * d_x);
}
}
}
#endif
core.hpp
stan::math::fvar::d_
T d_
Definition: fvar.hpp:15
stan::math::lbeta
fvar< T > lbeta(const fvar< T > &x1, const fvar< T > &x2)
Definition: lbeta.hpp:16
digamma.hpp
pow.hpp
grad_inc_beta.hpp
digamma.hpp
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::fvar::val_
T val_
Definition: fvar.hpp:14
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
grad_reg_inc_beta.hpp
lbeta.hpp
stan::math::pow
fvar< T > pow(const fvar< T > &x1, const fvar< T > &x2)
Definition: pow.hpp:18
exp.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
lbeta.hpp
stan::math::fvar
Definition: fvar.hpp:13
stan::math::digamma
fvar< T > digamma(const fvar< T > &x)
Definition: digamma.hpp:16

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