Automatic Differentiation
 
Loading...
Searching...
No Matches
lgamma_stirling.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LGAMMA_STIRLING_HPP
2#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LGAMMA_STIRLING_HPP
3#ifdef STAN_OPENCL
4
6#include <string>
7
8namespace stan {
9namespace math {
10namespace opencl_kernels {
11
12// \cond
13static constexpr const char* lgamma_stirling_device_function
14 = "\n"
15 "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LGAMMA_STIRLING\n"
16 "#define "
17 "STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LGAMMA_STIRLING\n" STRINGIFY(
18 // \endcond
30 double lgamma_stirling(double x) {
31 return 0.5 * (M_LN2 + log(M_PI)) + (x - 0.5) * log(x) - x;
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 lgamma_stirling(double x)
Return the Stirling approximation to the lgamma function.
fvar< T > log(const fvar< T > &x)
Definition log.hpp:18
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
#define STRINGIFY(...)
Definition stringify.hpp:9