| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

log_diff_exp.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_DIFF_EXP_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LOG_DIFF_EXP_HPP
3
4 #include <stan/math/prim/scal/fun/log1m_exp.hpp>
5 #include <boost/math/tools/promotion.hpp>
6 #include <boost/throw_exception.hpp>
7 #include <limits>
8 #include <stdexcept>
9
10 namespace stan {
11 namespace math {
12
48 template <typename T1, typename T2>
49 inline typename boost::math::tools::promote_args<T1, T2>::type
50 log_diff_exp(const T1 x, const T2 y) {
51 if (x <= y)
52 return std::numeric_limits<double>::quiet_NaN();
53 return x + log1m_exp(y - x);
54 }
55
56 }
57 }
58
59 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::log_diff_exp
fvar< T > log_diff_exp(const fvar< T > &x1, const fvar< T > &x2)
Definition: log_diff_exp.hpp:14
stan::math::log1m_exp
fvar< T > log1m_exp(const fvar< T > &x)
Definition: log1m_exp.hpp:16
log1m_exp.hpp

[ Stan Home Page ] © 2011–2016, Stan Development Team.