umontreal.iro.lecuyer.randvar
Class UnuranEmpirical
- java.lang.Object
-
- umontreal.iro.lecuyer.randvar.RandomVariateGen
-
- 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
Constructors Constructor and Description UnuranEmpirical(RandomStream s, PiecewiseLinearEmpiricalDist dist, java.lang.String genStr)Same asUnuranEmpirical(s, s, dist, genStr).UnuranEmpirical(RandomStream s, RandomStream aux, PiecewiseLinearEmpiricalDist dist, java.lang.String genStr)Same asUnuranEmpirical(s, aux, genStr), but reading the observations from the empirical distribution dist.UnuranEmpirical(RandomStream s, RandomStream aux, java.lang.String genStr)Constructs a new empirical univariate generator using the specification string genStr, with main stream s and auxiliary stream aux.UnuranEmpirical(RandomStream s, java.lang.String genStr)Constructs a new empirical univariate generator using the specification string genStr and stream s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description RandomStreamgetAuxStream()Returns the auxiliary random number stream.DistributiongetDistribution()Returns theDistributionused by this generator.RandomStreamgetStream()Returns theRandomStreamused by this generator.voidnextArrayOfDouble(double[] v, int start, int n)Generates n random numbers from the continuous distribution contained in this object.doublenextDouble()Generates a random number from the continuous distribution contained in this object.-
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
setStream, toString
-
-
-
-
Constructor Detail
-
UnuranEmpirical
public UnuranEmpirical(RandomStream s, java.lang.String genStr)
Constructs a new empirical univariate generator using the specification string genStr and stream s.
-
UnuranEmpirical
public UnuranEmpirical(RandomStream s, RandomStream aux, java.lang.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, java.lang.String genStr)
Same asUnuranEmpirical(s, s, dist, genStr).
-
UnuranEmpirical
public UnuranEmpirical(RandomStream s, RandomStream aux, PiecewiseLinearEmpiricalDist dist, java.lang.String genStr)
Same asUnuranEmpirical(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:RandomVariateGenGenerates a random number from the continuous distribution contained in this object. By default, this method uses inversion by calling theinverseFmethod of the distribution object. Alternative generating methods are provided in subclasses.- Overrides:
nextDoublein classRandomVariateGen- Returns:
- the generated value
-
nextArrayOfDouble
public void nextArrayOfDouble(double[] v, int start, int n)Description copied from class:RandomVariateGenGenerates 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 callsnextDouble()n times, but one can override it in subclasses for better efficiency.- Overrides:
nextArrayOfDoublein classRandomVariateGen- Parameters:
v- array in which the variates will be storedstart- starting index, in v, of the new variatesn- number of variates to generate
-
getDistribution
public Distribution getDistribution()
Description copied from class:RandomVariateGenReturns theDistributionused by this generator.- Overrides:
getDistributionin classRandomVariateGen- Returns:
- the distribution associated to that object
-
getStream
public RandomStream getStream()
Description copied from class:RandomVariateGenReturns theRandomStreamused by this generator.- Overrides:
getStreamin classRandomVariateGen- Returns:
- the stream associated to this object
-
getAuxStream
public RandomStream getAuxStream()
Returns the auxiliary random number stream.
-
-
DMelt 3.0 © DataMelt by jWork.ORG