Automatic Differentiation
 
Loading...
Searching...
No Matches
beta.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BETA_HPP
2#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BETA_HPP
3#ifdef STAN_OPENCL
4
6#include <string>
7
8namespace stan {
9namespace math {
10namespace opencl_kernels {
11// \cond
12static constexpr const char* beta_device_function
13 = "\n"
14 "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BETA\n"
15 "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BETA\n" STRINGIFY(
16 // \endcond
25 double beta(double a, double b) {
26 return exp(lgamma(a) + lgamma(b) - lgamma(a + b));
27 }
28 // \cond
29 ) "\n#endif\n"; // NOLINT
30// \endcond
31
32} // namespace opencl_kernels
33} // namespace math
34} // namespace stan
35
36#endif
37#endif
double beta(double a, double b)
Return the beta function applied to the specified arguments.
Definition beta.hpp:25
fvar< T > lgamma(const fvar< T > &x)
Return the natural logarithm of the gamma function applied to the specified argument.
Definition lgamma.hpp:21
fvar< T > exp(const fvar< T > &x)
Definition exp.hpp:13
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
#define STRINGIFY(...)
Definition stringify.hpp:9