MOOS 0.2375
|
00001 //$$ newmat9.cpp Input and output 00002 00003 // Copyright (C) 1991,2,3,4: R B Davies 00004 00005 00006 #define WANT_STREAM 00007 00008 #include "include.h" 00009 00010 #include "newmat.h" 00011 #include "newmatio.h" 00012 #include "newmatrc.h" 00013 00014 #ifdef use_namespace 00015 namespace NEWMAT { 00016 #endif 00017 00018 00019 00020 #ifdef DO_REPORT 00021 #define REPORT { static ExeCounter ExeCount(__LINE__,9); ++ExeCount; } 00022 #else 00023 #define REPORT {} 00024 #endif 00025 00026 // for G++ 3.01 00027 #ifndef ios_format_flags 00028 #define ios_format_flags long 00029 #endif 00030 00031 using namespace std; 00032 00033 ostream& operator<<(ostream& s, const BaseMatrix& X) 00034 { 00035 GeneralMatrix* gm = ((BaseMatrix&)X).Evaluate(); operator<<(s, *gm); 00036 gm->tDelete(); return s; 00037 } 00038 00039 00040 ostream& operator<<(ostream& s, const GeneralMatrix& X) 00041 { 00042 MatrixRow mr((GeneralMatrix*)&X, LoadOnEntry); 00043 int w = s.width(); int nr = X.Nrows(); ios_format_flags f = s.flags(); 00044 s.setf(ios::fixed, ios::floatfield); 00045 for (int i=1; i<=nr; i++) 00046 { 00047 int skip = mr.skip; int storage = mr.storage; 00048 Real* store = mr.data; skip *= w+1; 00049 while (skip--) s << " "; 00050 while (storage--) { s.width(w); s << *store++ << " "; } 00051 // while (storage--) s << setw(w) << *store++ << " "; 00052 mr.Next(); s << "\n"; 00053 } 00054 s << flush; s.flags(f); return s; 00055 } 00056 00057 // include this stuff if you are using an old version of G++ 00058 // with an incomplete io library 00059 00060 /* 00061 00062 ostream& operator<<(ostream& os, Omanip_precision i) 00063 { os.precision(i.x); return os; } 00064 00065 Omanip_precision setprecision(int i) { return Omanip_precision(i); } 00066 00067 ostream& operator<<(ostream& os, Omanip_width i) 00068 { os.width(i.x); return os; } 00069 00070 Omanip_width setw(int i) { return Omanip_width(i); } 00071 00072 */ 00073 00074 #ifdef use_namespace 00075 } 00076 #endif 00077 00078