tgamma.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_SCAL_FUN_TGAMMA_HPP
2 #define STAN_MATH_FWD_SCAL_FUN_TGAMMA_HPP
3 
4 #include <stan/math/fwd/core.hpp>
6 #include <boost/math/special_functions/digamma.hpp>
7 
8 namespace stan {
9 namespace math {
10 
11 /**
12  * Return the result of applying the gamma function to the
13  * specified argument.
14  *
15  * @tparam T Scalar type of autodiff variable.
16  * @param x Argument.
17  * @return Gamma function applied to argument.
18  */
19 template <typename T>
20 inline fvar<T> tgamma(const fvar<T>& x) {
22  T u = tgamma(x.val_);
23  return fvar<T>(u, x.d_ * u * digamma(x.val_));
24 }
25 } // namespace math
26 } // namespace stan
27 #endif
double T
Definition: Xdiff_gwt.C:5
fvar< T > tgamma(const fvar< T > &x)
Definition: tgamma.hpp:20
fvar< T > digamma(const fvar< T > &x)
Definition: digamma.hpp:22