newmat9.cpp
Go to the documentation of this file.
1 
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 {
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 
void tDelete()
Definition: newmat4.cpp:786
ostream & operator<<(ostream &s, const BaseMatrix &X)
Definition: newmat9.cpp:35
double Real
Definition: include.h:307
GeneralMatrix * Evaluate(MatrixType mt=MatrixTypeUnSp)
Definition: newmat5.cpp:85
int Nrows() const
Definition: newmat.h:494
Real * data
Definition: newmatrc.h:51
int storage
Definition: newmatrc.h:48
Base of the matrix classes.
Definition: newmat.h:292
#define ios_format_flags
Definition: newmat9.cpp:32
The classes for matrices that can contain data are derived from this.
Definition: newmat.h:447
void Next()
Definition: newmatrc.h:161


kni
Author(s): Martin Günther
autogenerated on Fri Jun 7 2019 22:06:45