Automatic Differentiation
 
Loading...
Searching...
No Matches
Phi.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_PHI_HPP
2#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_PHI_HPP
3#ifdef STAN_OPENCL
4
6#include <string>
7
8namespace stan {
9namespace math {
10namespace opencl_kernels {
11// \cond
12static constexpr const char* phi_device_function
13 = "\n"
14 "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_PHI\n"
15 "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_PHI\n" STRINGIFY(
16 // \endcond
23 inline double Phi(double x) {
24 if (x < -37.5) {
25 return 0;
26 } else if (x < -5.0) {
27 return 0.5 * erfc(-M_SQRT1_2 * x);
28 } else if (x > 8.25) {
29 return 1;
30 } else {
31 return 0.5 * (1.0 + erf(M_SQRT1_2 * x));
32 }
33 }
34 // \cond
35 ) "\n#endif\n"; // NOLINT
36// \endcond
37
38} // namespace opencl_kernels
39} // namespace math
40} // namespace stan
41
42#endif
43#endif
double Phi(double x)
Return the Phi function applied to the specified argument.
Definition Phi.hpp:23
fvar< T > erf(const fvar< T > &x)
Definition erf.hpp:15
fvar< T > erfc(const fvar< T > &x)
Definition erfc.hpp:15
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
#define STRINGIFY(...)
Definition stringify.hpp:9