Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TMatrixTLazy.h
Go to the documentation of this file.
1 // @(#)root/matrix:$Id$
2 // Authors: Fons Rademakers, Eddy Offermann Nov 2003
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TMatrixTLazy
13 #define ROOT_TMatrixTLazy
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // Templates of Lazy Matrix classes. //
18 // //
19 // TMatrixTLazy //
20 // TMatrixTSymLazy //
21 // THaarMatrixT //
22 // THilbertMatrixT //
23 // THilbertMatrixTSym //
24 // //
25 //////////////////////////////////////////////////////////////////////////
26 
27 #include "TMatrixTBase.h"
28 
29 template<class Element> class TVectorT;
30 template<class Element> class TMatrixTBase;
31 template<class Element> class TMatrixT;
32 template<class Element> class TMatrixTSym;
33 
34 //////////////////////////////////////////////////////////////////////////
35 // //
36 // TMatrixTLazy //
37 // //
38 // Class used to make a lazy copy of a matrix, i.e. only copy matrix //
39 // when really needed (when accessed). //
40 // //
41 //////////////////////////////////////////////////////////////////////////
42 
43 template<class Element> class TMatrixTLazy : public TObject {
44 
45 friend class TMatrixTBase<Element>;
46 friend class TMatrixT <Element>;
47 friend class TVectorT <Element>;
48 
49 protected:
50  Int_t fRowUpb;
51  Int_t fRowLwb;
52  Int_t fColUpb;
53  Int_t fColLwb;
54 
55  TMatrixTLazy(const TMatrixTLazy<Element> &) : TObject(), fRowUpb(0),fRowLwb(0),fColUpb(0),fColLwb(0) { }
56  void operator=(const TMatrixTLazy<Element> &) { }
57 
58 private:
59  virtual void FillIn(TMatrixT<Element> &m) const = 0;
60 
61 public:
62  TMatrixTLazy() { fRowUpb = fRowLwb = fColUpb = fColLwb = 0; }
63  TMatrixTLazy(Int_t nrows, Int_t ncols)
64  : fRowUpb(nrows-1),fRowLwb(0),fColUpb(ncols-1),fColLwb(0) { }
65  TMatrixTLazy(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb)
66  : fRowUpb(row_upb),fRowLwb(row_lwb),fColUpb(col_upb),fColLwb(col_lwb) { }
67  virtual ~TMatrixTLazy() {}
68 
69  inline Int_t GetRowLwb() const { return fRowLwb; }
70  inline Int_t GetRowUpb() const { return fRowUpb; }
71  inline Int_t GetColLwb() const { return fColLwb; }
72  inline Int_t GetColUpb() const { return fColUpb; }
73 
74  ClassDef(TMatrixTLazy,3) // Template of Lazy Matrix class
75 };
76 
77 //////////////////////////////////////////////////////////////////////////
78 // //
79 // TMatrixTSymLazy //
80 // //
81 // Class used to make a lazy copy of a matrix, i.e. only copy matrix //
82 // when really needed (when accessed). //
83 // //
84 //////////////////////////////////////////////////////////////////////////
85 
86 template<class Element> class TMatrixTSymLazy : public TObject {
87 
88 friend class TMatrixTBase<Element>;
89 friend class TMatrixTSym <Element>;
90 friend class TVectorT <Element>;
91 
92 protected:
93  Int_t fRowUpb;
94  Int_t fRowLwb;
95 
96  TMatrixTSymLazy(const TMatrixTSymLazy<Element> &) : TObject(), fRowUpb(0),fRowLwb(0) { }
97  void operator=(const TMatrixTSymLazy<Element> &) { }
98 
99 private:
100  virtual void FillIn(TMatrixTSym<Element> &m) const = 0;
101 
102 public:
103  TMatrixTSymLazy() { fRowUpb = fRowLwb = 0; }
104  TMatrixTSymLazy(Int_t nrows)
105  : fRowUpb(nrows-1),fRowLwb(0) { }
106  TMatrixTSymLazy(Int_t row_lwb,Int_t row_upb)
107  : fRowUpb(row_upb),fRowLwb(row_lwb) { }
108  virtual ~TMatrixTSymLazy() {}
109 
110  inline Int_t GetRowLwb() const { return fRowLwb; }
111  inline Int_t GetRowUpb() const { return fRowUpb; }
112 
113  ClassDef(TMatrixTSymLazy,2) // Template of Lazy Symmeytric class
114 };
115 
116 //////////////////////////////////////////////////////////////////////////
117 // //
118 // THaarMatrixT //
119 // //
120 //////////////////////////////////////////////////////////////////////////
121 
122 template<class Element> class THaarMatrixT: public TMatrixTLazy<Element> {
123 
124 private:
125  void FillIn(TMatrixT<Element> &m) const;
126 
127 public:
128  THaarMatrixT() {}
129  THaarMatrixT(Int_t n,Int_t no_cols = 0);
130  virtual ~THaarMatrixT() {}
131 
132  ClassDef(THaarMatrixT,2) // Template of Haar Matrix class
133 };
134 
135 //////////////////////////////////////////////////////////////////////////
136 // //
137 // THilbertMatrixT //
138 // //
139 //////////////////////////////////////////////////////////////////////////
140 
141 template<class Element> class THilbertMatrixT : public TMatrixTLazy<Element> {
142 
143 private:
144  void FillIn(TMatrixT<Element> &m) const;
145 
146 public:
147  THilbertMatrixT() {}
148  THilbertMatrixT(Int_t no_rows,Int_t no_cols);
149  THilbertMatrixT(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb);
150  virtual ~THilbertMatrixT() {}
151 
152  ClassDef(THilbertMatrixT,2) // Template of Hilbert Matrix class
153 };
154 
155 //////////////////////////////////////////////////////////////////////////
156 // //
157 // THilbertMatrixTSym //
158 // //
159 //////////////////////////////////////////////////////////////////////////
160 
161 template<class Element> class THilbertMatrixTSym : public TMatrixTSymLazy<Element> {
162 
163 private:
164  void FillIn(TMatrixTSym<Element> &m) const;
165 
166 public:
167  THilbertMatrixTSym() {}
168  THilbertMatrixTSym(Int_t no_rows);
169  THilbertMatrixTSym(Int_t row_lwb,Int_t row_upb);
170  virtual ~THilbertMatrixTSym() {}
171 
172  ClassDef(THilbertMatrixTSym,2) // Template of Symmetric Hilbert Matrix class
173 };
174 
175 #endif