Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
log1m_inv_logit.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__FUNCTIONS__LOG1M_INV_LOGIT_HPP__
2 #define __STAN__MATH__FUNCTIONS__LOG1M_INV_LOGIT_HPP__
3 
4 #include <boost/math/tools/promotion.hpp>
5 
6 namespace stan {
7  namespace math {
8 
17  template <typename T>
18  inline typename boost::math::tools::promote_args<T>::type
19  log1m_inv_logit(const T u) {
20  using std::exp;
21  if (u > 0.0)
22  return -u - log1p(exp(-u)); // prevent underflow
23  return -log1p(exp(u));
24  }
25 
26  }
27 }
28 
29 #endif

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