TMatrixTLazy.h

Go to the documentation of this file.
00001 // @(#)root/matrix:$Id: TMatrixTLazy.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Authors: Fons Rademakers, Eddy Offermann   Nov 2003
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TMatrixTLazy
00013 #define ROOT_TMatrixTLazy
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // Templates of Lazy Matrix classes.                                    //
00018 //                                                                      //
00019 //   TMatrixTLazy                                                       //
00020 //   TMatrixTSymLazy                                                    //
00021 //   THaarMatrixT                                                       //
00022 //   THilbertMatrixT                                                    //
00023 //   THilbertMatrixTSym                                                 //
00024 //                                                                      //
00025 //////////////////////////////////////////////////////////////////////////
00026 
00027 #ifndef ROOT_TMatrixTBase
00028 #include "TMatrixTBase.h"
00029 #endif
00030 
00031 template<class Element> class TVectorT;
00032 template<class Element> class TMatrixTBase;
00033 template<class Element> class TMatrixT;
00034 template<class Element> class TMatrixTSym;
00035 
00036 //////////////////////////////////////////////////////////////////////////
00037 //                                                                      //
00038 // TMatrixTLazy                                                         //
00039 //                                                                      //
00040 // Class used to make a lazy copy of a matrix, i.e. only copy matrix    //
00041 // when really needed (when accessed).                                  //
00042 //                                                                      //
00043 //////////////////////////////////////////////////////////////////////////
00044 
00045 template<class Element> class TMatrixTLazy : public TObject {
00046 
00047 friend class TMatrixTBase<Element>;
00048 friend class TMatrixT    <Element>;
00049 friend class TVectorT    <Element>;
00050 
00051 protected:
00052    Int_t fRowUpb;
00053    Int_t fRowLwb;
00054    Int_t fColUpb;
00055    Int_t fColLwb;
00056 
00057    TMatrixTLazy(const TMatrixTLazy<Element> &) : TObject() { }
00058    void operator=(const TMatrixTLazy<Element> &) { }
00059 
00060 private:
00061    virtual void FillIn(TMatrixT<Element> &m) const = 0;
00062 
00063 public:
00064    TMatrixTLazy() { fRowUpb = fRowLwb = fColUpb = fColLwb = 0; }
00065    TMatrixTLazy(Int_t nrows, Int_t ncols)
00066        : fRowUpb(nrows-1),fRowLwb(0),fColUpb(ncols-1),fColLwb(0) { }
00067    TMatrixTLazy(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb)
00068        : fRowUpb(row_upb),fRowLwb(row_lwb),fColUpb(col_upb),fColLwb(col_lwb) { }
00069    virtual ~TMatrixTLazy() {}
00070 
00071    inline Int_t GetRowLwb() const { return fRowLwb; }
00072    inline Int_t GetRowUpb() const { return fRowUpb; }
00073    inline Int_t GetColLwb() const { return fColLwb; }
00074    inline Int_t GetColUpb() const { return fColUpb; }
00075 
00076    ClassDef(TMatrixTLazy,3)  // Template of Lazy Matrix class
00077 };
00078 
00079 //////////////////////////////////////////////////////////////////////////
00080 //                                                                      //
00081 // TMatrixTSymLazy                                                      //
00082 //                                                                      //
00083 // Class used to make a lazy copy of a matrix, i.e. only copy matrix    //
00084 // when really needed (when accessed).                                  //
00085 //                                                                      //
00086 //////////////////////////////////////////////////////////////////////////
00087 
00088 template<class Element> class TMatrixTSymLazy : public TObject {
00089 
00090 friend class TMatrixTBase<Element>;
00091 friend class TMatrixTSym <Element>;
00092 friend class TVectorT    <Element>;
00093 
00094 protected:
00095    Int_t fRowUpb;
00096    Int_t fRowLwb;
00097 
00098    TMatrixTSymLazy(const TMatrixTSymLazy<Element> &) : TObject() { }
00099    void operator=(const TMatrixTSymLazy<Element> &) { }
00100 
00101 private:
00102    virtual void FillIn(TMatrixTSym<Element> &m) const = 0;
00103 
00104 public:
00105    TMatrixTSymLazy() { fRowUpb = fRowLwb = 0; }
00106    TMatrixTSymLazy(Int_t nrows)
00107        : fRowUpb(nrows-1),fRowLwb(0) { }
00108    TMatrixTSymLazy(Int_t row_lwb,Int_t row_upb)
00109        : fRowUpb(row_upb),fRowLwb(row_lwb) { }
00110    virtual ~TMatrixTSymLazy() {}
00111 
00112    inline Int_t GetRowLwb() const { return fRowLwb; }
00113    inline Int_t GetRowUpb() const { return fRowUpb; }
00114 
00115    ClassDef(TMatrixTSymLazy,2)  // Template of Lazy Symmeytric class
00116 };
00117 
00118 //////////////////////////////////////////////////////////////////////////
00119 //                                                                      //
00120 // THaarMatrixT                                                         //
00121 //                                                                      //
00122 //////////////////////////////////////////////////////////////////////////
00123 
00124 template<class Element> class THaarMatrixT: public TMatrixTLazy<Element> {
00125 
00126 private:
00127    void FillIn(TMatrixT<Element> &m) const;
00128 
00129 public:
00130    THaarMatrixT() {}
00131    THaarMatrixT(Int_t n,Int_t no_cols = 0);
00132    virtual ~THaarMatrixT() {}
00133 
00134    ClassDef(THaarMatrixT,2)  // Template of Haar Matrix class
00135 };
00136 
00137 //////////////////////////////////////////////////////////////////////////
00138 //                                                                      //
00139 // THilbertMatrixT                                                      //
00140 //                                                                      //
00141 //////////////////////////////////////////////////////////////////////////
00142 
00143 template<class Element> class THilbertMatrixT : public TMatrixTLazy<Element> {
00144 
00145 private:
00146    void FillIn(TMatrixT<Element> &m) const;
00147 
00148 public:
00149    THilbertMatrixT() {}
00150    THilbertMatrixT(Int_t no_rows,Int_t no_cols);
00151    THilbertMatrixT(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb);
00152    virtual ~THilbertMatrixT() {}
00153 
00154    ClassDef(THilbertMatrixT,2)  // Template of Hilbert Matrix class
00155 };
00156 
00157 //////////////////////////////////////////////////////////////////////////
00158 //                                                                      //
00159 // THilbertMatrixTSym                                                   //
00160 //                                                                      //
00161 //////////////////////////////////////////////////////////////////////////
00162 
00163 template<class Element> class THilbertMatrixTSym : public TMatrixTSymLazy<Element> {
00164 
00165 private:
00166    void FillIn(TMatrixTSym<Element> &m) const;
00167 
00168 public:
00169    THilbertMatrixTSym() {}
00170    THilbertMatrixTSym(Int_t no_rows);
00171    THilbertMatrixTSym(Int_t row_lwb,Int_t row_upb);
00172    virtual ~THilbertMatrixTSym() {}
00173   
00174    ClassDef(THilbertMatrixTSym,2)  // Template of Symmetric Hilbert Matrix class
00175 };
00176 
00177 #endif

Generated on Tue Jul 5 14:27:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1