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)=12be−∣x−μ∣/b.f(x;\mu, b)=\frac{1}{2b}e^{-\left|x-\mu\right|/b}.

Parameters​

  • mu ∈R\in \mathbb{R} — The location parameter (μ\mu) of the Laplace distribution.
  • b ∈[0,∞)\in [0, \infty) — The scale parameter (bb) of the Laplace distribution.

Return values​

The UxHwDoubleLaplaceDist() function returns the mean value of a Laplace distribution with parameters mu and b and associates it with a Laplace distribution with parameters mu and b. If b = 0, the function returns mu.

Illegal parameter values​

If b < 0, the function returns NaN. If mu or b is NaN, the function returns -NaN. See Handling of 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;
}