SSJ
V. 1.2.5.

umontreal.iro.lecuyer.randvarmulti
Class DirichletGen

java.lang.Object
  extended by umontreal.iro.lecuyer.randvarmulti.RandomMultiVariateGen
      extended by umontreal.iro.lecuyer.randvarmulti.DirichletGen

public class DirichletGen
extends RandomMultiVariateGen

Extends RandomMultiVariateGen for a Dirichlet distribution. This distribution uses the parameters αi, i = 1,…, k, and has density

f (x1,…, xk) = $\displaystyle {\frac{{\Gamma(\alpha_0)\htprod_{i=1}^k x_i^{\alpha_i - 1}}}{{\htprod_{i=1}^k \Gamma(\alpha_i)}}}$

where α0 = ∑i=1kαi.


Constructor Summary
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
 double getAlpha(int i)
          Returns the αi+1 parameter for this Dirichlet generator.
 void nextPoint(double[] p)
          Generates a point from the Dirichlet distribution.
static void nextPoint(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, getGen1, getStream, nextArrayOfPoints, setGen1, setStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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:
IllegalArgumentException - if one αk is negative or 0.
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:
ArrayIndexOutOfBoundsException - if i is negative or greater than or equal to getDimension.

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 copied 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:
nextPoint in class RandomMultiVariateGen
Parameters:
p - the array to be filled with the generated point.

SSJ
V. 1.2.5.

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