Stan Math Library  2.11.0
reverse mode automatic differentiation
log1m_inv_logit.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LOG1M_INV_LOGIT_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LOG1M_INV_LOGIT_HPP
3 
4 #include <boost/math/tools/promotion.hpp>
5 
6 namespace stan {
7  namespace math {
8 
34  template <typename T>
35  inline typename boost::math::tools::promote_args<T>::type
36  log1m_inv_logit(const T u) {
37  using std::exp;
38  if (u > 0.0)
39  return -u - log1p(exp(-u)); // prevent underflow
40  return -log1p(exp(u));
41  }
42 
43  }
44 }
45 
46 #endif
fvar< T > log1m_inv_logit(const fvar< T > &x)
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
fvar< T > log1p(const fvar< T > &x)
Definition: log1p.hpp:16

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