Automatic Differentiation
 
Loading...
Searching...
No Matches
rising_factorial.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_RISING_FACTORIAL_HPP
2#define STAN_MATH_REV_FUN_RISING_FACTORIAL_HPP
3
8
9namespace stan {
10namespace math {
11
12namespace internal {
13
15 public:
17 : op_vd_vari(rising_factorial(avi->val_, b), avi, b) {}
18 void chain() {
19 avi_->adj_ += adj_ * rising_factorial(avi_->val_, bd_)
20 * (digamma(avi_->val_ + bd_) - digamma(avi_->val_));
21 }
22};
23} // namespace internal
24
25inline var rising_factorial(const var& a, int b) {
26 return var(new internal::rising_factorial_vd_vari(a.vi_, b));
27}
28} // namespace math
29} // namespace stan
30#endif
fvar< T > rising_factorial(const fvar< T > &x, int n)
Return autodiff variable with the gradient and result of the rising factorial function applied to the...
var_value< double > var
Definition var.hpp:1187
fvar< T > digamma(const fvar< T > &x)
Return the derivative of the log gamma function at the specified argument.
Definition digamma.hpp:23
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9