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;