statalign.model.ext.plugins.structalign
Class MultiNormCholesky

java.lang.Object
  extended by statalign.model.ext.plugins.structalign.MultiNormCholesky

public class MultiNormCholesky
extends java.lang.Object

Adapted from org.apache.commons.math3.distribution.MultivariateNormalDistribution

Author:
Challis

Constructor Summary
MultiNormCholesky(double[] means, double[][] covariances)
          Creates a multivariate normal distribution with the given mean vector and covariance matrix.
 
Method Summary
 org.apache.commons.math3.linear.RealMatrix getCovariances()
          Gets the covariance matrix.
 double[] getMeans()
          Gets the mean vector.
 double logDensity(double[] vals)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiNormCholesky

public MultiNormCholesky(double[] means,
                         double[][] covariances)
                  throws org.apache.commons.math3.linear.SingularMatrixException,
                         org.apache.commons.math3.exception.DimensionMismatchException,
                         org.apache.commons.math3.linear.NonPositiveDefiniteMatrixException
Creates a multivariate normal distribution with the given mean vector and covariance matrix.
The number of dimensions is equal to the length of the mean vector and to the number of rows and columns of the covariance matrix. It is frequently written as "p" in formulae.

Parameters:
means - Vector of means.
covariances - Covariance matrix.
Throws:
org.apache.commons.math3.exception.DimensionMismatchException - if the arrays length are inconsistent.
org.apache.commons.math3.linear.SingularMatrixException - if the eigenvalue decomposition cannot be performed on the provided covariance matrix.
org.apache.commons.math3.linear.NonPositiveDefiniteMatrixException
Method Detail

getMeans

public double[] getMeans()
Gets the mean vector.

Returns:
the mean vector.

getCovariances

public org.apache.commons.math3.linear.RealMatrix getCovariances()
Gets the covariance matrix.

Returns:
the covariance matrix.

logDensity

public double logDensity(double[] vals)
                  throws org.apache.commons.math3.exception.DimensionMismatchException

Throws:
org.apache.commons.math3.exception.DimensionMismatchException