ROOT  6.06/09
Reference Guide
TMatrixT.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_TMatrixT
13 #define ROOT_TMatrixT
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TMatrixT //
18 // //
19 // Template class of a general matrix in the linear algebra package //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #ifndef ROOT_TMatrixTBase
24 #include "TMatrixTBase.h"
25 #endif
26 #ifndef ROOT_TMatrixTUtils
27 #include "TMatrixTUtils.h"
28 #endif
29 
30 #ifdef CBLAS
31 #include <vecLib/vBLAS.h>
32 //#include <cblas.h>
33 #endif
34 
35 
36 template<class Element> class TMatrixTSym;
37 template<class Element> class TMatrixTSparse;
38 template<class Element> class TMatrixTLazy;
39 
40 template<class Element> class TMatrixT : public TMatrixTBase<Element> {
41 
42 protected:
43 
44  Element fDataStack[TMatrixTBase<Element>::kSizeMax]; //! data container
45  Element *fElements; //[fNelems] elements themselves
46 
47  Element *New_m (Int_t size);
48  void Delete_m(Int_t size,Element*&);
49  Int_t Memcpy_m(Element *newp,const Element *oldp,Int_t copySize,
50  Int_t newSize,Int_t oldSize);
51  void Allocate(Int_t nrows,Int_t ncols,Int_t row_lwb = 0,Int_t col_lwb = 0,Int_t init = 0,
52  Int_t /*nr_nonzeros*/ = -1);
53 
54 
55 public:
56 
57 
58  enum {kWorkMax = 100};
61 
62  TMatrixT(): fDataStack(), fElements(0) { }
63  TMatrixT(Int_t nrows,Int_t ncols);
64  TMatrixT(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb);
65  TMatrixT(Int_t nrows,Int_t ncols,const Element *data,Option_t *option="");
66  TMatrixT(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,const Element *data,Option_t *option="");
67  TMatrixT(const TMatrixT <Element> &another);
68  TMatrixT(const TMatrixTSym <Element> &another);
69  TMatrixT(const TMatrixTSparse<Element> &another);
70  template <class Element2> TMatrixT(const TMatrixT<Element2> &another): fElements(0)
71  {
72  R__ASSERT(another.IsValid());
73  Allocate(another.GetNrows(),another.GetNcols(),another.GetRowLwb(),another.GetColLwb());
74  *this = another;
75  }
76 
77  TMatrixT(EMatrixCreatorsOp1 op,const TMatrixT<Element> &prototype);
82  TMatrixT(const TMatrixTLazy<Element> &lazy_constructor);
83 
84  virtual ~TMatrixT() { Clear(); }
85 
86  // Elementary constructors
87 
88  void Plus (const TMatrixT <Element> &a,const TMatrixT <Element> &b);
89  void Plus (const TMatrixT <Element> &a,const TMatrixTSym<Element> &b);
90  void Plus (const TMatrixTSym<Element> &a,const TMatrixT <Element> &b) { Plus(b,a); }
91 
92  void Minus(const TMatrixT <Element> &a,const TMatrixT <Element> &b);
93  void Minus(const TMatrixT <Element> &a,const TMatrixTSym<Element> &b);
94  void Minus(const TMatrixTSym<Element> &a,const TMatrixT <Element> &b) { Minus(b,a); }
95 
96  void Mult (const TMatrixT <Element> &a,const TMatrixT <Element> &b);
97  void Mult (const TMatrixT <Element> &a,const TMatrixTSym<Element> &b);
98  void Mult (const TMatrixTSym<Element> &a,const TMatrixT <Element> &b);
99  void Mult (const TMatrixTSym<Element> &a,const TMatrixTSym<Element> &b);
100 
101  void TMult(const TMatrixT <Element> &a,const TMatrixT <Element> &b);
102  void TMult(const TMatrixT <Element> &a,const TMatrixTSym<Element> &b);
103  void TMult(const TMatrixTSym<Element> &a,const TMatrixT <Element> &b) { Mult(a,b); }
104  void TMult(const TMatrixTSym<Element> &a,const TMatrixTSym<Element> &b) { Mult(a,b); }
105 
106  void MultT(const TMatrixT <Element> &a,const TMatrixT <Element> &b);
107  void MultT(const TMatrixT <Element> &a,const TMatrixTSym<Element> &b) { Mult(a,b); }
108  void MultT(const TMatrixTSym<Element> &a,const TMatrixT <Element> &b);
109  void MultT(const TMatrixTSym<Element> &a,const TMatrixTSym<Element> &b) { Mult(a,b); }
110 
111  virtual const Element *GetMatrixArray () const;
112  virtual Element *GetMatrixArray ();
113  virtual const Int_t *GetRowIndexArray() const { return 0; }
114  virtual Int_t *GetRowIndexArray() { return 0; }
115  virtual const Int_t *GetColIndexArray() const { return 0; }
116  virtual Int_t *GetColIndexArray() { return 0; }
117 
118  virtual TMatrixTBase<Element> &SetRowIndexArray(Int_t * /*data*/) { MayNotUse("SetRowIndexArray(Int_t *)"); return *this; }
119  virtual TMatrixTBase<Element> &SetColIndexArray(Int_t * /*data*/) { MayNotUse("SetColIndexArray(Int_t *)"); return *this; }
120 
121  virtual void Clear(Option_t * /*option*/ ="") { if (this->fIsOwner) Delete_m(this->fNelems,fElements);
122  else fElements = 0;
123  this->fNelems = 0; }
124 
125  TMatrixT <Element> &Use (Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,Element *data);
126  const TMatrixT <Element> &Use (Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,const Element *data) const
127  { return (const TMatrixT<Element>&)
128  ((const_cast<TMatrixT<Element> *>(this))->Use(row_lwb,row_upb,col_lwb,col_upb, const_cast<Element *>(data))); }
129  TMatrixT <Element> &Use (Int_t nrows,Int_t ncols,Element *data);
130  const TMatrixT <Element> &Use (Int_t nrows,Int_t ncols,const Element *data) const;
132  const TMatrixT <Element> &Use (const TMatrixT<Element> &a) const;
133 
134  virtual TMatrixTBase<Element> &GetSub (Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,
135  TMatrixTBase<Element> &target,Option_t *option="S") const;
136  TMatrixT <Element> GetSub (Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,Option_t *option="S") const;
137  virtual TMatrixTBase<Element> &SetSub (Int_t row_lwb,Int_t col_lwb,const TMatrixTBase<Element> &source);
138 
139  virtual TMatrixTBase<Element> &ResizeTo(Int_t nrows,Int_t ncols,Int_t /*nr_nonzeros*/ =-1);
140  virtual TMatrixTBase<Element> &ResizeTo(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,Int_t /*nr_nonzeros*/ =-1);
142  return ResizeTo(m.GetRowLwb(),m.GetRowUpb(),m.GetColLwb(),m.GetColUpb());
143  }
144 
145  virtual Double_t Determinant () const;
146  virtual void Determinant (Double_t &d1,Double_t &d2) const;
147 
151  inline TMatrixT<Element> &T () { return this->Transpose(*this); }
152  TMatrixT<Element> &Rank1Update (const TVectorT<Element> &v,Element alpha=1.0);
153  TMatrixT<Element> &Rank1Update (const TVectorT<Element> &v1,const TVectorT<Element> &v2,Element alpha=1.0);
154  Element Similarity (const TVectorT<Element> &v) const;
155 
158 
159  // Either access a_ij as a(i,j)
160  inline Element operator()(Int_t rown,Int_t coln) const;
161  inline Element &operator()(Int_t rown,Int_t coln);
162 
163  // or as a[i][j]
164  inline const TMatrixTRow_const<Element> operator[](Int_t rown) const { return TMatrixTRow_const<Element>(*this,rown); }
165  inline TMatrixTRow <Element> operator[](Int_t rown) { return TMatrixTRow <Element>(*this,rown); }
166 
171  template <class Element2> TMatrixT<Element> &operator= (const TMatrixT<Element2> &source)
172  {
173  if (!AreCompatible(*this,source)) {
174  Error("operator=(const TMatrixT2 &)","matrices not compatible");
175  return *this;
176  }
177 
178  TObject::operator=(source);
179  const Element2 * const ps = source.GetMatrixArray();
180  Element * const pt = this->GetMatrixArray();
181  for (Int_t i = 0; i < this->fNelems; i++)
182  pt[i] = ps[i];
183  this->fTol = source.GetTol();
184  return *this;
185  }
186 
187  TMatrixT<Element> &operator= (Element val);
188  TMatrixT<Element> &operator-=(Element val);
189  TMatrixT<Element> &operator+=(Element val);
190  TMatrixT<Element> &operator*=(Element val);
191 
196 
205 
206  const TMatrixT<Element> EigenVectors(TVectorT<Element> &eigenValues) const;
207 
208  ClassDef(TMatrixT,4) // Template of General Matrix class
209 };
210 
211 template <class Element> inline const Element *TMatrixT<Element>::GetMatrixArray() const { return fElements; }
212 template <class Element> inline Element *TMatrixT<Element>::GetMatrixArray() { return fElements; }
213 
214 template <class Element> inline TMatrixT<Element> &TMatrixT<Element>::Use (Int_t nrows,Int_t ncols,Element *data)
215  { return Use(0,nrows-1,0,ncols-1,data); }
216 template <class Element> inline const TMatrixT<Element> &TMatrixT<Element>::Use (Int_t nrows,Int_t ncols,const Element *data) const
217  { return Use(0,nrows-1,0,ncols-1,data); }
218 template <class Element> inline TMatrixT<Element> &TMatrixT<Element>::Use (TMatrixT &a)
219  {
220  R__ASSERT(a.IsValid());
221  return Use(a.GetRowLwb(),a.GetRowUpb(),
222  a.GetColLwb(),a.GetColUpb(),a.GetMatrixArray());
223  }
224 template <class Element> inline const TMatrixT<Element> &TMatrixT<Element>::Use (const TMatrixT &a) const
225  {
226  R__ASSERT(a.IsValid());
227  return Use(a.GetRowLwb(),a.GetRowUpb(),
228  a.GetColLwb(),a.GetColUpb(),a.GetMatrixArray());
229  }
230 
231 template <class Element> inline TMatrixT<Element> TMatrixT<Element>::GetSub (Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,
232  Option_t *option) const
233  {
234  TMatrixT tmp;
235  this->GetSub(row_lwb,row_upb,col_lwb,col_upb,tmp,option);
236  return tmp;
237  }
238 
239 template <class Element> inline Element TMatrixT<Element>::operator()(Int_t rown,Int_t coln) const
240 {
241  R__ASSERT(this->IsValid());
242  const Int_t arown = rown-this->fRowLwb;
243  const Int_t acoln = coln-this->fColLwb;
244  if (arown >= this->fNrows || arown < 0) {
245  Error("operator()","Request row(%d) outside matrix range of %d - %d",rown,this->fRowLwb,this->fRowLwb+this->fNrows);
247  }
248  if (acoln >= this->fNcols || acoln < 0) {
249  Error("operator()","Request column(%d) outside matrix range of %d - %d",coln,this->fColLwb,this->fColLwb+this->fNcols);
251 
252  }
253  return (fElements[arown*this->fNcols+acoln]);
254 }
255 
256 template <class Element> inline Element &TMatrixT<Element>::operator()(Int_t rown,Int_t coln)
257 {
258  R__ASSERT(this->IsValid());
259  const Int_t arown = rown-this->fRowLwb;
260  const Int_t acoln = coln-this->fColLwb;
261  if (arown >= this->fNrows || arown < 0) {
262  Error("operator()","Request row(%d) outside matrix range of %d - %d",rown,this->fRowLwb,this->fRowLwb+this->fNrows);
264  }
265  if (acoln >= this->fNcols || acoln < 0) {
266  Error("operator()","Request column(%d) outside matrix range of %d - %d",coln,this->fColLwb,this->fColLwb+this->fNcols);
268  }
269  return (fElements[arown*this->fNcols+acoln]);
270 }
271 
272 template <class Element> TMatrixT<Element> operator+ (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
273 template <class Element> TMatrixT<Element> operator+ (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
274 template <class Element> TMatrixT<Element> operator+ (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
275 template <class Element> TMatrixT<Element> operator+ (const TMatrixT <Element> &source , Element val );
276 template <class Element> TMatrixT<Element> operator+ ( Element val ,const TMatrixT <Element> &source );
277 template <class Element> TMatrixT<Element> operator- (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
278 template <class Element> TMatrixT<Element> operator- (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
279 template <class Element> TMatrixT<Element> operator- (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
280 template <class Element> TMatrixT<Element> operator- (const TMatrixT <Element> &source , Element val );
281 template <class Element> TMatrixT<Element> operator- ( Element val ,const TMatrixT <Element> &source );
282 template <class Element> TMatrixT<Element> operator* ( Element val ,const TMatrixT <Element> &source );
283 template <class Element> TMatrixT<Element> operator* (const TMatrixT <Element> &source , Element val );
284 template <class Element> TMatrixT<Element> operator* (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
285 template <class Element> TMatrixT<Element> operator* (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
286 template <class Element> TMatrixT<Element> operator* (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
287 template <class Element> TMatrixT<Element> operator* (const TMatrixTSym<Element> &source1,const TMatrixTSym<Element> &source2);
288 // Preventing warnings with -Weffc++ in GCC since overloading the || and && operators was a design choice.
289 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
290 #pragma GCC diagnostic push
291 #pragma GCC diagnostic ignored "-Weffc++"
292 #endif
293 template <class Element> TMatrixT<Element> operator&& (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
294 template <class Element> TMatrixT<Element> operator&& (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
295 template <class Element> TMatrixT<Element> operator&& (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
296 template <class Element> TMatrixT<Element> operator|| (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
297 template <class Element> TMatrixT<Element> operator|| (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
298 template <class Element> TMatrixT<Element> operator|| (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
299 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
300 #pragma GCC diagnostic pop
301 #endif
302 template <class Element> TMatrixT<Element> operator> (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
303 template <class Element> TMatrixT<Element> operator> (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
304 template <class Element> TMatrixT<Element> operator> (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
305 template <class Element> TMatrixT<Element> operator>= (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
306 template <class Element> TMatrixT<Element> operator>= (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
307 template <class Element> TMatrixT<Element> operator>= (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
308 template <class Element> TMatrixT<Element> operator<= (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
309 template <class Element> TMatrixT<Element> operator<= (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
310 template <class Element> TMatrixT<Element> operator<= (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
311 template <class Element> TMatrixT<Element> operator< (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
312 template <class Element> TMatrixT<Element> operator< (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
313 template <class Element> TMatrixT<Element> operator< (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
314 template <class Element> TMatrixT<Element> operator!= (const TMatrixT <Element> &source1,const TMatrixT <Element> &source2);
315 template <class Element> TMatrixT<Element> operator!= (const TMatrixT <Element> &source1,const TMatrixTSym<Element> &source2);
316 template <class Element> TMatrixT<Element> operator!= (const TMatrixTSym<Element> &source1,const TMatrixT <Element> &source2);
317 
318 template <class Element> TMatrixT<Element> &Add (TMatrixT<Element> &target, Element scalar,const TMatrixT <Element> &source);
319 template <class Element> TMatrixT<Element> &Add (TMatrixT<Element> &target, Element scalar,const TMatrixTSym<Element> &source);
320 template <class Element> TMatrixT<Element> &ElementMult(TMatrixT<Element> &target,const TMatrixT <Element> &source);
321 template <class Element> TMatrixT<Element> &ElementMult(TMatrixT<Element> &target,const TMatrixTSym<Element> &source);
322 template <class Element> TMatrixT<Element> &ElementDiv (TMatrixT<Element> &target,const TMatrixT <Element> &source);
323 template <class Element> TMatrixT<Element> &ElementDiv (TMatrixT<Element> &target,const TMatrixTSym<Element> &source);
324 
325 template <class Element> void AMultB (const Element * const ap,Int_t na,Int_t ncolsa,
326  const Element * const bp,Int_t nb,Int_t ncolsb,Element *cp);
327 template <class Element> void AtMultB(const Element * const ap,Int_t ncolsa,
328  const Element * const bp,Int_t nb,Int_t ncolsb,Element *cp);
329 template <class Element> void AMultBt(const Element * const ap,Int_t na,Int_t ncolsa,
330  const Element * const bp,Int_t nb,Int_t ncolsb,Element *cp);
331 
332 #endif
Int_t GetRowLwb() const
Definition: TMatrixTBase.h:132
TMatrixT< Element > operator-(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1-source2
Definition: TMatrixT.cxx:2363
TMatrixT< Element > & operator+=(Element val)
Add val to every element of the matrix.
Definition: TMatrixT.cxx:1833
TMatrixT< Element > & NormByColumn(const TVectorT< Element > &v, Option_t *option="D")
Multiply/divide matrix columns by a vector: option: "D" : b(i,j) = a(i,j)/v(i) i = 0...
Definition: TMatrixT.cxx:1633
void Delete_m(Int_t size, Element *&)
Delete data pointer m, if it was assigned on the heap.
Definition: TMatrixT.cxx:406
TMatrixT< Element > & Transpose(const TMatrixT< Element > &source)
Transpose matrix source.
Definition: TMatrixT.cxx:1460
TMatrixT< Element > operator!=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 != source2
Definition: TMatrixT.cxx:2834
void TMult(const TMatrixTSym< Element > &a, const TMatrixTSym< Element > &b)
Definition: TMatrixT.h:104
const Double_t * v1
Definition: TArcBall.cxx:33
TMatrixT()
Definition: TMatrixT.h:62
Element fTol
Definition: TMatrixTBase.h:108
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
Definition: TMatrixT.cxx:2924
Int_t GetRowUpb() const
Definition: TMatrixTBase.h:133
const char Option_t
Definition: RtypesCore.h:62
TMatrixT< Element > operator&&(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical AND.
Definition: TMatrixT.cxx:2474
TMatrixT< Element > & operator*=(Element val)
Multiply every element of the matrix with val.
Definition: TMatrixT.cxx:1865
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Definition: TObject.cxx:971
#define R__ASSERT(e)
Definition: TError.h:98
void MultT(const TMatrixT< Element > &a, const TMatrixTSym< Element > &b)
Definition: TMatrixT.h:107
Element operator()(Int_t rown, Int_t coln) const
Definition: TMatrixT.h:239
TMatrixT< Element > & T()
Definition: TMatrixT.h:151
int Int_t
Definition: RtypesCore.h:41
TArc * a
Definition: textangle.C:12
void Allocate(Int_t nrows, Int_t ncols, Int_t row_lwb=0, Int_t col_lwb=0, Int_t init=0, Int_t=-1)
Allocate new matrix.
Definition: TMatrixT.cxx:465
TMatrixT< Element > operator*(Element val, const TMatrixT< Element > &source)
operation this = val*source
Definition: TMatrixT.cxx:2414
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1)
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
Definition: TMatrixT.cxx:1201
Bool_t IsValid() const
Definition: TMatrixTBase.h:157
void Minus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix summation. Create a matrix C such that C = A - B.
Definition: TMatrixT.cxx:571
Element GetTol() const
Definition: TMatrixTBase.h:139
#define ClassDef(name, id)
Definition: Rtypes.h:254
TMatrixT< Element > operator||(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical OR.
Definition: TMatrixT.cxx:2533
void MultT(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Create a matrix C such that C = A * B^T.
Definition: TMatrixT.cxx:942
Element * New_m(Int_t size)
Return data pointer .
Definition: TMatrixT.cxx:420
void AMultB(const Element *const ap, Int_t na, Int_t ncolsa, const Element *const bp, Int_t nb, Int_t ncolsb, Element *cp)
Elementary routine to calculate matrix multiplication A*B.
Definition: TMatrixT.cxx:3068
TMatrixT< Element > & operator-=(Element val)
Subtract val from every element of the matrix.
Definition: TMatrixT.cxx:1849
TMatrixT< Element > operator+(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1+source2
Definition: TMatrixT.cxx:2312
TMatrixT< Element > & operator/=(const TMatrixTDiag_const< Element > &diag)
Divide a matrix row by the diagonal of another matrix matrix(i,j) /= diag(j)
Definition: TMatrixT.cxx:2118
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition: TObject.cxx:102
Bool_t AreCompatible(const TMatrixTBase< Element1 > &m1, const TMatrixTBase< Element2 > &m2, Int_t verbose=0)
Check that matrice sm1 and m2 areboth valid and have identical shapes .
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
void TMult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
Create a matrix C such that C = A' * B.
Definition: TMatrixT.cxx:843
void Error(const char *location, const char *msgfmt,...)
TMatrixT< Element > & Invert(Double_t *det=0)
Invert the matrix and calculate its determinant.
Definition: TMatrixT.cxx:1387
Int_t GetColUpb() const
Definition: TMatrixTBase.h:136
Element * fElements
data container
Definition: TMatrixT.h:45
Int_t GetNrows() const
Definition: TMatrixTBase.h:134
const TMatrixTRow_const< Element > operator[](Int_t rown) const
Definition: TMatrixT.h:164
Element Similarity(const TVectorT< Element > &v) const
Calculate scalar v * (*this) * v^T.
Definition: TMatrixT.cxx:1592
TMatrixT< Element > & Rank1Update(const TVectorT< Element > &v, Element alpha=1.0)
Perform a rank 1 operation on matrix A: A += alpha * v * v^T.
Definition: TMatrixT.cxx:1530
void AtMultB(const Element *const ap, Int_t ncolsa, const Element *const bp, Int_t nb, Int_t ncolsb, Element *cp)
Elementary routine to calculate matrix multiplication A^T*B.
Definition: TMatrixT.cxx:3091
TPaveText * pt
SVector< double, 2 > v
Definition: Dict.h:5
const TMatrixT< Element > EigenVectors(TVectorT< Element > &eigenValues) const
Return a matrix containing the eigen-vectors ordered by descending values of Re^2+Im^2 of the complex...
Definition: TMatrixT.cxx:2298
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
Definition: TMatrixT.cxx:2972
TMarker * m
Definition: textangle.C:8
TMatrixT< Element > & NormByRow(const TVectorT< Element > &v, Option_t *option="D")
Multiply/divide matrix rows with a vector: option: "D" : b(i,j) = a(i,j)/v(j) i = 0...
Definition: TMatrixT.cxx:1680
virtual TMatrixTBase< Element > & SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase< Element > &source)
Insert matrix source starting at [row_lwb][col_lwb], thereby overwriting the part [row_lwb...
Definition: TMatrixT.cxx:1147
virtual const Element * GetMatrixArray() const
Definition: TMatrixT.h:211
virtual const Int_t * GetColIndexArray() const
Definition: TMatrixT.h:115
Int_t GetColLwb() const
Definition: TMatrixTBase.h:135
virtual const Int_t * GetRowIndexArray() const
Definition: TMatrixT.h:113
Element fDataStack[TMatrixTBase< Element >::kSizeMax]
Definition: TMatrixT.h:44
static Int_t init()
Int_t Memcpy_m(Element *newp, const Element *oldp, Int_t copySize, Int_t newSize, Int_t oldSize)
Copy copySize doubles from *oldp to *newp .
Definition: TMatrixT.cxx:438
double Double_t
Definition: RtypesCore.h:55
TMatrixT< Element > operator>(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 > source2
Definition: TMatrixT.cxx:2592
TMatrixTRow< Element > operator[](Int_t rown)
Definition: TMatrixT.h:165
virtual void Clear(Option_t *="")
Definition: TMatrixT.h:121
Int_t GetNcols() const
Definition: TMatrixTBase.h:137
virtual TMatrixTBase< Element > & GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, TMatrixTBase< Element > &target, Option_t *option="S") const
Get submatrix [row_lwb..row_upb] x [col_lwb..col_upb]; The indexing range of the returned matrix depe...
Definition: TMatrixT.cxx:1080
Bool_t fIsOwner
Definition: TMatrixTBase.h:111
TMatrixT< Element > & operator=(const TMatrixT< Element > &source)
Assignment operator.
Definition: TMatrixT.cxx:1723
TMatrixT< Element > & ElementDiv(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Divide target by the source, element-by-element.
Definition: TMatrixT.cxx:3012
TMatrixT(const TMatrixT< Element2 > &another)
Definition: TMatrixT.h:70
const TMatrixT< Element > & Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, const Element *data) const
Definition: TMatrixT.h:126
TMatrixT< Element > & Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Element *data)
Use the array data to fill the matrix ([row_lwb..row_upb] x [col_lwb..col_upb])
Definition: TMatrixT.cxx:1044
void Minus(const TMatrixTSym< Element > &a, const TMatrixT< Element > &b)
Definition: TMatrixT.h:94
void Plus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix summation. Create a matrix C such that C = A + B.
Definition: TMatrixT.cxx:503
virtual Int_t * GetColIndexArray()
Definition: TMatrixT.h:116
virtual ~TMatrixT()
Definition: TMatrixT.h:84
TMatrixT< Element > & InvertFast(Double_t *det=0)
Invert the matrix and calculate its determinant, however upto (6x6) a fast Cramer inversion is used ...
Definition: TMatrixT.cxx:1401
virtual Double_t Determinant() const
Return the matrix determinant.
Definition: TMatrixT.cxx:1352
void AMultBt(const Element *const ap, Int_t na, Int_t ncolsa, const Element *const bp, Int_t nb, Int_t ncolsb, Element *cp)
Elementary routine to calculate matrix multiplication A*B^T.
Definition: TMatrixT.cxx:3115
static Element & NaNValue()
void Plus(const TMatrixTSym< Element > &a, const TMatrixT< Element > &b)
Definition: TMatrixT.h:90
void Mult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Create a matrix C such that C = A * B.
Definition: TMatrixT.cxx:639
void TMult(const TMatrixTSym< Element > &a, const TMatrixT< Element > &b)
Definition: TMatrixT.h:103
void MultT(const TMatrixTSym< Element > &a, const TMatrixTSym< Element > &b)
Definition: TMatrixT.h:109
TMatrixT< Element > operator>=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 >= source2
Definition: TMatrixT.cxx:2653
virtual TMatrixTBase< Element > & SetRowIndexArray(Int_t *)
Definition: TMatrixT.h:118
virtual Int_t * GetRowIndexArray()
Definition: TMatrixT.h:114
virtual TMatrixTBase< Element > & SetColIndexArray(Int_t *)
Definition: TMatrixT.h:119
TMatrixTBase< Element > & ResizeTo(const TMatrixT< Element > &m)
Definition: TMatrixT.h:141