5#ifndef IPPL_NORMAL_DISTRIBUTION_H
6#define IPPL_NORMAL_DISTRIBUTION_H
24 return 0.5 * (1 + Kokkos::erf((x - mean) / (stddev * Kokkos::sqrt(2.0))));
37 const T pi = Kokkos::numbers::pi_v<T>;
38 return (1.0 / (stddev * Kokkos::sqrt(2 *
pi)))
39 * Kokkos::exp(-(x - mean) * (x - mean) / (2 * stddev * stddev));
53 return mean + 0. * u * stddev;
67 KOKKOS_INLINE_FUNCTION
double operator()(
T x,
unsigned int d,
const T* params_p)
const {
68 T mean = params_p[2 * d + 0];
69 T stddev = params_p[2 * d + 1];
85 KOKKOS_INLINE_FUNCTION
double operator()(
T x,
unsigned int d,
T const* params_p)
const {
86 T mean = params_p[2 * d + 0];
87 T stddev = params_p[2 * d + 1];
100 template <
typename T>
102 KOKKOS_INLINE_FUNCTION
double operator()(
T u,
unsigned int d,
T const* params_p)
const {
103 T mean = params_p[2 * d + 0];
104 T stddev = params_p[2 * d + 1];
109 template <
typename T>
115 const T* params_p)
const {
116 T mean = params_p[2 * d + 0];
117 T stddev = params_p[2 * d + 1];
126 const T* params_p)
const {
127 T mean = params_p[2 * d + 0];
128 T stddev = params_p[2 * d + 1];
136 T const* params_p)
const {
137 T mean = params_p[2 * d + 0];
138 T stddev = params_p[2 * d + 1];
148 template <
typename T,
unsigned Dim>
KOKKOS_FUNCTION T normal_estimate_func(T u, T mean, T stddev)
An estimator for the initial guess that is used in Newton-Raphson method of Inverste Transfrom Sampli...
KOKKOS_FUNCTION T normal_pdf_func(T x, T mean, T stddev)
Calculate the probability density function (PDF) for a normal distribution.
KOKKOS_FUNCTION T normal_cdf_func(T x, T mean, T stddev)
Calculate the cumulative distribution function (CDF) for a normal distribution.
The class that represents a distribution.
KOKKOS_INLINE_FUNCTION Distribution(const T *par_p)
Functor to calculate the cumulative distribution function (CDF) for a normal distribution.
KOKKOS_INLINE_FUNCTION double operator()(T x, unsigned int d, const T *params_p) const
Functor to calculate the probability density function (PDF) for a normal distribution.
KOKKOS_INLINE_FUNCTION double operator()(T x, unsigned int d, T const *params_p) const
Functor to estimate the initial guess for sampling normal distribution.
KOKKOS_INLINE_FUNCTION double operator()(T u, unsigned int d, T const *params_p) const
KOKKOS_INLINE_FUNCTION double operator()(T x, unsigned int d, const T *params_p) const
KOKKOS_INLINE_FUNCTION double operator()(T x, unsigned int d, const T *params_p) const
KOKKOS_INLINE_FUNCTION double operator()(T u, unsigned int d, T const *params_p) const
KOKKOS_INLINE_FUNCTION NormalDistribution(const T *par_p)
Constructor for the Normal Distribution class. The constructor takes an array of parameters of normal...