aboutsummaryrefslogtreecommitdiff
path: root/src/debug.cpp
diff options
context:
space:
mode:
authorPjotr Prins2018-08-30 16:19:08 +0000
committerPjotr Prins2018-08-30 16:19:08 +0000
commit5ddd1c8e54d7ac7026a689152392d70e68b77cb4 (patch)
treec1475b62827a3c686a5d979fdf285522abc1826d /src/debug.cpp
parentb8e755fee4856c0b84fe91396f48ff350d5ca0c5 (diff)
downloadpangemma-5ddd1c8e54d7ac7026a689152392d70e68b77cb4.tar.gz
Debugging calcPab
Diffstat (limited to 'src/debug.cpp')
-rw-r--r--src/debug.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/debug.cpp b/src/debug.cpp
index 37e4e8a..8df4334 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -148,6 +148,31 @@ void disable_segfpe() {
#endif
}
+void write(const gsl_vector *v, const char *msg) {
+ if (msg) cout << "// " << msg << endl;
+ cout << "// vector size: " << v->size << endl;
+ cout << "double " << msg << "[] = {";
+ for (size_t i=0; i < v->size; i++) {
+ cout << gsl_vector_get(v,i) << ",";
+ }
+ cout << "}" << endl;
+}
+
+void write(const gsl_matrix *m, const char *msg) {
+ if (msg) cout << "// " << msg << endl;
+ cout << "// matrix size: " << m->size1 << " cols, " << m->size2 << " rows" << endl;
+ cout << "double " << msg << "[] = {";
+ for (size_t j=0; j < m->size2; j++) {
+ for (size_t i=0; i < m->size1; i++) {
+ // cout << "(" << i << "," << j << ")";
+ cout << gsl_matrix_safe_get(m,i,j);
+ cout << ",";
+ }
+ cout << "// row " << j << endl;
+ }
+ cout << "}" << endl;
+}
+
/*
Helper function to make sure gsl allocations do their job because
gsl_matrix_alloc does not initiatize values (behaviour that changed