Automatic Differentiation
 
Loading...
Searching...
No Matches
log_inv_logit_diff.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT_DIFF_HPP
2#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT_DIFF_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_diff_device_function
14 = "\n"
15 "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT_DIFF\n"
16 "#define "
17 "STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT_"
18 "DIFF\n" STRINGIFY(
19 // \endcond
30 double log_inv_logit_diff(double x, double y) {
31 return x - log1p_exp(x) + log1m_exp(y - x) - log1p_exp(y);
32 }
33 // \cond
34 ) "\n#endif\n"; // NOLINT
35// \endcond
36
37} // namespace opencl_kernels
38} // namespace math
39} // namespace stan
40
41#endif
42#endif
double log1m_exp(double a)
Calculates the natural logarithm of one minus the exponential of the specified value without overflow...
Definition log1m_exp.hpp:31
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 log_inv_logit_diff(double x, double y)
Returns the natural logarithm of the difference of the inverse logits of the specified arguments.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
#define STRINGIFY(...)
Definition stringify.hpp:9