Skip to main content

Laplace Distribution

Name

UxHwDoubleLaplaceDist, UxHwFloatLaplaceDist Create a Laplace distribution.

Synopsis

#include <uxhw.h>

double UxHwDoubleLaplaceDist(double mu, double b);
float UxHwFloatLaplaceDist(float mu, float b);

Description

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

f(x;μ,b)=12bexμ/b.f(x;\mu, b)=\frac{1}{2b}e^{-\left|x-\mu\right|/b}.

Parameters

  • mu The location parameter (μ\mu) of the Laplace distribution.
  • b The scale parameter (b) of the Laplace distribution.

Return Values

The UxHwDoubleLaplaceDist() function returns the mean of samples of a Laplace distribution with parameters mu and b. If b < 0, the function returns NaN.

  Examples

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

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

return 0;
}