Stan Math Library
4.9.0
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
4
#include <
stan/math/rev/meta.hpp
>
5
#include <
stan/math/rev/core.hpp
>
6
#include <
stan/math/prim/fun/digamma.hpp
>
7
#include <
stan/math/prim/fun/rising_factorial.hpp
>
8
9
namespace
stan
{
10
namespace
math {
11
12
namespace
internal {
13
14
class
rising_factorial_vd_vari
:
public
op_vd_vari
{
15
public
:
16
rising_factorial_vd_vari
(
vari
* avi,
int
b)
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
25
inline
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
stan::math::internal::rising_factorial_vd_vari::chain
void chain()
Definition
rising_factorial.hpp:18
stan::math::internal::rising_factorial_vd_vari::rising_factorial_vd_vari
rising_factorial_vd_vari(vari *avi, int b)
Definition
rising_factorial.hpp:16
stan::math::internal::rising_factorial_vd_vari
Definition
rising_factorial.hpp:14
stan::math::op_vd_vari::avi_
vari * avi_
Definition
vd_vari.hpp:11
stan::math::op_vd_vari::bd_
double bd_
Definition
vd_vari.hpp:12
stan::math::op_vd_vari
Definition
vd_vari.hpp:9
stan::math::var_value< double >
stan::math::vari_value
Definition
vari.hpp:17
stan::math::rising_factorial
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...
Definition
rising_factorial.hpp:26
stan::math::var
var_value< double > var
Definition
var.hpp:1187
stan::math::digamma
fvar< T > digamma(const fvar< T > &x)
Return the derivative of the log gamma function at the specified argument.
Definition
digamma.hpp:23
stan
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition
unit_vector_constrain.hpp:15
digamma.hpp
rising_factorial.hpp
core.hpp
meta.hpp
stan
math
rev
fun
rising_factorial.hpp
[
Stan Home Page
]
© 2011–2019, Stan Development Team.