| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
log_inv_logit.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_INV_LOGIT_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LOG_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 log_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
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
stan::math::log1p
fvar< T > log1p(const fvar< T > &x)
Definition: log1p.hpp:16
stan::math::log_inv_logit
fvar< T > log_inv_logit(const fvar< T > &x)
Definition: log_inv_logit.hpp:15

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