[9434] | 1 | /// \ingroup newmat
|
---|
| 2 | ///@{
|
---|
| 3 |
|
---|
| 4 | /// \file newmat9.cpp
|
---|
| 5 | /// Output.
|
---|
| 6 |
|
---|
| 7 | // Copyright (C) 1991,2,3,4: R B Davies
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | #define WANT_FSTREAM
|
---|
| 11 |
|
---|
| 12 | #include "include.h"
|
---|
| 13 |
|
---|
| 14 | #include "newmat.h"
|
---|
| 15 | #include "newmatio.h"
|
---|
| 16 | #include "newmatrc.h"
|
---|
| 17 |
|
---|
| 18 | #ifdef use_namespace
|
---|
| 19 | namespace NEWMAT {
|
---|
| 20 | #endif
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | #ifdef DO_REPORT
|
---|
| 25 | #define REPORT { static ExeCounter ExeCount(__LINE__,9); ++ExeCount; }
|
---|
| 26 | #else
|
---|
| 27 | #define REPORT {}
|
---|
| 28 | #endif
|
---|
| 29 |
|
---|
| 30 | // for G++ 3.01
|
---|
| 31 | #ifndef ios_format_flags
|
---|
| 32 | #define ios_format_flags long
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | ostream& operator<<(ostream& s, const BaseMatrix& X)
|
---|
| 36 | {
|
---|
| 37 | GeneralMatrix* gm = ((BaseMatrix&)X).Evaluate(); operator<<(s, *gm);
|
---|
| 38 | gm->tDelete(); return s;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | ostream& operator<<(ostream& s, const GeneralMatrix& X)
|
---|
| 43 | {
|
---|
| 44 | MatrixRow mr((GeneralMatrix*)&X, LoadOnEntry);
|
---|
| 45 | int w = s.width(); int nr = X.Nrows(); ios_format_flags f = s.flags();
|
---|
| 46 | s.setf(ios::fixed, ios::floatfield);
|
---|
| 47 | for (int i=1; i<=nr; i++)
|
---|
| 48 | {
|
---|
| 49 | int skip = mr.skip; int storage = mr.storage;
|
---|
| 50 | Real* store = mr.data; skip *= w+1;
|
---|
| 51 | while (skip--) s << " ";
|
---|
| 52 | while (storage--) { s.width(w); s << *store++ << " "; }
|
---|
| 53 | // while (storage--) s << setw(w) << *store++ << " ";
|
---|
| 54 | mr.Next(); s << "\n";
|
---|
| 55 | }
|
---|
| 56 | s << flush; s.flags(f); return s;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | // include this stuff if you are using an old version of G++
|
---|
| 60 | // with an incomplete io library
|
---|
| 61 |
|
---|
| 62 | /*
|
---|
| 63 |
|
---|
| 64 | ostream& operator<<(ostream& os, Omanip_precision i)
|
---|
| 65 | { os.precision(i.x); return os; }
|
---|
| 66 |
|
---|
| 67 | Omanip_precision setprecision(int i) { return Omanip_precision(i); }
|
---|
| 68 |
|
---|
| 69 | ostream& operator<<(ostream& os, Omanip_width i)
|
---|
| 70 | { os.width(i.x); return os; }
|
---|
| 71 |
|
---|
| 72 | Omanip_width setw(int i) { return Omanip_width(i); }
|
---|
| 73 |
|
---|
| 74 | */
|
---|
| 75 |
|
---|
| 76 | #ifdef use_namespace
|
---|
| 77 | }
|
---|
| 78 | #endif
|
---|
| 79 |
|
---|
| 80 |
|
---|
| 81 | ///@}
|
---|