public class CorrelatedRandomVectorGenerator extends java.lang.Object implements java.io.Serializable, RandomVectorGenerator
Random vectors with correlated components are built by combining the uncorrelated components of another random vector in such a way the resulting correlations are the ones specified by a positive definite covariance matrix.
Sometimes, the covariance matrix for a given simulation is not
strictly positive definite. This means that the correlations are
not all independant from each other. In this case, however, the non
strictly positive elements found during the Cholesky decomposition
of the covariance matrix should not be negative either, they
should be null. This implies that rather than computing C =
L.Lt where C is the covariance matrix and
L is a lower-triangular matrix, we compute C =
B.Bt where B is a rectangular matrix having
more rows than columns. The number of columns of B is
the rank of the covariance matrix, and it is the dimension of the
uncorrelated random vector that is needed to compute the component
of the correlated vector. This class does handle this situation
automatically.
| Constructor and Description |
|---|
CorrelatedRandomVectorGenerator(double[] mean,
SymetricalMatrix covariance,
NormalizedRandomGenerator generator)
Simple constructor.
|
CorrelatedRandomVectorGenerator(SymetricalMatrix covariance,
NormalizedRandomGenerator generator)
Simple constructor.
|
| Modifier and Type | Method and Description |
|---|---|
NormalizedRandomGenerator |
getGenerator()
Get the underlying normalized components generator.
|
int |
getRank()
Get the rank of the covariance matrix.
|
Matrix |
getRootMatrix()
Get the root of the covariance matrix.
|
double[] |
nextVector()
Generate a correlated random vector.
|
public CorrelatedRandomVectorGenerator(double[] mean,
SymetricalMatrix covariance,
NormalizedRandomGenerator generator)
throws NotPositiveDefiniteMatrixException
Build a correlated random vector generator from its mean vector and covariance matrix.
mean - expected mean values for all componentscovariance - covariance matrixgenerator - underlying generator for uncorrelated normalized
componentsjava.lang.IllegalArgumentException - if there is a dimension
mismatch between the mean vector and the covariance matrixNotPositiveDefiniteMatrixException - if the
covariance matrix is not strictly positive definitepublic CorrelatedRandomVectorGenerator(SymetricalMatrix covariance, NormalizedRandomGenerator generator) throws NotPositiveDefiniteMatrixException
Build a null mean random correlated vector generator from its covariance matrix.
covariance - covariance matrixgenerator - underlying generator for uncorrelated normalized
componentsNotPositiveDefiniteMatrixException - if the
covariance matrix is not strictly positive definitepublic Matrix getRootMatrix()
B such that B.Bt
is equal to the covariance matrixpublic NormalizedRandomGenerator getGenerator()
public int getRank()
public double[] nextVector()
nextVector in interface RandomVectorGeneratorCopyright © 2001-2007 Luc Maisonobe. All Rights Reserved.