umontreal.iro.lecuyer.randvarmulti
Class DirichletGen
- java.lang.Object
-
- umontreal.iro.lecuyer.randvarmulti.RandomMultivariateGen
-
- umontreal.iro.lecuyer.randvarmulti.DirichletGen
-
public class DirichletGen extends RandomMultivariateGen
ExtendsRandomMultivariateGenfor a Dirichlet distribution. This distribution uses the parameters α1,..., αk, and has densityf (x1,…, xk) = Γ(α0)∏i=1kxiαi-1 / ∏i=1kΓ(αi))where α0 = ∑i=1kαi.Here, the successive coordinates of the Dirichlet vector are generated via the class
GammaAcceptanceRejectionGenin package randvar, using the same stream for all the uniforms.
-
-
Constructor Summary
Constructors Constructor and Description DirichletGen(RandomStream stream, double[] alphas)Constructs a new Dirichlet generator with parameters αi+1 = alphas[i], for i = 0,…, k - 1, and the stream stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetAlpha(int i)Returns the αi+1 parameter for this Dirichlet generator.voidnextPoint(double[] p)Generates a point from the Dirichlet distribution.static voidnextPoint(RandomStream stream, double[] alphas, double[] p)Generates a new point from the Dirichlet distribution with parameters alphas, using the stream stream.-
Methods inherited from class umontreal.iro.lecuyer.randvarmulti.RandomMultivariateGen
getDimension, getStream, nextArrayOfPoints, setStream
-
-
-
-
Constructor Detail
-
DirichletGen
public DirichletGen(RandomStream stream, double[] alphas)
Constructs a new Dirichlet generator with parameters αi+1 = alphas[i], for i = 0,…, k - 1, and the stream stream.- Parameters:
stream- the random number stream used to generate uniforms.alphas- the αi parameters of the generated distribution.- Throws:
java.lang.IllegalArgumentException- if one αk is negative or 0.java.lang.NullPointerException- if any argument is null.
-
-
Method Detail
-
getAlpha
public double getAlpha(int i)
Returns the αi+1 parameter for this Dirichlet generator.- Parameters:
i- the index of the parameter.- Returns:
- the value of the parameter.
- Throws:
java.lang.ArrayIndexOutOfBoundsException- if i is negative or greater than or equal togetDimension.
-
nextPoint
public static void nextPoint(RandomStream stream, double[] alphas, double[] p)
Generates a new point from the Dirichlet distribution with parameters alphas, using the stream stream. The generated values are placed into p.- Parameters:
stream- the random number stream used to generate the uniforms.alphas- the αi parameters of the distribution, for i = 1,…, k.p- the array to be filled with the generated point.
-
nextPoint
public void nextPoint(double[] p)
Generates a point from the Dirichlet distribution.- Specified by:
nextPointin classRandomMultivariateGen- Parameters:
p- the array to be filled with the generated point.
-
-
DMelt 3.0 © DataMelt by jWork.ORG