Stan Math Library  2.20.0
reverse mode automatic differentiation
log_inv_logit_diff.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_INV_LOGIT_DIFF_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LOG_INV_LOGIT_DIFF_HPP
3 
7 #include <boost/math/tools/promotion.hpp>
8 
9 namespace stan {
10 namespace math {
11 
35 template <typename T1, typename T2>
36 inline typename boost::math::tools::promote_args<T1, T2>::type
37 log_inv_logit_diff(const T1& x, const T2& y) {
38  return x - log1p_exp(x) + log1m_exp(y - x) - log1p_exp(y);
39 }
40 
41 } // namespace math
42 } // namespace stan
43 
44 #endif
fvar< T > log1m_exp(const fvar< T > &x)
Return the natural logarithm of one minus the exponentiation of the specified argument.
Definition: log1m_exp.hpp:23
fvar< T > log_inv_logit_diff(const fvar< T > &x, const fvar< T > &y)
Returns fvar with the natural logarithm of the difference of the inverse logits of the specified argu...
fvar< T > log1p_exp(const fvar< T > &x)
Definition: log1p_exp.hpp:12

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