]> git.donarmstrong.com Git - lilypond.git/blob - flower/matrix-debug.cc
release: 0.0.78
[lilypond.git] / flower / matrix-debug.cc
1 /*
2   matrix-debug.cc -- implement Matrix print routines
3
4   source file of the Flower Library
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #include "flower-debug.hh"
11 #include "matrix.hh"
12 #include "matrix-storage.hh"
13
14
15 Matrix::operator String() const
16 {
17     String s;
18 #ifndef NPRINT
19     Matrix_storage const * stor_c_l = dat;
20     s=String("matrix { (")  + dat->name() + ")\n";
21     for (int i=0; i< rows(); i++){
22         for (int j = 0; j < cols(); j++) {
23             s+= String(stor_c_l->elem(i,j), "%6f ");
24         }
25         s+="\n";
26     }
27     s+="}\n";
28 #endif
29     return s;
30 }
31
32
33 void
34 Matrix::print() const
35 {
36 #ifndef NPRINT
37     fdebug << *this;
38 #endif
39 }
40
41 Vector::operator String() const
42 {
43     String s;
44 #ifndef NPRINT
45     s="vector [";
46     for (int i=0; i < dim(); i++) {
47         s += String(dat[i], "%6f") + String(' ');
48     }
49     s+="]";
50 #endif
51     return s;
52 }
53
54
55 void
56 Vector::print() const
57 {
58 #ifndef NDEBUG
59     fdebug << *this<<'\n';
60 #endif
61 }