From 99527865c00b74a3a48daa2e1e5eb7c71bd861b5 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 22 Aug 2017 07:56:07 +0000 Subject: Fixes matrix checks - looking saner now - Matrix checks as described in https://github.com/genetics-statistics/GEMMA/issues/72 - introduces -strict switch which will exit on certain conditions - zero small eigenvalues in EigenDecomp_Zeroed which also checks for negative values - commented out float versions of functions in lapack.cpp (pre-removal) - reverted on disabled regression tests (GEMMA shows its previous behaviour now) --- src/debug.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/debug.h') diff --git a/src/debug.h b/src/debug.h index 82dd245..f47cb4c 100644 --- a/src/debug.h +++ b/src/debug.h @@ -12,16 +12,21 @@ void gemma_gsl_error_handler (const char * reason, // Validation routines -void do_validate_K(const gsl_matrix *K, bool do_check, const char *__file, int __line); +void do_validate_K(const gsl_matrix *K, bool do_check, bool strict, const char *__file, int __line); #define ROUND(f) round(f * 10000.)/10000 -#define validate_K(K,check) do_validate_K(K,check,__FILE__,__LINE__) +#define validate_K(K,check,strict) do_validate_K(K,check,strict,__FILE__,__LINE__) #define warning_at_msg(__file,__line,msg) cerr << "**** WARNING: " << msg << " in " << __file << " at line " << __line << endl; -inline void fail_at_msg(const char *__file, int __line, const char *msg) { - std::cerr << "**** FAIL: " << msg << " in " << __file << " at line " << __line << std::endl; - exit(1); +inline void fail_at_msg(bool strict, const char *__file, int __line, const char *msg) { + if (strict) + std::cerr << "**** STRICT FAIL: "; + else + std::cerr << "**** WARNING: "; + std::cerr << msg << " in " << __file << " at line " << __line << std::endl; + if (strict) + exit(1); } #if defined NDEBUG -- cgit v1.2.3