Stan
2.5.0
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
stan
agrad
fwd
functions
log_rising_factorial.hpp
Go to the documentation of this file.
1
#ifndef STAN__AGRAD__FWD__FUNCTIONS__LOG_RISING_FACTORIAL_HPP
2
#define STAN__AGRAD__FWD__FUNCTIONS__LOG_RISING_FACTORIAL_HPP
3
4
#include <
stan/agrad/fwd/fvar.hpp
>
5
#include <
stan/meta/traits.hpp
>
6
#include <
stan/math/functions/log_rising_factorial.hpp
>
7
#include <boost/math/special_functions/digamma.hpp>
8
9
namespace
stan {
10
11
namespace
agrad {
12
13
template
<
typename
T>
14
inline
15
fvar<T>
16
log_rising_factorial
(
const
fvar<T>
& x,
const
fvar<T>
& n) {
17
using
stan::math::log_rising_factorial
;
18
using
boost::math::digamma
;
19
20
return
fvar<T>
(
log_rising_factorial
(x.
val_
,n.
val_
),
21
(
digamma
(x.
val_
+ n.
val_
) * (x.
d_
+ n.
d_
) -
digamma
(x.
val_
) * x.
d_
));
22
}
23
24
template
<
typename
T>
25
inline
26
fvar<T>
27
log_rising_factorial
(
const
fvar<T>
& x,
const
double
n) {
28
using
stan::math::log_rising_factorial
;
29
using
boost::math::digamma
;
30
31
return
fvar<T>
(
log_rising_factorial
(x.
val_
,n),
32
(
digamma
(x.
val_
+ n) -
digamma
(x.
val_
)) * x.
d_
);
33
34
}
35
36
template
<
typename
T>
37
inline
38
fvar<T>
39
log_rising_factorial
(
const
double
x,
const
fvar<T>
& n) {
40
using
stan::math::log_rising_factorial
;
41
using
boost::math::digamma
;
42
43
return
fvar<T>
(
log_rising_factorial
(x,n.
val_
),
44
(
digamma
(x + n.
val_
) * n.
d_
));
45
}
46
}
47
}
48
#endif
log_rising_factorial.hpp
stan::agrad::fvar
Definition:
fvar.hpp:13
traits.hpp
stan::math::log_rising_factorial
boost::math::tools::promote_args< T1, T2 >::type log_rising_factorial(const T1 x, const T2 n)
Definition:
log_rising_factorial.hpp:41
fvar.hpp
stan::agrad::digamma
fvar< T > digamma(const fvar< T > &x)
Definition:
digamma.hpp:16
stan::agrad::fvar::d_
T d_
Definition:
fvar.hpp:16
stan::agrad::log_rising_factorial
fvar< T > log_rising_factorial(const fvar< T > &x, const fvar< T > &n)
Definition:
log_rising_factorial.hpp:16
stan::agrad::fvar::val_
T val_
Definition:
fvar.hpp:15
[
Stan Home Page
]
© 2011–2014, Stan Development Team.