Stan Math Library  2.14.0
reverse mode automatic differentiation
log_rising_factorial.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_RISING_FACTORIAL_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LOG_RISING_FACTORIAL_HPP
3 
7 #include <limits>
8 
9 namespace stan {
10  namespace math {
11 
50  template<typename T1, typename T2>
51  inline typename boost::math::tools::promote_args<T1, T2>::type
52  log_rising_factorial(const T1& x, const T2& n) {
53  if (is_nan(x) || is_nan(n))
54  return std::numeric_limits<double>::quiet_NaN();
55  static const char* fun = "log_rising_factorial";
56  check_positive(fun, "first argument", x);
57  return lgamma(x + n) - lgamma(x);
58  }
59 
60  }
61 }
62 
63 #endif
fvar< T > lgamma(const fvar< T > &x)
Return the natural logarithm of the gamma function applied to the specified argument.
Definition: lgamma.hpp:20
fvar< T > log_rising_factorial(const fvar< T > &x, const fvar< T > &n)
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
int is_nan(const fvar< T > &x)
Returns 1 if the input&#39;s value is NaN and 0 otherwise.
Definition: is_nan.hpp:21

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