Stan Math Library: stan/math/prim/scal/fun/log_inv_logit.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
Definition: log_sum_exp.hpp:8
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–2016, Stan Development Team.