diff options
author | Pjotr Prins | 2018-09-07 10:13:42 +0000 |
---|---|---|
committer | Pjotr Prins | 2018-09-07 10:13:42 +0000 |
commit | 0dc693328dcbd660f9bdb823a8f7acf0d272caa8 (patch) | |
tree | 922cb6c68ac8570c748979665688492f87bc753d /src/mathfunc.cpp | |
parent | 2ac63853ba5a836a5e4477bad0c1c56f0fa1dfa8 (diff) | |
download | pangemma-0dc693328dcbd660f9bdb823a8f7acf0d272caa8.tar.gz |
Matrices positive definite issues
Diffstat (limited to 'src/mathfunc.cpp')
-rw-r--r-- | src/mathfunc.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mathfunc.cpp b/src/mathfunc.cpp index 542093e..8acbd52 100644 --- a/src/mathfunc.cpp +++ b/src/mathfunc.cpp @@ -104,7 +104,7 @@ bool is_float(const std::string & s){ } double safe_log(const double d) { - if (!is_legacy_mode() && !is_check_mode()) + if (!is_legacy_mode() && (is_check_mode() || is_debug_mode())) enforce_msg(d > 0.0, (std::string("Trying to take the log of ") + std::to_string(d)).c_str()); return log(d); } @@ -113,7 +113,7 @@ double safe_sqrt(const double d) { double d1 = d; if (fabs(d < 0.001)) d1 = fabs(d); - if (!is_legacy_mode() && !is_check_mode()) + if (!is_legacy_mode() && (is_check_mode() || is_debug_mode())) enforce_msg(d1 >= 0.0, (std::string("Trying to take the sqrt of ") + std::to_string(d)).c_str()); if (d1 < 0.0 ) return nan(""); @@ -354,7 +354,7 @@ tuple<double, double, double> abs_minmax(const gsl_vector *v) { bool has_negative_values_but_one(const gsl_vector *v) { bool one_skipped = false; for (size_t i=0; i<v->size; i++) { - if (v->data[i] < 0.0) { + if (v->data[i] < -EIGEN_MINVALUE) { if (one_skipped) return true; one_skipped = true; |