public class MultivariateNormalDistribution extends AbstractMultivariateRealDistribution
random
Constructor and Description |
---|
MultivariateNormalDistribution(double[] means,
double[][] covariances)
Creates a multivariate normal distribution with the given mean vector and
covariance matrix.
|
MultivariateNormalDistribution(double[] means,
double[][] covariances,
double singularMatrixCheckTolerance)
Creates a multivariate normal distribution with the given mean vector and
covariance matrix.
|
MultivariateNormalDistribution(RandomGenerator rng,
double[] means,
double[][] covariances)
Creates a multivariate normal distribution with the given mean vector and
covariance matrix.
|
MultivariateNormalDistribution(RandomGenerator rng,
double[] means,
double[][] covariances,
double singularMatrixCheckTolerance)
Creates a multivariate normal distribution with the given mean vector and
covariance matrix.
|
Modifier and Type | Method and Description |
---|---|
double |
density(double[] vals)
Returns the probability density function (PDF) of this distribution
evaluated at the specified point
x . |
RealMatrix |
getCovariances()
Gets the covariance matrix.
|
double[] |
getMeans()
Gets the mean vector.
|
double |
getSingularMatrixCheckTolerance()
Gets the current setting for the tolerance check used during singular checks before inversion
|
double[] |
getStandardDeviations()
Gets the square root of each element on the diagonal of the covariance
matrix.
|
double[] |
sample()
Generates a random value vector sampled from this distribution.
|
getDimension, reseedRandomGenerator, sample
public MultivariateNormalDistribution(double[] means, double[][] covariances) throws MathIllegalArgumentException
Note: this constructor will implicitly create an instance of
Well19937c
as random generator to be used for sampling only (see
sample()
and AbstractMultivariateRealDistribution.sample(int)
). In case no sampling is
needed for the created distribution, it is advised to pass null
as random generator via the appropriate constructors to avoid the
additional initialisation overhead.
means
- Vector of means.covariances
- Covariance matrix.MathIllegalArgumentException
- if the arrays length are
inconsistent.MathIllegalArgumentException
- if the eigenvalue decomposition cannot
be performed on the provided covariance matrix.MathIllegalArgumentException
- if any of the eigenvalues is
negative.public MultivariateNormalDistribution(double[] means, double[][] covariances, double singularMatrixCheckTolerance) throws MathIllegalArgumentException
Note: this constructor will implicitly create an instance of
Well19937c
as random generator to be used for sampling only (see
sample()
and AbstractMultivariateRealDistribution.sample(int)
). In case no sampling is
needed for the created distribution, it is advised to pass null
as random generator via the appropriate constructors to avoid the
additional initialisation overhead.
means
- Vector of means.covariances
- Covariance matrix.singularMatrixCheckTolerance
- Tolerance used during the singular matrix check before inversionMathIllegalArgumentException
- if the arrays length are
inconsistent.MathIllegalArgumentException
- if the eigenvalue decomposition cannot
be performed on the provided covariance matrix.MathIllegalArgumentException
- if any of the eigenvalues is
negative.public MultivariateNormalDistribution(RandomGenerator rng, double[] means, double[][] covariances)
rng
- Random Number Generator.means
- Vector of means.covariances
- Covariance matrix.MathIllegalArgumentException
- if the arrays length are
inconsistent.MathIllegalArgumentException
- if the eigenvalue decomposition cannot
be performed on the provided covariance matrix.MathIllegalArgumentException
- if any of the eigenvalues is
negative.public MultivariateNormalDistribution(RandomGenerator rng, double[] means, double[][] covariances, double singularMatrixCheckTolerance) throws MathIllegalArgumentException
rng
- Random Number Generator.means
- Vector of means.covariances
- Covariance matrix.singularMatrixCheckTolerance
- Tolerance used during the singular matrix check before inversionMathIllegalArgumentException
- if the arrays length are
inconsistent.MathIllegalArgumentException
- if the eigenvalue decomposition cannot
be performed on the provided covariance matrix.MathIllegalArgumentException
- if any of the eigenvalues is
negative.public double[] getMeans()
public RealMatrix getCovariances()
public double getSingularMatrixCheckTolerance()
public double density(double[] vals) throws MathIllegalArgumentException
x
. In general, the PDF is the
derivative of the cumulative distribution function. If the derivative
does not exist at x
, then an appropriate replacement should be
returned, e.g. Double.POSITIVE_INFINITY
, Double.NaN
, or
the limit inferior or limit superior of the difference quotient.vals
- Point at which the PDF is evaluated.x
.MathIllegalArgumentException
public double[] getStandardDeviations()
public double[] sample()
sample
in interface MultivariateRealDistribution
sample
in class AbstractMultivariateRealDistribution
Copyright © 2016-2022 CS GROUP. All rights reserved.