Logo ROOT  
Reference Guide
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:
54 
56  void operator=(const TMatrixTLazy<Element> &) { }
57 
58 private:
59  virtual void FillIn(TMatrixT<Element> &m) const = 0;
60 
61 public:
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:
95 
98 
99 private:
100  virtual void FillIn(TMatrixTSym<Element> &m) const = 0;
101 
102 public:
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:
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:
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:
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
m
auto * m
Definition: textangle.C:8
TMatrixTSymLazy::TMatrixTSymLazy
TMatrixTSymLazy(const TMatrixTSymLazy< Element > &)
Definition: TMatrixTLazy.h:96
n
const Int_t n
Definition: legend1.C:16
TMatrixTSymLazy::TMatrixTSymLazy
TMatrixTSymLazy(Int_t row_lwb, Int_t row_upb)
Definition: TMatrixTLazy.h:106
TMatrixTSymLazy::TMatrixTSymLazy
TMatrixTSymLazy(Int_t nrows)
Definition: TMatrixTLazy.h:104
THilbertMatrixT::THilbertMatrixT
THilbertMatrixT()
Definition: TMatrixTLazy.h:147
THaarMatrixT
Definition: TMatrixTLazy.h:122
TMatrixTLazy::TMatrixTLazy
TMatrixTLazy(Int_t nrows, Int_t ncols)
Definition: TMatrixTLazy.h:63
TMatrixTLazy::operator=
void operator=(const TMatrixTLazy< Element > &)
Definition: TMatrixTLazy.h:56
TMatrixTSymLazy::fRowUpb
Int_t fRowUpb
Definition: TMatrixTLazy.h:93
THilbertMatrixTSym::FillIn
void FillIn(TMatrixTSym< Element > &m) const
Definition: TMatrixTLazy.cxx:222
THaarMatrixT::FillIn
void FillIn(TMatrixT< Element > &m) const
Definition: TMatrixTLazy.cxx:116
THaarMatrixT::THaarMatrixT
THaarMatrixT()
Definition: TMatrixTLazy.h:128
Int_t
int Int_t
Definition: RtypesCore.h:45
TMatrixTLazy::FillIn
virtual void FillIn(TMatrixT< Element > &m) const =0
TMatrixTSymLazy::operator=
void operator=(const TMatrixTSymLazy< Element > &)
Definition: TMatrixTLazy.h:97
TMatrixTSymLazy::GetRowLwb
Int_t GetRowLwb() const
Definition: TMatrixTLazy.h:110
THilbertMatrixT
Definition: TMatrixTLazy.h:141
TMatrixTSym
Definition: TMatrixDSymfwd.h:22
TMatrixT
Definition: TMatrixDfwd.h:22
TMatrixTLazy::fRowLwb
Int_t fRowLwb
Definition: TMatrixTLazy.h:51
TMatrixTLazy::TMatrixTLazy
TMatrixTLazy(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
Definition: TMatrixTLazy.h:65
TMatrixTSymLazy::TMatrixTSymLazy
TMatrixTSymLazy()
Definition: TMatrixTLazy.h:103
THilbertMatrixTSym::~THilbertMatrixTSym
virtual ~THilbertMatrixTSym()
Definition: TMatrixTLazy.h:170
TMatrixTLazy
Definition: TMatrixT.h:37
TMatrixTLazy::TMatrixTLazy
TMatrixTLazy()
Definition: TMatrixTLazy.h:62
THilbertMatrixT::FillIn
void FillIn(TMatrixT< Element > &m) const
Definition: TMatrixTLazy.cxx:174
TMatrixTBase
Definition: TMatrixDBasefwd.h:25
TMatrixTLazy::GetRowUpb
Int_t GetRowUpb() const
Definition: TMatrixTLazy.h:70
TMatrixTLazy::~TMatrixTLazy
virtual ~TMatrixTLazy()
Definition: TMatrixTLazy.h:67
TMatrixTSymLazy::fRowLwb
Int_t fRowLwb
Definition: TMatrixTLazy.h:94
TMatrixTSymLazy::~TMatrixTSymLazy
virtual ~TMatrixTSymLazy()
Definition: TMatrixTLazy.h:108
TMatrixTSymLazy::FillIn
virtual void FillIn(TMatrixTSym< Element > &m) const =0
TMatrixTSymLazy::GetRowUpb
Int_t GetRowUpb() const
Definition: TMatrixTLazy.h:111
TMatrixTLazy::TMatrixTLazy
TMatrixTLazy(const TMatrixTLazy< Element > &)
Definition: TMatrixTLazy.h:55
TVectorT
Definition: TMatrixTBase.h:78
TMatrixTLazy::GetRowLwb
Int_t GetRowLwb() const
Definition: TMatrixTLazy.h:69
THaarMatrixT::~THaarMatrixT
virtual ~THaarMatrixT()
Definition: TMatrixTLazy.h:130
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TMatrixTSymLazy
Definition: TMatrixTLazy.h:86
THilbertMatrixTSym::THilbertMatrixTSym
THilbertMatrixTSym()
Definition: TMatrixTLazy.h:167
TMatrixTLazy::fRowUpb
Int_t fRowUpb
Definition: TMatrixTLazy.h:50
THilbertMatrixTSym
Definition: TMatrixTLazy.h:161
TMatrixTLazy::fColLwb
Int_t fColLwb
Definition: TMatrixTLazy.h:53
TMatrixTLazy::fColUpb
Int_t fColUpb
Definition: TMatrixTLazy.h:52
TMatrixTBase.h
THilbertMatrixT::~THilbertMatrixT
virtual ~THilbertMatrixT()
Definition: TMatrixTLazy.h:150
TMatrixTLazy::GetColUpb
Int_t GetColUpb() const
Definition: TMatrixTLazy.h:72
TMatrixTLazy::GetColLwb
Int_t GetColLwb() const
Definition: TMatrixTLazy.h:71
int