Automatic Differentiation
 
Loading...
Searching...
No Matches
log1m_inv_logit.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M_INV_LOGIT_HPP
2#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M_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* log1m_inv_logit_device_function
14 = "\n"
15 "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M_INV_LOGIT\n"
16 "#define "
17 "STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M_INV_LOGIT\n" STRINGIFY(
18 // \endcond
41 inline double log1m_inv_logit(double x) {
42 if (x > 0.0) {
43 return -x - log1p_exp(-x); // prevent underflow
44 }
45 return -log1p_exp(x);
46 }
47 // \cond
48 ) "\n#endif\n"; // NOLINT
49// \endcond
50
51} // namespace opencl_kernels
52} // namespace math
53} // namespace stan
54
55#endif
56#endif
double log1p_exp(double a)
Calculates the log of 1 plus the exponential of the specified value without overflow.
Definition log1p_exp.hpp:28
double log1m_inv_logit(double x)
Return the the natural logarithm of 1 minus the inverse logit applied to the kernel generator express...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
#define STRINGIFY(...)
Definition stringify.hpp:9