From d564a6f16613985340040cc7ab0ffc371cbce3d1 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 20 Aug 2017 09:20:06 +0000 Subject: Added checks for K --- src/debug.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/debug.cpp (limited to 'src/debug.cpp') diff --git a/src/debug.cpp b/src/debug.cpp new file mode 100644 index 0000000..4e37538 --- /dev/null +++ b/src/debug.cpp @@ -0,0 +1,30 @@ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gsl/gsl_blas.h" +#include "gsl/gsl_cdf.h" +#include "gsl/gsl_eigen.h" +#include "gsl/gsl_linalg.h" +#include "gsl/gsl_matrix.h" +#include "gsl/gsl_vector.h" + +#include "debug.h" +#include "mathfunc.h" + +// Helper function called by macro validate_K(K, check) +void do_validate_K(const gsl_matrix *K, bool do_check, const char *__file, int __line) { + if (do_check) { + debug_msg("Validating K"); + if (!checkMatrixEigen(K)) warning_at_msg(__file,__line,"K has small or negative eigenvalues!"); + if (!isMatrixIllConditioned(K)) warning_at_msg(__file,__line,"K is ill conditioned!") if (!isMatrixSymmetric(K)) fail_at_msg(__file,__line,"K is not symmetric!" ); + if (!isMatrixPositiveDefinite(K)) fail_at_msg(__file,__line,"K is not positive definite!"); +; + } +} -- cgit v1.2.3