diff options
author | Pjotr Prins | 2018-08-30 16:19:08 +0000 |
---|---|---|
committer | Pjotr Prins | 2018-08-30 16:19:08 +0000 |
commit | 5ddd1c8e54d7ac7026a689152392d70e68b77cb4 (patch) | |
tree | c1475b62827a3c686a5d979fdf285522abc1826d /src/debug.cpp | |
parent | b8e755fee4856c0b84fe91396f48ff350d5ca0c5 (diff) | |
download | pangemma-5ddd1c8e54d7ac7026a689152392d70e68b77cb4.tar.gz |
Debugging calcPab
Diffstat (limited to 'src/debug.cpp')
-rw-r--r-- | src/debug.cpp | 25 |
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 |