Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/newmat/newmat9.cpp @ 4639

Last change on this file since 4639 was 4565, checked in by patrick, 19 years ago

orxonox/trunk: added the newmat library to the project. needs some translation in directory, temp under util/newmat. is needed by the collision detection engine to perform lin alg operations such as eigenvector decomposition. perhaps we will make our own library to do that later.

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