]> git.donarmstrong.com Git - lilypond.git/blob - flower/matrix-debug.cc
d47d019367a36a833bb73e6df15e91cc05352fac
[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--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #include "flower-debug.hh"
11 #include "matrix.hh"
12
13 String
14 Matrix::str () const
15 {
16   String s;
17 #ifndef NPRINT
18   Full_storage const * stor_c_l = dat_;
19   s = String ("matrix {");
20   for (int i=0; i< rows(); i++)
21     {
22       for (int j = 0; j < cols(); j++) 
23         {
24           s+= to_str (stor_c_l->elem (i,j), "%6f ");
25         }
26       s+="\n";
27     }
28   s+="}\n";
29 #endif
30   return s;
31 }
32
33
34 void
35 Matrix::print () const
36 {
37 #ifndef NPRINT
38   fdebug << *this;
39 #endif
40 }
41
42 String
43 Vector::str () const
44 {
45   String s;
46 #ifndef NPRINT
47   s = String ("vector (") + to_str (dim ()) + ") [";
48   for (int i=0; i < dim(); i++) 
49     {
50       s += to_str (dat[i], "%6f") + to_str (' ');
51     }
52   s += "]\n";
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 }