]> git.donarmstrong.com Git - lilypond.git/commitdiff
flower-1.0.2
authorfred <fred>
Fri, 11 Oct 1996 22:46:53 +0000 (22:46 +0000)
committerfred <fred>
Fri, 11 Oct 1996 22:46:53 +0000 (22:46 +0000)
flower/matdebug.cc [new file with mode: 0644]

diff --git a/flower/matdebug.cc b/flower/matdebug.cc
new file mode 100644 (file)
index 0000000..5a31312
--- /dev/null
@@ -0,0 +1,55 @@
+#include "dstream.hh"
+#include "matrix.hh"
+
+static Dstream *dout = new Dstream(0,0);
+
+void set_matrix_debug(Dstream&ds)
+{
+    dout = &ds;
+}
+
+Matrix::operator String() const
+{
+    String s("matrix {\n");
+#ifndef NPRINT
+    for (int i=0; i< rows(); i++){
+       for (int j = 0; j < cols(); j++) {
+           s+= String(dat->elem(i,j), "%6f ");
+       }
+       s+="\n";
+    }
+    s+="}\n";
+#endif
+    return s;
+}
+
+
+void
+Matrix::print() const
+{
+#ifndef NPRINT
+    *dout << *this;
+#endif
+}
+
+Vector::operator String() const
+{
+    int i=0;
+    String s("vector [");
+#ifndef NDEBUG
+    for (; i < dim(); i++) {
+       s += String(dat[i], "%6f") + ' ';
+    }
+#endif
+    s+="]";
+    return s;
+}
+
+
+void
+Vector::print() const
+{
+#ifndef NDEBUG
+    *dout << *this<<'\n';
+#endif
+}