5#ifndef OPENFPM_NUMERICS_GAUSSIAN_HPP
6#define OPENFPM_NUMERICS_GAUSSIAN_HPP
11static double hermite_polynomial(
double x,
double sigma,
int order)
20 h = -x / (sigma * sigma);
23 h = (x*x - sigma*sigma) / (sigma*sigma*sigma*sigma);
26 std::cout <<
"Only gaussian derivatives of order 0, 1, and 2 implemented. Aborting..." << std::endl;
32template <
typename po
int_type>
33double gaussian_1D(
const point_type & x,
const double mu,
const double sigma)
35 const double pi = 3.14159265358979323846;
36 const double sqrt2pi = sqrt(2*pi);
38 double sum = (x - mu) * (x - mu) / (sigma*sigma);;
39 double normalization_factor = 1 / (sqrt2pi * sigma);
41 return normalization_factor * exp(-0.5 *
sum);
44template <
typename po
int_type>
45double gaussian(
const point_type & x,
const double mu,
const double sigma)
48 for(
int d=0; d<point_type::dims; d++)
50 g *= gaussian_1D(x.get(d), mu, sigma);
It model an expression expr1 + ... exprn.