Extends MultinormalGen for a multivariate normal distribution. More...
Public Member Functions | |
| 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. | |
| DoubleMatrix2D | getCholeskyDecompSigma () |
| Returns the lower-triangular matrix \(\mathbf{A}\) in the Cholesky decomposition of \(\boldsymbol{\Sigma}\). | |
| void | setSigma (DoubleMatrix2D sigma) |
| Sets the covariance matrix \(\boldsymbol{\Sigma}\) of this multinormal generator to sigma (and recomputes \(\mathbf{A}\)). | |
| void | nextPoint (double[] p) |
| Generates a point from this multinormal distribution. | |
| Public Member Functions inherited from umontreal.ssj.randvarmulti.MultinormalGen | |
| MultinormalGen (NormalGen gen1, int d) | |
| Constructs a generator with the standard multinormal distribution (with \(\boldsymbol{\mu}=\boldsymbol{0}\) and. | |
| 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. | |
| 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. | |
| DoubleMatrix2D | getSigma () |
| Returns the covariance matrix \(\boldsymbol{\Sigma}\) used by this generator. | |
| Public Member Functions inherited from umontreal.ssj.randvarmulti.RandomMultivariateGen | |
| void | nextArrayOfPoints (double[][] v, int start, int n) |
| Generates \(n\) random points. | |
| int | getDimension () |
| Returns the dimension of this multivariate generator (the dimension of the random points). | |
| RandomStream | getStream () |
| Returns the umontreal.ssj.rng.RandomStream used by this object. | |
| void | setStream (RandomStream stream) |
| Sets the umontreal.ssj.rng.RandomStream used by this object to stream. | |
Static Public Member Functions | |
| 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 \(\mathbf{Z}\), and using the Cholesky decomposition of \(\boldsymbol{\Sigma}\). | |
Additional Inherited Members | |
| Protected Member Functions inherited from umontreal.ssj.randvarmulti.MultinormalGen | |
| MultinormalGen (NormalGen gen1, double[] mu, DoubleMatrix2D sigma) | |
| Constructs a multinormal generator with mean vector mu and covariance matrix sigma. | |
| MultinormalGen (NormalGen gen1, double[] mu, double[][] sigma) | |
Equivalent to MultinormalGen(gen1, mu, new DenseDoubleMatrix2D (sigma)). | |
Extends MultinormalGen for a multivariate normal distribution.
[94] , generated via a Cholesky decomposition of the covariance matrix. The covariance matrix \(\boldsymbol{\Sigma}\) is decomposed (by the constructor) as \(\boldsymbol{\Sigma}= \mathbf{A}\mathbf{A}^{\!\mathsf{t}}\) where \(\mathbf{A}\) is a lower-triangular matrix (this is the Cholesky decomposition), and \(\mathbf{X}\) is generated via
\[ \mathbf{X}= \boldsymbol{\mu}+ \mathbf{A}\mathbf{Z}, \]
where \(\mathbf{Z}\) is a \(d\)-dimensional vector of independent standard normal random variates, and \(\mathbf{A}^{\!\mathsf{t}}\) is the transpose of \(\mathbf{A}\). The covariance matrix \(\boldsymbol{\Sigma}\) must be positive-definite, otherwise the Cholesky decomposition will fail. The decomposition method uses the CholeskyDecomposition class in colt.
Definition at line 54 of file MultinormalCholeskyGen.java.
| umontreal.ssj.randvarmulti.MultinormalCholeskyGen.MultinormalCholeskyGen | ( | NormalGen | gen1, |
| double[] | mu, | ||
| double | sigma[][] ) |
Equivalent to MultinormalCholeskyGen(gen1, mu, new DenseDoubleMatrix2D(sigma)).
| gen1 | the one-dimensional generator |
| mu | 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. |
Definition at line 79 of file MultinormalCholeskyGen.java.
| umontreal.ssj.randvarmulti.MultinormalCholeskyGen.MultinormalCholeskyGen | ( | NormalGen | gen1, |
| double[] | mu, | ||
| DoubleMatrix2D | sigma ) |
Constructs a multinormal generator with mean vector mu and covariance matrix sigma.
The mean vector must have the same length as the dimensions of the covariance matrix, which must be symmetric and positive-definite. If any of the above conditions is violated, an exception is thrown. The vector \(\mathbf{Z}\) is generated by calling \(d\) times the generator gen1, which must be a standard normal 1-dimensional generator.
| gen1 | the one-dimensional generator |
| mu | 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. |
Definition at line 100 of file MultinormalCholeskyGen.java.
| DoubleMatrix2D umontreal.ssj.randvarmulti.MultinormalCholeskyGen.getCholeskyDecompSigma | ( | ) |
Returns the lower-triangular matrix \(\mathbf{A}\) in the Cholesky decomposition of \(\boldsymbol{\Sigma}\).
Definition at line 111 of file MultinormalCholeskyGen.java.
| void umontreal.ssj.randvarmulti.MultinormalCholeskyGen.nextPoint | ( | double[] | p | ) |
Generates a point from this multinormal distribution.
This is much faster than the static method as it computes the singular value decomposition matrix only once in the constructor.
| p | the array to be filled with the generated point |
Reimplemented from umontreal.ssj.randvarmulti.MultinormalGen.
Definition at line 200 of file MultinormalCholeskyGen.java.
|
static |
Equivalent to nextPoint(gen1, mu, new DenseDoubleMatrix2D(sigma), p).
Definition at line 137 of file MultinormalCholeskyGen.java.
|
static |
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 \(\mathbf{Z}\), and using the Cholesky decomposition of \(\boldsymbol{\Sigma}\).
The resulting vector is put into p. Note that this static method will be very slow for large dimensions, since it computes the Cholesky decomposition at every call. It is therefore recommended to use a MultinormalCholeskyGen object instead, if the method is to be called more than once.
| p | the array to be filled with the generated point. |
| IllegalArgumentException | if the one-dimensional normal generator uses a normal distribution with \(\mu\) not equal to 0, or \(\sigma\) 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`. |
Definition at line 163 of file MultinormalCholeskyGen.java.
| void umontreal.ssj.randvarmulti.MultinormalCholeskyGen.setSigma | ( | DoubleMatrix2D | sigma | ) |
Sets the covariance matrix \(\boldsymbol{\Sigma}\) of this multinormal generator to sigma (and recomputes \(\mathbf{A}\)).
| sigma | the new covariance matrix. |
| IllegalArgumentException | if `sigma` has incorrect dimensions. |
Definition at line 122 of file MultinormalCholeskyGen.java.