aboutsummaryrefslogtreecommitdiff
path: root/src/debug.cpp
diff options
context:
space:
mode:
authorPeter Carbonetto2017-08-21 10:31:26 -0500
committerGitHub2017-08-21 10:31:26 -0500
commitaea3d24c680778cf1691a8c2a76f3221e7f373d6 (patch)
tree8a1ba0770e2344469c58290d4192db186d9439cb /src/debug.cpp
parent85797beb24da3d591a79fddcff4ab48d702b465f (diff)
parent2e76646998df0ca1b7d160329c0f3ac8cdda2fe0 (diff)
downloadpangemma-aea3d24c680778cf1691a8c2a76f3221e7f373d6.tar.gz
Merge pull request #73 from genenetwork/merge-checkK
Check K and added unit test framework.
Diffstat (limited to 'src/debug.cpp')
-rw-r--r--src/debug.cpp30
1 files changed, 30 insertions, 0 deletions
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 <cmath>
+#include <cstring>
+#include <ctime>
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <sys/stat.h>
+#include <vector>
+
+#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!");
+;
+ }
+}