LibRan
0.1
Pseudo-random number distribution generator
|
The Cauchy (or Lorentz) distribution centered on m and width given by 2s. More...
Go to the source code of this file.
Functions | |
double | LRd_cauchy_RAN (LR_obj *o) |
LRd_cauchy_RAN(LR_obj *o) - double random Cauchy/Lorentz distribution using the inversion method on the CDF(x). Default values: peak m = 0, half width s = 1. More... | |
double | LRd_cauchymar_RAN (LR_obj *o) |
LRd_cauchymar_RAN(LR_obj *o) - double random Cauchy/Lorentz distribution using the polar method and the Marsagalia method and acceptance/rejection for generating a Gaussian/Normal variate. Default values: peak m = 0, half width s = 1. More... | |
double | LRd_cauchy_PDF (LR_obj *o, double x) |
LRd_cauchy_PDF(LR_obj *o, double x) - double Cauchy/Lorentz probablity distribution function. More... | |
double | LRd_cauchy_CDF (LR_obj *o, double x) |
LRd_cauchy_CDF(LR_obj *o, double x) - double Cauchy/Lorentz cumulative distribution function. More... | |
float | LRf_cauchy_RAN (LR_obj *o) |
LRf_cauchy_RAN(LR_obj *o) - float random Cauchy/Lorentz distribution using the inversion method. Default values: peak m = 0, half width s = 1. More... | |
float | LRf_cauchymar_RAN (LR_obj *o) |
LRf_cauchymar_RAN(LR_obj *o) - float random Cauchy/Lorentz distribution using the polar method and the Marsagalia method and acceptance/rejection for generating a Gaussian/Normal variate. Default values: peak m = 0, half width s = 1. More... | |
float | LRf_cauchy_PDF (LR_obj *o, float x) |
LRf_cauchy_PDF(LR_obj *o, float x) - float Cauchy/Lorentz probablity distribution function. More... | |
float | LRf_cauchy_CDF (LR_obj *o, float x) |
LRf_cauchy_CDF(LR_obj *o, float x) - float Cauchy/Lorentz cumulative distribution function. More... | |
The Cauchy (or Lorentz) distribution centered on m and width given by 2s.
The pseudo-random numbers are distributed from a Cauchy or Lorentz distribution. It's a pathological distribution where the mean and variance are undefined, but the distribution has a clear peak and width (given by m and 2s respectively).
The default is m = 0, s = 1; which is called the standard Cauchy distribution.
The second method uses the polar method, the Marsagalia method, and acceptance/rejection for generating a Gaussian/Normal variate - the ratio of the two independent variates gives the Cauchy-Lorentz distribution. However, it relies on acceptance/rejection to generate random variates confined to the unit circle centered on the origin with radius 1. This gives an acceptance ratio to be , but the only arithmetic operations, however, are couple of multiplications and a single division. This simplicity may be sufficient to overcome the time to generate rejected samples and the overall method may be competative in comparison to the first method.
Default values: peak m = 0, half width s = 1
Definition in file LRcauchy.c.
double LRd_cauchy_CDF | ( | LR_obj * | o, |
double | x | ||
) |
LRd_cauchy_CDF(LR_obj *o, double x) - double Cauchy/Lorentz cumulative distribution function.
o | LR_obj object |
x | value |
Definition at line 117 of file LRcauchy.c.
double LRd_cauchy_PDF | ( | LR_obj * | o, |
double | x | ||
) |
LRd_cauchy_PDF(LR_obj *o, double x) - double Cauchy/Lorentz probablity distribution function.
o | LR_obj object |
x | value |
Definition at line 103 of file LRcauchy.c.
double LRd_cauchy_RAN | ( | LR_obj * | o | ) |
LRd_cauchy_RAN(LR_obj *o) - double random Cauchy/Lorentz distribution using the inversion method on the CDF(x). Default values: peak m = 0, half width s = 1.
o | LR_obj object |
Definition at line 71 of file LRcauchy.c.
double LRd_cauchymar_RAN | ( | LR_obj * | o | ) |
LRd_cauchymar_RAN(LR_obj *o) - double random Cauchy/Lorentz distribution using the polar method and the Marsagalia method and acceptance/rejection for generating a Gaussian/Normal variate. Default values: peak m = 0, half width s = 1.
o | LR_obj object |
Definition at line 84 of file LRcauchy.c.
float LRf_cauchy_CDF | ( | LR_obj * | o, |
float | x | ||
) |
LRf_cauchy_CDF(LR_obj *o, float x) - float Cauchy/Lorentz cumulative distribution function.
o | LR_obj object |
x | value |
Definition at line 180 of file LRcauchy.c.
float LRf_cauchy_PDF | ( | LR_obj * | o, |
float | x | ||
) |
LRf_cauchy_PDF(LR_obj *o, float x) - float Cauchy/Lorentz probablity distribution function.
o | LR_obj object |
x | value |
Definition at line 166 of file LRcauchy.c.
float LRf_cauchy_RAN | ( | LR_obj * | o | ) |
LRf_cauchy_RAN(LR_obj *o) - float random Cauchy/Lorentz distribution using the inversion method. Default values: peak m = 0, half width s = 1.
o | LR_obj object |
Definition at line 134 of file LRcauchy.c.
float LRf_cauchymar_RAN | ( | LR_obj * | o | ) |
LRf_cauchymar_RAN(LR_obj *o) - float random Cauchy/Lorentz distribution using the polar method and the Marsagalia method and acceptance/rejection for generating a Gaussian/Normal variate. Default values: peak m = 0, half width s = 1.
o | LR_obj object |
Definition at line 147 of file LRcauchy.c.