umontreal.iro.lecuyer.randvar
Class GammaAcceptanceRejectionGen
- java.lang.Object
-
- umontreal.iro.lecuyer.randvar.RandomVariateGen
-
- umontreal.iro.lecuyer.randvar.GammaGen
-
- umontreal.iro.lecuyer.randvar.GammaAcceptanceRejectionGen
-
public class GammaAcceptanceRejectionGen extends GammaGen
This class implements gamma random variate generators using a method that combines acceptance-rejection with acceptance-complement. It uses acceptance-rejection for α < 1 and acceptance-complement for α >= 1. For each gamma variate, the first uniform required is taken from the main stream and all additional uniforms (after the first rejection) are obtained from the auxiliary stream.
-
-
Constructor Summary
Constructors Constructor and Description GammaAcceptanceRejectionGen(RandomStream s, double alpha, double lambda)Creates a gamma random variate generator with parameters α = alpha and λ = lambda, using stream s.GammaAcceptanceRejectionGen(RandomStream s, GammaDist dist)Creates a new generator object for the gamma distribution dist and stream s for both the main and auxiliary stream.GammaAcceptanceRejectionGen(RandomStream s, RandomStream aux, double alpha, double lambda)Creates a gamma random variate generator with parameters α = alpha and λ = lambda, using main stream s and auxiliary stream aux.GammaAcceptanceRejectionGen(RandomStream s, RandomStream aux, GammaDist dist)Creates a new generator object for the gamma distribution dist, using main stream s and auxiliary stream aux.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description RandomStreamgetAuxStream()Returns the auxiliary stream associated with this object.doublenextDouble()Generates a random number from the continuous distribution contained in this object.static doublenextDouble(RandomStream s, double alpha, double lambda)Same as nextDouble (s, s, alpha, lambda).static doublenextDouble(RandomStream s, RandomStream aux, double alpha, double lambda)Generates a new gamma variate with parameters α = alpha and λ = lambda, using main stream s and auxiliary stream aux.-
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
getDistribution, getStream, nextArrayOfDouble, setStream, toString
-
-
-
-
Constructor Detail
-
GammaAcceptanceRejectionGen
public GammaAcceptanceRejectionGen(RandomStream s, RandomStream aux, double alpha, double lambda)
Creates a gamma random variate generator with parameters α = alpha and λ = lambda, using main stream s and auxiliary stream aux. The auxiliary stream is used when a random number of uniforms is required for a rejection-type generation method.
-
GammaAcceptanceRejectionGen
public GammaAcceptanceRejectionGen(RandomStream s, double alpha, double lambda)
Creates a gamma random variate generator with parameters α = alpha and λ = lambda, using stream s.
-
GammaAcceptanceRejectionGen
public GammaAcceptanceRejectionGen(RandomStream s, RandomStream aux, GammaDist dist)
Creates a new generator object for the gamma distribution dist, using main stream s and auxiliary stream aux. The auxiliary stream is used when a random number of uniforms is required for a rejection-type generation method.
-
GammaAcceptanceRejectionGen
public GammaAcceptanceRejectionGen(RandomStream s, GammaDist dist)
Creates a new generator object for the gamma distribution dist and stream s for both the main and auxiliary stream.
-
-
Method Detail
-
getAuxStream
public RandomStream getAuxStream()
Returns the auxiliary stream associated with this object.
-
nextDouble
public static double nextDouble(RandomStream s, RandomStream aux, double alpha, double lambda)
Generates a new gamma variate with parameters α = alpha and λ = lambda, using main stream s and auxiliary stream aux.
-
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
-
nextDouble
public static double nextDouble(RandomStream s, double alpha, double lambda)
Same as nextDouble (s, s, alpha, lambda).
-
-
DMelt 3.0 © DataMelt by jWork.ORG