From 0dd5f17a771e86d88548a06e6dd268075c89f123 Mon Sep 17 00:00:00 2001 From: fred Date: Fri, 11 Oct 1996 22:46:53 +0000 Subject: [PATCH] flower-1.0.2 --- flower/matdebug.cc | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 flower/matdebug.cc diff --git a/flower/matdebug.cc b/flower/matdebug.cc new file mode 100644 index 0000000000..5a31312386 --- /dev/null +++ b/flower/matdebug.cc @@ -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 +} -- 2.39.5