1#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BINOMIAL_COEFFICIENT_LOG_HPP
2#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BINOMIAL_COEFFICIENT_LOG_HPP
10namespace opencl_kernels {
13static constexpr const char* binomial_coefficient_log_device_function
16 "STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BINOMIAL_COEFFICIENT_LOG\n"
18 "STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BINOMIAL_COEFFICIENT_"
81 if (isnan(n) || isnan(k)) {
86 if (n > -1 && k > n / 2.0 + 1
e-8) {
90 double n_plus_1 = n + 1;
91 double n_plus_1_mk = n_plus_1 - k;
95 }
else if (n_plus_1 < LGAMMA_STIRLING_DIFF_USEFUL) {
double lbeta(double a, double b)
Return the log of the beta function applied to the specified arguments.
double binomial_coefficient_log(double n, double k)
Return the log of the binomial coefficient for the specified arguments.
static constexpr double e()
Return the base of the natural logarithm.
fvar< T > log1p(const fvar< T > &x)
fvar< T > lgamma(const fvar< T > &x)
Return the natural logarithm of the gamma function applied to the specified argument.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...