summaryrefslogtreecommitdiff
path: root/flower/matdebug.cc
blob: 1c3df9dda143ec206ae70163e8f337663d9ed966 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#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
{
    String s("vector [");
#ifndef NDEBUG
    for (int i=0; i < dim(); i++) {
	s += String(dat[i], "%6f") + ' ';
    }
#endif
    s+="]";
    return s;
}


void
Vector::print() const
{
#ifndef NDEBUG
    *dout << *this<<'\n';
#endif
}