LibRan
0.1
Pseudo-random number distribution generator
|
Call the associated functions for the given random variate distribution. More...
Go to the source code of this file.
Functions | |
double | LRd_RAN (LR_obj *o) |
LRd_RAN(LR_obj *o) - random variate generator. More... | |
double | LRd_PDF (LR_obj *o, double x) |
LRd_PDF(LR_obj *o, double x) - probability distribution function. More... | |
double | LRd_CDF (LR_obj *o, double x) |
LRd_CDF(LR_obj *o, double x) - cumulative distribution function. More... | |
float | LRf_RAN (LR_obj *o) |
LRf_RAN(LR_obj *o) - random variate generator. More... | |
float | LRf_PDF (LR_obj *o, float x) |
LRf_PDF(LR_obj *o, float x) - probability distribution function. More... | |
float | LRf_CDF (LR_obj *o, float x) |
LRf_CDF(LR_obj *o, float x) - cumulative distribution function. More... | |
int | LRi_RAN (LR_obj *o) |
LRi_RAN(LR_obj *o) - random variate generator. More... | |
float | LRi_PDF (LR_obj *o, int x) |
LRi_PDF(LR_obj *o, int x) - probability distribution function. More... | |
float | LRi_CDF (LR_obj *o, int x) |
LRi_CDF(LR_obj *o, int x) - cumulative distribution function. More... | |
int | LR_aux_new (LR_obj *o, int n) |
LR_aux_new(LR_obj *o, int n) - initialize a new auxiliary object. More... | |
int | LR_aux_rm (LR_obj *o) |
LR_aux_rm(LR_obj *o) - remove the auxiliary object. More... | |
int | LR_aux_set (LR_obj *o, double x, double p) |
LR_aux_set(LR_obj *o, double x, double p) - add an interval boundary for the underlying distribution. More... | |
int | LR_aux_norm (LR_obj *o) |
LR_aux_norm(LR_obj *o) - process given intervals and normalize values. More... | |
Call the associated functions for the given random variate distribution.
These routines are the generic function calls. They use the the distribution and generation functions defined for the given random variate distribution, so the programmer need not remember the exact function name when making calls to the distribution functions or the random variate generater.
Also using these routines instead of calling the associated specific functions allows one to quickly switch from one random variate distribution to another without making any programmatic changes.
These routines call the associated PDF, CDF, RAN functions given in the LR_obj
object as specified by the LR_type
and LR_data_type
.
There are also generic auxiliary functions: new, rm, set, and norm. The auxiliary methods are not dependent on the LR_data_type
, but only on the LR_type
and only if they are necessary for the given random variate distribution.
The current set of auxiliary functions are needed for the piecewise uniform (LR_type
-> piece) and the linear spline distributions (LR_type
-> lspline). The auxiliary object will be created when the LR_obj
is created.
Use these functions instead of the distribution specific versions. These functions are safe to call from any other distribution, but will return an error which can be ignored if the value returned is equal to LRerr_NoAuxiliaryObject
.
Definition in file LRdf.c.
int LR_aux_new | ( | LR_obj * | o, |
int | n | ||
) |
LR_aux_new(LR_obj *o, int n) - initialize a new auxiliary object.
The generic method for creating a new auxiliary object for those random variate distributions that need it. Can be called otherwise but raises an ignorable error.
o | LR_obj object |
n | maxiumum number of intervals |
int LR_aux_norm | ( | LR_obj * | o | ) |
LR_aux_norm(LR_obj *o) - process given intervals and normalize values.
The generic method for normalizing the given intervals for the auxiliary object for those random variate distributions that need it. Can be called otherwise but raises an ignorable error.
o | LR_obj object |
int LR_aux_rm | ( | LR_obj * | o | ) |
LR_aux_rm(LR_obj *o) - remove the auxiliary object.
The generic method for removing or deallocating an auxiliary object for those random variate distributions that need it. Can be called otherwise but raises an ignorable error.
o | LR_obj object |
int LR_aux_set | ( | LR_obj * | o, |
double | x, | ||
double | p | ||
) |
LR_aux_set(LR_obj *o, double x, double p) - add an interval boundary for the underlying distribution.
The generic method for adding an interval boundary for an auxiliary object for those random variate distributions that need it. Can be called otherwise but raises an ignorable error.
o | LR_obj object |
x | interval boundary to add |
p | relative probablity for interval greater than x |
double LRd_CDF | ( | LR_obj * | o, |
double | x | ||
) |
LRd_CDF(LR_obj *o, double x) - cumulative distribution function.
This method will call the specific random variate cumulative distribution function as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |
x | value |
double LRd_PDF | ( | LR_obj * | o, |
double | x | ||
) |
LRd_PDF(LR_obj *o, double x) - probability distribution function.
This method will call the specific random variate probability distribution function as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |
x | value |
double LRd_RAN | ( | LR_obj * | o | ) |
LRd_RAN(LR_obj *o) - random variate generator.
This method will call the specific random variate generator as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |
float LRf_CDF | ( | LR_obj * | o, |
float | x | ||
) |
LRf_CDF(LR_obj *o, float x) - cumulative distribution function.
This method will call the specific random variate cumulative distribution function as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |
x | value |
float LRf_PDF | ( | LR_obj * | o, |
float | x | ||
) |
LRf_PDF(LR_obj *o, float x) - probability distribution function.
This method will call the specific random variate probability distribution function as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |
x | value |
float LRf_RAN | ( | LR_obj * | o | ) |
LRf_RAN(LR_obj *o) - random variate generator.
This method will call the specific random variate generator as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |
float LRi_CDF | ( | LR_obj * | o, |
int | x | ||
) |
LRi_CDF(LR_obj *o, int x) - cumulative distribution function.
This method will call the specific random variate cumulative distribution function as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |
x | value |
float LRi_PDF | ( | LR_obj * | o, |
int | x | ||
) |
LRi_PDF(LR_obj *o, int x) - probability distribution function.
This method will call the specific random variate probability distribution function as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |
x | value |
int LRi_RAN | ( | LR_obj * | o | ) |
LRi_RAN(LR_obj *o) - random variate generator.
This method will call the specific random variate generator as determined by the object's LR_type
and LR_data_type
. Note that using the wrong data type will return a NAN and raise an error.
o | LR_obj object |