|
SSJ V. 1.2.5. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.randvarmulti.RandomMultiVariateGen
umontreal.iro.lecuyer.randvarmulti.MultiNormalGen
public class MultiNormalGen
Extends RandomMultiVariateGen
for a
multivariate normal distribution.
For a mean vector
μ∈Rd and a
symmetric positive-definite covariance
matrix
Σ,
X∈Rd has the
d-dimensional multivariate normal distribution
N(μ, Σ) with density
In the two-dimensionnal case, assuming mean μ = [μ1, μ2], variances var [X] = σ12, var [Y] = σ22 such that σ1 > 0, σ2 > 0 and correlation ρ, we have
Constructor Summary | |
---|---|
MultiNormalGen(NormalGen gen1,
double[] mu,
double[][] sigma)
Equivalent to MultiNormalGen (gen1, mu, new DenseDoubleMatrix2D (sigma)). |
|
MultiNormalGen(NormalGen gen1,
double[] mu,
DoubleMatrix2D sigma)
Constructs a multinormal generator with mean vector mu and covariance matrix sigma, using the one-dimensional normal generator gen1. |
|
MultiNormalGen(NormalGen gen1,
int d)
Constructs a standard d-dimensional multinormal generator, using the one-dimensional generator gen1. |
Method Summary | |
---|---|
DoubleMatrix2D |
getCholeskyDecompSigma()
Returns the Cholesky decomposition of the covariance matrix used for generating the vectors. |
double[] |
getMu()
Returns the mean vector used by this generator. |
double |
getMu(int i)
Returns the i-th component of the mean vector for this generator. |
DoubleMatrix2D |
getSigma()
Returns the covariance matrix Σ used by this generator. |
void |
nextPoint(double[] p)
Generates a point from the multinormal distribution. |
static void |
nextPoint(NormalGen gen1,
double[] mu,
double[][] sigma,
double[] p)
Equivalent to nextPoint (gen1, mu, new DenseDoubleMatrix2D (sigma), p). |
static void |
nextPoint(NormalGen gen1,
double[] mu,
DoubleMatrix2D sigma,
double[] p)
Generates a point from the multinormal distribution with mean vector mu, and covariance matrix sigma, using the one-dimensional normal generator gen1. |
void |
setMu(double[] mu)
Sets the mean vector to mu. |
void |
setMu(int i,
double mui)
Sets the i-th component of the mean vector to mui. |
void |
setSigma(DoubleMatrix2D sigma)
Sets the covariance matrix of this multinormal generator to sigma. |
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 |
---|
public MultiNormalGen(NormalGen gen1, int d)
gen1
- the one-dimensional generatord
- the dimension of the generated vectors
IllegalArgumentException
- if the one-dimensional normal
generator uses a normal distribution with μ not equal to 0, or
σ not equal to 1.
IllegalArgumentException
- if d
is negative.
NullPointerException
- if gen1 is null.public MultiNormalGen(NormalGen gen1, double[] mu, DoubleMatrix2D sigma)
gen1
- the one-dimensional generatormu
- the mean vector.sigma
- the covariance matrix.
NullPointerException
- if any argument is null.
IllegalArgumentException
- if the length of the mean
vector is incompatible with the dimensions of the covariance matrix.public MultiNormalGen(NormalGen gen1, double[] mu, double[][] sigma)
MultiNormalGen
(gen1, mu, new DenseDoubleMatrix2D (sigma)).
Method Detail |
---|
public double[] getMu()
public double getMu(int i)
i
- the index of the required component.
ArrayIndexOutOfBoundsException
- if
i is negative or greater than or equal to getDimension
.public void setMu(double[] mu)
mu
- the new mean vector.
NullPointerException
- if mu is null.
IllegalArgumentException
- if the length of mu
does not correspond to getDimension
.public void setMu(int i, double mui)
i
- the index of the modified component.mui
- the new value of μi.
ArrayIndexOutOfBoundsException
- if i
is negative or greater than or equal to getDimension
.public DoubleMatrix2D getSigma()
public DoubleMatrix2D getCholeskyDecompSigma()
public void setSigma(DoubleMatrix2D sigma)
sigma
- the new covariance matrix.
IllegalArgumentException
- if sigma has
incorrect dimensions.public static void nextPoint(NormalGen gen1, double[] mu, DoubleMatrix2D sigma, double[] p)
p
- the array to be filled with the generated point.
IllegalArgumentException
- if the one-dimensional normal
generator uses a normal distribution with μ not equal to 0, or
σ not equal to 1.
IllegalArgumentException
- if the length of the mean
vector is different from the dimensions of the covariance matrix,
or if the covariance matrix is not symmetric and positive-definite.
NullPointerException
- if any argument is null.public static void nextPoint(NormalGen gen1, double[] mu, double[][] sigma, double[] p)
nextPoint
(gen1, mu, new DenseDoubleMatrix2D (sigma), p).
public void nextPoint(double[] p)
nextPoint
in class RandomMultiVariateGen
p
- the array to be filled with the generated point
|
SSJ V. 1.2.5. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |