Package org.ejml.dense.row
Class CovarianceOps_FDRM
java.lang.Object
org.ejml.dense.row.CovarianceOps_FDRM
Contains operations specific to covariance matrices.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
invert
(FMatrixRMaj cov) Performs a matrix inversion operations that takes advantage of the special properties of a covariance matrix.static boolean
invert
(FMatrixRMaj cov, FMatrixRMaj cov_inv) Performs a matrix inversion operations that takes advantage of the special properties of a covariance matrix.static int
isValid
(FMatrixRMaj cov) Performs a variety of tests to see if the provided matrix is a valid covariance matrix, performing the fastest checks first.static boolean
isValidFast
(FMatrixRMaj cov) This is a fairly light weight check to see of a covariance matrix is valid.static void
randomVector
(FMatrixRMaj cov, FMatrixRMaj vector, Random rand) Sets vector to a random value based upon a zero-mean multivariate Gaussian distribution with covariance 'cov'.
-
Field Details
-
TOL
public static float TOL
-
-
Method Details
-
isValidFast
This is a fairly light weight check to see of a covariance matrix is valid. It checks to see if the diagonal elements are all positive, which they should be if it is valid. Not all invalid covariance matrices will be caught by this method.- Returns:
- true if valid and false if invalid
-
isValid
Performs a variety of tests to see if the provided matrix is a valid covariance matrix, performing the fastest checks first.- Returns:
- 0 = is valid 1 = failed: has negative diagonals, 2 = failed: not symmetry, 3 = failed: not semi positive definite
-
invert
Performs a matrix inversion operations that takes advantage of the special properties of a covariance matrix.- Parameters:
cov
- On input it is a covariance matrix, on output it is the inverse. Modified.- Returns:
- true if it could invert the matrix false if it could not.
-
invert
Performs a matrix inversion operations that takes advantage of the special properties of a covariance matrix.- Parameters:
cov
- A covariance matrix. Not modified.cov_inv
- The inverse of cov. Modified.- Returns:
- true if it could invert the matrix false if it could not.
-
randomVector
Sets vector to a random value based upon a zero-mean multivariate Gaussian distribution with covariance 'cov'. If repeat calls are made to this class, consider usingCovarianceRandomDraw_FDRM
instead.- Parameters:
cov
- The distirbutions covariance. Not modified.vector
- The random vector. Modified.rand
- Random number generator.
-