Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lmgamma.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__FWD__FUNCTIONS__LMGAMMA_HPP
2 #define STAN__AGRAD__FWD__FUNCTIONS__LMGAMMA_HPP
3 
5 #include <stan/meta/traits.hpp>
8 
9 namespace stan {
10 
11  namespace agrad {
12 
13  template <typename T>
14  inline
15  fvar<typename stan::return_type<T,int>::type>
16  lmgamma(int x1, const fvar<T>& x2) {
17  using stan::math::lmgamma;
18  using stan::math::digamma;
19  using std::log;
20  T deriv = 0;
21  for(int count = 1; count < x1 + 1; count++)
22  deriv += x2.d_ * digamma(x2.val_ + (1.0 - count) / 2.0);
23  return fvar<typename
25  }
26  }
27 }
28 #endif
boost::math::tools::promote_args< typename scalar_type< T1 >::type, typename scalar_type< T2 >::type, typename scalar_type< T3 >::type, typename scalar_type< T4 >::type, typename scalar_type< T5 >::type, typename scalar_type< T6 >::type >::type type
Definition: traits.hpp:406
boost::math::tools::promote_args< T >::type lmgamma(const int k, T x)
Return the natural logarithm of the multivariate gamma function with the speciifed dimensions and arg...
Definition: lmgamma.hpp:57
double digamma(double x)
Definition: digamma.hpp:39
fvar< T > digamma(const fvar< T > &x)
Definition: digamma.hpp:16
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
fvar< typename stan::return_type< T, int >::type > lmgamma(int x1, const fvar< T > &x2)
Definition: lmgamma.hpp:16

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