Automatic Differentiation
 
Loading...
Searching...
No Matches
log_inv_logit.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT_HPP
2#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT_HPP
3#ifdef STAN_OPENCL
4
6#include <string>
7
8namespace stan {
9namespace math {
10namespace opencl_kernels {
11
12// \cond
13static constexpr const char* log_inv_logit_device_function
14 = "\n"
15 "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT\n"
16 "#define "
17 "STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT\n" STRINGIFY(
18 // \endcond
28 double log_inv_logit(double x) {
29 if (x < 0.0) {
30 return x - log1p_exp(x); // prevent underflow
31 }
32 return -log1p_exp(-x);
33 }
34 // \cond
35 ) "\n#endif\n"; // NOLINT
36// \endcond
37
38} // namespace opencl_kernels
39} // namespace math
40} // namespace stan
41
42#endif
43#endif
double log_inv_logit(double x)
Return the natural logarithm of the inverse logit of the specified argument.
double log1p_exp(double a)
Calculates the log of 1 plus the exponential of the specified value without overflow.
Definition log1p_exp.hpp:28
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
#define STRINGIFY(...)
Definition stringify.hpp:9