Skip to content

GSF ModeCalculator : Avoid an extra division for the gaus calculation

  • Avoids one divisions here
  double normalisation = 1. / sqrt(2. * M_PI);
  double z = (x - mean) / sigma;
  double result = normalisation / sigma * exp(-0.5 * z * z);

by getting the 1./sigma once

double invertsigma= 1./sigma;
double z = (x - mean) * invertsigma;
double result = (invsqrt2PI * invertsigma) * exp(-0.5 * z * z);

Merge request reports

Loading