public class MultinormalCholeskyGen extends MultinormalGen
MultinormalGen for a multivariate normal distribution, generated via a Cholesky decomposition of the covariance
matrix. The covariance matrix
Σ is decomposed (by the constructor)
as
Σ = AAt where
A is a lower-triangular matrix
(this is the Cholesky decomposition), and
X is generated via
| Constructor and Description |
|---|
MultinormalCholeskyGen(NormalGen gen1,
double[] mu,
double[][] sigma)
Equivalent to
MultinormalCholeskyGen(gen1, mu, new DenseDoubleMatrix2D(sigma)). |
MultinormalCholeskyGen(NormalGen gen1,
double[] mu,
DoubleMatrix2D sigma)
Constructs a multinormal generator with mean vector mu
and covariance matrix sigma.
|
| Modifier and Type | Method and Description |
|---|---|
DoubleMatrix2D |
getCholeskyDecompSigma()
Returns the lower-triangular matrix
A in the
Cholesky decomposition of
Σ.
|
void |
nextPoint(double[] p)
Generates a point from this 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 d-dimensional vector from the multinormal
distribution with mean vector mu and covariance matrix
sigma, using the one-dimensional normal generator gen1 to
generate the coordinates of
Z, and using the Cholesky decomposition of
Σ.
|
void |
setSigma(DoubleMatrix2D sigma)
Sets the covariance matrix
Σ of this multinormal generator
to sigma (and recomputes
A).
|
getMu, getMu, getSigma, setMu, setMugetDimension, getStream, nextArrayOfPoints, setStreampublic MultinormalCholeskyGen(NormalGen gen1, double[] mu, double[][] sigma)
MultinormalCholeskyGen(gen1, mu, new DenseDoubleMatrix2D(sigma)).gen1 - the one-dimensional generatormu - the mean vector.sigma - the covariance matrix.java.lang.NullPointerException - if any argument is null.java.lang.IllegalArgumentException - if the length of the mean
vector is incompatible with the dimensions of the covariance matrix.public MultinormalCholeskyGen(NormalGen gen1, double[] mu, DoubleMatrix2D sigma)
gen1 - the one-dimensional generatormu - the mean vector.sigma - the covariance matrix.java.lang.NullPointerException - if any argument is null.java.lang.IllegalArgumentException - if the length of the mean
vector is incompatible with the dimensions of the covariance matrix.public DoubleMatrix2D getCholeskyDecompSigma()
public void setSigma(DoubleMatrix2D sigma)
sigma - the new covariance matrix.java.lang.IllegalArgumentException - if sigma has
incorrect dimensions.public static void nextPoint(NormalGen gen1, double[] mu, double[][] sigma, double[] p)
nextPoint(gen1, mu, new DenseDoubleMatrix2D(sigma), p).public static void nextPoint(NormalGen gen1, double[] mu, DoubleMatrix2D sigma, double[] p)
p - the array to be filled with the generated point.java.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 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.java.lang.NullPointerException - if any argument is null.public void nextPoint(double[] p)
nextPoint in class MultinormalGenp - the array to be filled with the generated pointTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.