Skip to main content

Gaussian Distribution

Name

UxHwDoubleGaussDist, UxHwFloatGaussDist Create a Gaussian distribution.

Synopsis

#include <uxhw.h>

double UxHwDoubleGaussDist(double mu, double sigma);
float UxHwFloatGaussDist(float mu, float sigma);

Description

The UxHwDoubleGaussDist() function, on architectures that associate distributional information with floating-point values, creates a Gaussian distribution with parameters mu and sigma and associates it with its return value. The particle return value is the mean value of a Gaussian distribution with parameters mu and sigma. The probability density function of the Gaussian distribution is

f(x;μ,σ)=1σ2πe12(xμσ)2.f(x;\mu,\sigma)=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2}\left({\frac{x-\mu}{\sigma}}\right)^2}.

Parameters

  • mu The mean value (μ\mu) of the Gaussian Distribution.
  • sigma The standard deviation (σ) of the Gaussian Distribution.

Return Values

The UxHwDoubleGaussDist() function returns the mean of samples of a Gaussian distribution with parameters mu and sigma. If sigma < 0, the function returns NaN.

  Examples

#include <stdio.h>
#include <uxhw.h>

int
main(void)
{
double value = UxHwDoubleGaussDist(0.0, 1.0);
printf("value = %lf\n", value);

return 0;
}