1 #include <goofit/PDFs/basic/GaussianPdf.h>
5 __device__ fptype device_Gaussian(fptype *evt, fptype *p, unsigned int *indices) {
6 fptype x = evt[RO_CACHE(indices[2 + RO_CACHE(indices[0])])];
7 fptype mean = RO_CACHE(p[RO_CACHE(indices[1])]);
8 fptype sigma = RO_CACHE(p[RO_CACHE(indices[2])]);
10 fptype ret = exp(-0.5 * (x - mean) * (x - mean) / (sigma * sigma));
15 __device__ device_function_ptr ptr_to_Gaussian = device_Gaussian;
17 __host__ GaussianPdf::GaussianPdf(std::string n, Observable _x, Variable mean, Variable sigma)
19 std::vector<unsigned int> pindices;
20 pindices.push_back(registerParameter(mean));
21 pindices.push_back(registerParameter(sigma));
22 GET_FUNCTION_ADDR(ptr_to_Gaussian);
26 __host__ fptype GaussianPdf::integrate(fptype lo, fptype hi) const {
27 static const fptype rootPi = sqrt(atan2(0.0, -1.0));
29 unsigned int *indices = host_indices + parameters;
31 // Integral over all R.
32 fptype sigma = host_params[indices[2]];
33 sigma *= root2 * rootPi;