Stan Math Library  2.15.0
reverse mode automatic differentiation
lmgamma.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_SCAL_FUN_LMGAMMA_HPP
2 #define STAN_MATH_FWD_SCAL_FUN_LMGAMMA_HPP
3 
4 #include <stan/math/fwd/core.hpp>
8 
9 namespace stan {
10  namespace math {
11 
12  template <typename T>
13  inline
14  fvar<typename stan::return_type<T, int>::type>
15  lmgamma(int x1, const fvar<T>& x2) {
16  using std::log;
17  T deriv = 0;
18  for (int count = 1; count < x1 + 1; count++)
19  deriv += x2.d_ * digamma(x2.val_ + (1.0 - count) / 2.0);
20  return fvar<typename
22  }
23  }
24 }
25 #endif
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:14
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: return_type.hpp:27
fvar< typename stan::return_type< T, int >::type > lmgamma(int x1, const fvar< T > &x2)
Definition: lmgamma.hpp:15
fvar< T > digamma(const fvar< T > &x)
Return the derivative of the log gamma function at the specified argument.
Definition: digamma.hpp:22

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