22 #ifndef __MLPACK_METHODS_GMM_POSITIVE_DEFINITE_CONSTRAINT_HPP
23 #define __MLPACK_METHODS_GMM_POSITIVE_DEFINITE_CONSTRAINT_HPP
42 if (det(covariance) <= 1e-50)
44 Log::Debug <<
"Covariance matrix is not positive definite. Adding "
45 <<
"perturbation." << std::endl;
47 double perturbation = 1e-30;
48 while (det(covariance) <= 1e-50)
50 covariance.diag() += perturbation;
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.