diff --git a/src/shogun/distributions/classical/GaussianDistribution.cpp b/src/shogun/distributions/classical/GaussianDistribution.cpp index ae45d6a5c30..a09488fc087 100644 --- a/src/shogun/distributions/classical/GaussianDistribution.cpp +++ b/src/shogun/distributions/classical/GaussianDistribution.cpp @@ -41,28 +41,18 @@ CGaussianDistribution::CGaussianDistribution(SGVector mean, m_L=SGMatrix(cov.num_rows, cov.num_cols); Map eigen_L(m_L.matrix, m_L.num_rows, m_L.num_cols); - /* try to compute Cholesky and increase ridge on diagonal otherwise */ - LLT llt; - while (true) + /* compute cholesky */ + LLT llt(eigen_cov); + if (llt.info()==NumericalIssue) { - llt.compute(eigen_cov); - if (llt.info()==NumericalIssue) + /* try to compute smalles eigenvalue for information */ + SelfAdjointEigenSolver solver(eigen_cov); + if (solver.info() == Success) { - /* try to compute smalles eigenvalue for information */ - SelfAdjointEigenSolver solver(eigen_cov); - if (solver.info() == Success) - { - VectorXd ev=solver.eigenvalues(); - SG_WARNING("Error computing Cholesky of Gaussian's covariance. " - "Smallest Eigenvalue is %f. Increasing ridge by " - "%f\n", ev[0], CMath::abs(ev[0]))+1e-3; - - for (index_t i=0; i