14 #ifndef __MLPACK_METHODS_GMM_POSITIVE_DEFINITE_CONSTRAINT_HPP
15 #define __MLPACK_METHODS_GMM_POSITIVE_DEFINITE_CONSTRAINT_HPP
36 if (arma::det(covariance) <= 1e-50)
38 Log::Debug <<
"Covariance matrix is not positive definite. Adding "
39 <<
"perturbation." << std::endl;
41 double perturbation = 1e-30;
42 while (arma::det(covariance) <= 1e-50)
44 covariance.diag() += perturbation;
Linear algebra utility functions, generally performed on matrices or vectors.
static void ApplyConstraint(arma::mat &covariance)
Apply the positive definiteness constraint to the given covariance matrix.
static util::NullOutStream Debug
Dumps debug output into the bit nether regions.
Given a covariance matrix, force the matrix to be positive definite.