From c21dfe50df1c1399190a7c5c100c5d0b14ab7ef8 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 28 Sep 2018 15:22:11 +0000 Subject: Fixes regression #179 --- src/lapack.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/lapack.cpp') diff --git a/src/lapack.cpp b/src/lapack.cpp index eb5b16b..31b6add 100644 --- a/src/lapack.cpp +++ b/src/lapack.cpp @@ -253,8 +253,10 @@ double EigenDecomp(gsl_matrix *G, gsl_matrix *U, gsl_vector *eval, return d; } -// Same as EigenDecomp but zeroes eigenvalues close to zero. When -// negative eigenvalues remain a warning is issued. +// Does NOT set eigenvalues to be positive. G gets destroyed. Returns +// eigen trace and values in U and eval (eigenvalues). Same as +// EigenDecomp but zeroes eigenvalues close to zero. When negative +// eigenvalues remain a warning is issued. double EigenDecomp_Zeroed(gsl_matrix *G, gsl_matrix *U, gsl_vector *eval, const size_t flag_largematrix) { EigenDecomp(G,U,eval,flag_largematrix); @@ -262,7 +264,8 @@ double EigenDecomp_Zeroed(gsl_matrix *G, gsl_matrix *U, gsl_vector *eval, int count_zero_eigenvalues = 0; int count_negative_eigenvalues = 0; for (size_t i = 0; i < eval->size; i++) { - if (std::abs(gsl_vector_get(eval, i)) < EIGEN_MINVALUE) + // if (std::abs(gsl_vector_get(eval, i)) < EIGEN_MINVALUE) + if (gsl_vector_get(eval, i) < 1e-10) gsl_vector_set(eval, i, 0.0); // checks if (gsl_vector_get(eval,i) == 0.0) -- cgit v1.2.3