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
multiply_log.hpp
Go to the documentation of this file.
1
#ifndef STAN__AGRAD__FWD__FUNCTIONS__MULTIPLY_LOG_HPP
2
#define STAN__AGRAD__FWD__FUNCTIONS__MULTIPLY_LOG_HPP
3
4
#include <
stan/agrad/fwd/fvar.hpp
>
5
#include <
stan/meta/traits.hpp
>
6
#include <
stan/math/functions/multiply_log.hpp
>
7
8
namespace
stan {
9
10
namespace
agrad {
11
12
template
<
typename
T>
13
inline
14
fvar<T>
15
multiply_log
(
const
fvar<T>
& x1,
const
fvar<T>
& x2) {
16
using
stan::math::multiply_log
;
17
using
std::log
;
18
return
fvar<T>
(
multiply_log
(x1.
val_
, x2.
val_
),
19
x1.
d_
*
log
(x2.
val_
) + x1.
val_
* x2.
d_
/ x2.
val_
);
20
}
21
22
template
<
typename
T>
23
inline
24
fvar<T>
25
multiply_log
(
const
double
x1,
const
fvar<T>
& x2) {
26
using
stan::math::multiply_log
;
27
using
std::log
;
28
return
fvar<T>
(
multiply_log
(x1, x2.
val_
),
29
x1 * x2.
d_
/ x2.
val_
);
30
}
31
32
template
<
typename
T>
33
inline
34
fvar<T>
35
multiply_log
(
const
fvar<T>
& x1,
const
double
x2) {
36
using
stan::math::multiply_log
;
37
using
std::log
;
38
return
fvar<T>
(
multiply_log
(x1.
val_
, x2),
39
x1.
d_
*
log
(x2));
40
}
41
}
42
}
43
#endif
multiply_log.hpp
stan::math::multiply_log
boost::math::tools::promote_args< T_a, T_b >::type multiply_log(const T_a a, const T_b b)
Calculated the value of the first argument times log of the second argument while behaving properly w...
Definition:
multiply_log.hpp:51
stan::agrad::fvar
Definition:
fvar.hpp:13
traits.hpp
fvar.hpp
stan::agrad::multiply_log
fvar< T > multiply_log(const fvar< T > &x1, const fvar< T > &x2)
Definition:
multiply_log.hpp:15
stan::agrad::fvar::d_
T d_
Definition:
fvar.hpp:16
stan::agrad::log
fvar< T > log(const fvar< T > &x)
Definition:
log.hpp:15
stan::agrad::fvar::val_
T val_
Definition:
fvar.hpp:15
[
Stan Home Page
]
© 2011–2014, Stan Development Team.