SSJ
V. 2.6.

umontreal.iro.lecuyer.randvar
Class UnuranEmpirical

java.lang.Object
  extended by umontreal.iro.lecuyer.randvar.RandomVariateGen
      extended by umontreal.iro.lecuyer.randvar.UnuranEmpirical

public class UnuranEmpirical
extends RandomVariateGen

This class permits one to create generators for empirical and quasi-empirical univariate distributions using UNURAN via its string interface. The empirical data can be read from a file, from an array, or simply encoded into the generator specification string. When reading from a file or an array, the generator specification string must not contain a distribution specification string.


Constructor Summary
UnuranEmpirical(RandomStream s, PiecewiseLinearEmpiricalDist dist, String genStr)
          Same as UnuranEmpirical(s, s, dist, genStr).
UnuranEmpirical(RandomStream s, RandomStream aux, PiecewiseLinearEmpiricalDist dist, String genStr)
          Same as UnuranEmpirical(s, aux, genStr), but reading the observations from the empirical distribution dist.
UnuranEmpirical(RandomStream s, RandomStream aux, String genStr)
          Constructs a new empirical univariate generator using the specification string genStr, with main stream s and auxiliary stream aux.
UnuranEmpirical(RandomStream s, String genStr)
          Constructs a new empirical univariate generator using the specification string genStr and stream s.
 
Method Summary
 RandomStream getAuxStream()
          Returns the auxiliary random number stream.
 Distribution getDistribution()
          Returns the Distribution used by this generator.
 RandomStream getStream()
          Returns the RandomStream used by this generator.
 void nextArrayOfDouble(double[] v, int start, int n)
          Generates n random numbers from the continuous distribution contained in this object.
 double nextDouble()
          Generates a random number from the continuous distribution contained in this object.
 
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
setStream, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnuranEmpirical

public UnuranEmpirical(RandomStream s,
                       String genStr)
Constructs a new empirical univariate generator using the specification string genStr and stream s.


UnuranEmpirical

public UnuranEmpirical(RandomStream s,
                       RandomStream aux,
                       String genStr)
Constructs a new empirical univariate generator using the specification string genStr, with main stream s and auxiliary stream aux.


UnuranEmpirical

public UnuranEmpirical(RandomStream s,
                       PiecewiseLinearEmpiricalDist dist,
                       String genStr)
Same as UnuranEmpirical(s, s, dist, genStr).


UnuranEmpirical

public UnuranEmpirical(RandomStream s,
                       RandomStream aux,
                       PiecewiseLinearEmpiricalDist dist,
                       String genStr)
Same as UnuranEmpirical(s, aux, genStr), but reading the observations from the empirical distribution dist. The genStr argument must not contain a distribution part because the distribution will be generated from the input stream reader.

Method Detail

nextDouble

public double nextDouble()
Description copied from class: RandomVariateGen
Generates a random number from the continuous distribution contained in this object. By default, this method uses inversion by calling the inverseF method of the distribution object. Alternative generating methods are provided in subclasses.

Overrides:
nextDouble in class RandomVariateGen
Returns:
the generated value

nextArrayOfDouble

public void nextArrayOfDouble(double[] v,
                              int start,
                              int n)
Description copied from class: RandomVariateGen
Generates n random numbers from the continuous distribution contained in this object. These numbers are stored in the array v, starting from index start. By default, this method calls nextDouble() n times, but one can override it in subclasses for better efficiency.

Overrides:
nextArrayOfDouble in class RandomVariateGen
Parameters:
v - array in which the variates will be stored
start - starting index, in v, of the new variates
n - number of variates to generate

getDistribution

public Distribution getDistribution()
Description copied from class: RandomVariateGen
Returns the Distribution used by this generator.

Overrides:
getDistribution in class RandomVariateGen
Returns:
the distribution associated to that object

getStream

public RandomStream getStream()
Description copied from class: RandomVariateGen
Returns the RandomStream used by this generator.

Overrides:
getStream in class RandomVariateGen
Returns:
the stream associated to this object

getAuxStream

public RandomStream getAuxStream()
Returns the auxiliary random number stream.


SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.