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
log1m_exp.hpp
Go to the documentation of this file.
1
#ifndef STAN__AGRAD__FWD__FUNCTIONS__LOG1M_EXP_HPP
2
#define STAN__AGRAD__FWD__FUNCTIONS__LOG1M_EXP_HPP
3
4
#include <
stan/agrad/fwd/fvar.hpp
>
5
#include <
stan/meta/traits.hpp
>
6
#include <
stan/math/functions/log1m_exp.hpp
>
7
#include <boost/math/special_functions/expm1.hpp>
8
#include <
stan/math/constants.hpp
>
9
10
namespace
stan{
11
12
namespace
agrad{
13
14
template
<
typename
T>
15
inline
16
fvar<T>
17
log1m_exp
(
const
fvar<T>
& x) {
18
using
stan::math::log1m_exp
;
19
using
boost::math::expm1
;
20
using
stan::math::NOT_A_NUMBER
;
21
using
std::exp
;
22
if
(x.
val_
>= 0)
23
return
fvar<T>
(
NOT_A_NUMBER
);
24
return
fvar<T>
(
log1m_exp
(x.
val_
), x.
d_
/ -
expm1
(-x.
val_
));
25
}
26
}
27
}
28
#endif
log1m_exp.hpp
stan::math::NOT_A_NUMBER
const double NOT_A_NUMBER
(Quiet) not-a-number value.
Definition:
constants.hpp:53
stan::agrad::fvar
Definition:
fvar.hpp:13
traits.hpp
stan::agrad::expm1
fvar< T > expm1(const fvar< T > &x)
Definition:
expm1.hpp:15
fvar.hpp
stan::agrad::log1m_exp
fvar< T > log1m_exp(const fvar< T > &x)
Definition:
log1m_exp.hpp:17
stan::math::log1m_exp
boost::math::tools::promote_args< T >::type log1m_exp(const T a)
Calculates the log of 1 minus the exponential of the specified value without overflow log1m_exp(x) = ...
Definition:
log1m_exp.hpp:40
stan::agrad::fvar::d_
T d_
Definition:
fvar.hpp:16
constants.hpp
stan::agrad::exp
fvar< T > exp(const fvar< T > &x)
Definition:
exp.hpp:16
stan::agrad::fvar::val_
T val_
Definition:
fvar.hpp:15
[
Stan Home Page
]
© 2011–2014, Stan Development Team.