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