Automatic Differentiation
 
Loading...
Searching...
No Matches
log_inv_logit.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_LOG_INV_LOGIT_HPP
2#define STAN_MATH_PRIM_FUN_LOG_INV_LOGIT_HPP
3
8#include <cmath>
9
10namespace stan {
11namespace math {
12
34inline double log_inv_logit(double u) {
35 using std::exp;
36 if (u < 0.0) {
37 return u - log1p_exp(u); // prevent underflow
38 }
39 return -log1p_exp(-u);
40}
41
49inline double log_inv_logit(int u) {
50 return log_inv_logit(static_cast<double>(u));
51}
52
65 template <typename T>
66 static inline auto fun(const T& x) {
67 return log_inv_logit(x);
68 }
69};
70
81template <typename T,
84inline auto log_inv_logit(const T& x) {
86}
87
88} // namespace math
89} // namespace stan
90
91#endif
require_not_t< is_nonscalar_prim_or_rev_kernel_expression< std::decay_t< T > > > require_not_nonscalar_prim_or_rev_kernel_expression_t
Require type does not satisfy is_nonscalar_prim_or_rev_kernel_expression.
require_not_t< is_var_matrix< std::decay_t< T > > > require_not_var_matrix_t
Require type does not satisfy is_var_matrix.
fvar< T > log_inv_logit(const fvar< T > &x)
fvar< T > log1p_exp(const fvar< T > &x)
Definition log1p_exp.hpp:14
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
static auto fun(const T &x)
Return the natural logarithm of the inverse logit of the specified argument.
Structure to wrap log_inv_logit() so it can be vectorized.