Function cmb_random_hyperexponential
Defined in File cmb_random.h
Function Documentation
-
double cmb_random_hyperexponential(unsigned n, const double *ma, const double *pa)
Hyperexponential on
[0, oo), choosing and samples one ofnexponential distributions. Assumes thatpasums to 1.0.The probability of selecting distribution
iisp_arr[i], the mean of that distribution isma[i]. The overall mean is the sum ofpa[i] * ma[i].Uses a simple O(n) implementation. If
nis large and speed is important, consider using O(1) Vose alias sampling to select the distribution instead of this function.See also https://en.wikipedia.org/wiki/Hyperexponential_distribution