public class MultinormalGen extends RandomMultivariateGen
RandomMultivariateGen for a
multivariate normal (or multinormal) distribution.
The d-dimensional multivariate normal distribution
with mean vector
μ∈Rd and (symmetric positive-definite)
covariance matrix
Σ, denoted
N(μ, Σ), has density
For the special case d = 2, if the random vector X = (X1, X2)t has a bivariate normal distribution, then it has mean μ = (μ1, μ2)t, and covariance matrix
]
| Constructor and Description |
|---|
MultinormalGen(NormalGen gen1,
int d)
Constructs a generator with the standard multinormal distribution
(with
μ = 0 and
Σ = I) in d dimensions.
|
| Modifier and Type | Method and Description |
|---|---|
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 this multinormal distribution.
|
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.
|
getDimension, getStream, nextArrayOfPoints, setStreampublic MultinormalGen(NormalGen gen1, int d)
gen1 - the one-dimensional generatord - the dimension of the generated vectorsjava.lang.IllegalArgumentException - if the one-dimensional normal
generator uses a normal distribution with μ not equal to 0, or
σ not equal to 1.java.lang.IllegalArgumentException - if d
is negative.java.lang.NullPointerException - if gen1 is null.public double[] getMu()
public double getMu(int i)
i - the index of the required component.java.lang.ArrayIndexOutOfBoundsException - if
i is negative or greater than or equal to getDimension.public void setMu(double[] mu)
mu - the new mean vector.java.lang.NullPointerException - if mu is null.java.lang.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.java.lang.ArrayIndexOutOfBoundsException - if i
is negative or greater than or equal to getDimension.public DoubleMatrix2D getSigma()
public void nextPoint(double[] p)
nextPoint in class RandomMultivariateGenp - the array to be filled with the generated pointTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.