]> git.donarmstrong.com Git - lilypond.git/blob - flower/matrix-debug.cc
release: 0.1.57
[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     {
23       for (int j = 0; j < cols(); j++) 
24         {
25           s+= String (stor_c_l->elem (i,j), "%6f ");
26         }
27       s+="\n";
28     }
29   s+="}\n";
30 #endif
31   return s;
32 }
33
34
35 void
36 Matrix::print() const
37 {
38 #ifndef NPRINT
39   fdebug << *this;
40 #endif
41 }
42
43 Vector::operator String() const
44 {
45   String s;
46 #ifndef NPRINT
47   s=String ("vector (") + dim () + ") [";
48   for (int i=0; i < dim(); i++) 
49     {
50       s += String (dat[i], "%6f") + String (' ');
51     }
52   s+="]";
53 #endif
54   return s;
55 }
56
57
58 void
59 Vector::print() const
60 {
61 #ifndef NDEBUG
62   fdebug << *this<<'\n';
63 #endif
64 }