SSJ
3.3.1
Stochastic Simulation in Java
|
This class implements exponential random variate generators using numerical inversion of the exponential density as described in [44] . More...
Public Member Functions | |
ExponentialInverseFromDensityGen (RandomStream stream, double lambda, double ueps, int order) | |
Creates an exponential random variate generator with parameter \(\lambda\) = lambda , using stream stream . More... | |
ExponentialInverseFromDensityGen (RandomStream stream, ExponentialDist dist, double ueps, int order) | |
Similar to the above constructor, with the exponential distribution dist . | |
ExponentialInverseFromDensityGen (RandomStream stream, InverseDistFromDensity dist) | |
Creates a new exponential generator using the exponential distribution dist and stream stream . More... | |
double | getUepsilon () |
Returns the \(u\)-resolution ueps . | |
int | getOrder () |
Returns the order of the interpolating polynomial. | |
Public Member Functions inherited from ExponentialGen | |
ExponentialGen (RandomStream s, double lambda) | |
Creates an exponential random variate generator with parameter \(\lambda\) = lambda , using stream s . | |
ExponentialGen (RandomStream s, ExponentialDist dist) | |
Creates a new generator for the exponential distribution dist and stream s . | |
double | getLambda () |
Returns the \(\lambda\) associated with this object. | |
Public Member Functions inherited from RandomVariateGen | |
RandomVariateGen (RandomStream s, Distribution dist) | |
Creates a new random variate generator from the distribution dist , using stream s . More... | |
double | nextDouble () |
Generates a random number from the continuous distribution contained in this object. More... | |
void | nextArrayOfDouble (double[] v, int start, int n) |
Generates n random numbers from the continuous distribution contained in this object. More... | |
double [] | nextArrayOfDouble (int n) |
Generates n random numbers from the continuous distribution contained in this object, and returns them in a new array of size n . More... | |
RandomStream | getStream () |
Returns the umontreal.ssj.rng.RandomStream used by this generator. More... | |
void | setStream (RandomStream stream) |
Sets the umontreal.ssj.rng.RandomStream used by this generator to stream . | |
Distribution | getDistribution () |
Returns the umontreal.ssj.probdist.Distribution used by this generator. More... | |
String | toString () |
Returns a String containing information about the current generator. | |
Additional Inherited Members | |
Static Public Member Functions inherited from ExponentialGen | |
static double | nextDouble (RandomStream s, double lambda) |
Uses inversion to generate a new exponential variate with parameter \(\lambda= \) lambda , using stream s . | |
Protected Member Functions inherited from ExponentialGen | |
void | setParams (double lam) |
Sets the parameter \(\lambda= \) lam of this object. | |
Protected Attributes inherited from ExponentialGen | |
double | lambda |
Protected Attributes inherited from RandomVariateGen | |
RandomStream | stream |
Distribution | dist |
This class implements exponential random variate generators using numerical inversion of the exponential density as described in [44] .
It makes use of the class umontreal.ssj.probdist.InverseDistFromDensity. Generating exponential random variables by inversion usually requires the computation of a logarithm for each generated random number. Numerical inversion precomputes a set of tables that will speed up the generation of random variables. This is useful if one wants to generate a large number of random variables.
ExponentialInverseFromDensityGen | ( | RandomStream | stream, |
double | lambda, | ||
double | ueps, | ||
int | order | ||
) |
Creates an exponential random variate generator with parameter \(\lambda\) = lambda
, using stream stream
.
It uses numerical inversion with precomputed tables. The \(u\)-resolution ueps
is the desired absolute error in the cdf
, and order
is the degree of the Newton interpolating polynomial over each interval.
ExponentialInverseFromDensityGen | ( | RandomStream | stream, |
InverseDistFromDensity | dist | ||
) |
Creates a new exponential generator using the exponential distribution dist
and stream stream
.
dist
may be obtained by calling method getDistribution, after using one of the other constructors to create the precomputed tables. This is useful when one needs many generators using the same exponential distribution (same \(\lambda\)). Precomputing tables for numerical inversion is costly; thus using only one set of tables for many generators is more efficient. The first ExponentialInverseFromDensityGen generator using the other constructors creates the precomputed tables. Then all other streams use this constructor with the same set of tables.