27#include <vecLib/vBLAS.h>
66 TMatrixT(
const TMatrixT <Element> &another);
67 TMatrixT(
const TMatrixTSym <Element> &another);
87 void Plus (
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
91 void Minus(
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
95 void Mult (
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
100 void TMult(
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
105 void MultT(
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
127 ((
const_cast<TMatrixT<Element> *
>(
this))->Use(row_lwb,row_upb,col_lwb,col_upb,
const_cast<Element *
>(data))); }
129 const TMatrixT <Element> &
Use (
Int_t nrows,
Int_t ncols,
const Element *data)
const;
141 return ResizeTo(
m.GetRowLwb(),
m.GetRowUpb(),
m.GetColLwb(),
m.GetColUpb());
164 inline TMatrixTRow <Element>
operator[](
Int_t rown) {
return TMatrixTRow <Element>(*
this,rown); }
173 Error(
"operator=(const TMatrixT2 &)",
"matrices not compatible");
226 {
return Use(0,nrows-1,0,ncols-1,data); }
228 {
return Use(0,nrows-1,0,ncols-1,data); }
232 return Use(
a.GetRowLwb(),
a.GetRowUpb(),
233 a.GetColLwb(),
a.GetColUpb(),
a.GetMatrixArray());
238 return Use(
a.GetRowLwb(),
a.GetRowUpb(),
239 a.GetColLwb(),
a.GetColUpb(),
a.GetMatrixArray());
246 this->GetSub(row_lwb,row_upb,col_lwb,col_upb,tmp,option);
253 const Int_t arown = rown-this->fRowLwb;
254 const Int_t acoln = coln-this->fColLwb;
255 if (arown >= this->fNrows || arown < 0) {
256 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",rown,this->fRowLwb,this->fRowLwb+this->fNrows);
259 if (acoln >= this->fNcols || acoln < 0) {
260 Error(
"operator()",
"Request column(%d) outside matrix range of %d - %d",coln,this->fColLwb,this->fColLwb+this->fNcols);
264 return (fElements[arown*this->fNcols+acoln]);
270 const Int_t arown = rown-this->fRowLwb;
271 const Int_t acoln = coln-this->fColLwb;
272 if (arown >= this->fNrows || arown < 0) {
273 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",rown,this->fRowLwb,this->fRowLwb+this->fNrows);
276 if (acoln >= this->fNcols || acoln < 0) {
277 Error(
"operator()",
"Request column(%d) outside matrix range of %d - %d",coln,this->fColLwb,this->fColLwb+this->fNcols);
280 return (fElements[arown*this->fNcols+acoln]);
302#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
303#pragma GCC diagnostic push
304#pragma GCC diagnostic ignored "-Weffc++"
312#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
313#pragma GCC diagnostic pop
338template <
class Element>
void AMultB (
const Element *
const ap,
Int_t na,
Int_t ncolsa,
339 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp);
340template <
class Element>
void AtMultB(
const Element *
const ap,
Int_t ncolsa,
341 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp);
342template <
class Element>
void AMultBt(
const Element *
const ap,
Int_t na,
Int_t ncolsa,
343 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp);
#define ClassDef(name, id)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
TClass instances represent classes, structs and namespaces in the ROOT type system.
static Element & NaNValue()
Templates of Lazy Matrix classes.
void MultT(const TMatrixTSym< Element > &a, const TMatrixTSym< Element > &b)
TMatrixT< Element > & Rank1Update(const TVectorT< Element > &v, Element alpha=1.0)
Perform a rank 1 operation on matrix A: A += alpha * v * v^T.
const TMatrixT< Element > & Use(Int_t nrows, Int_t ncols, const Element *data) const
void TMult(const TMatrixTSym< Element > &a, const TMatrixT< Element > &b)
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])
const TMatrixTRow_const< Element > operator[](Int_t rown) const
void Delete_m(Int_t size, Element *&)
Delete data pointer m, if it was assigned on the heap.
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...
TMatrixT< Element > & operator*=(Element val)
Multiply every element of the matrix with val.
TMatrixT< Element > GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t *option="S") const
Element fDataStack[TMatrixTBase< Element >::kSizeMax]
TMatrixT(const TMatrixT< Element2 > &another)
TMatrixT< Element > & Use(TMatrixT< Element > &a)
virtual const Element * GetMatrixArray() const
TMatrixT< Element > & T()
TMatrixT< Element > & operator=(const TMatrixT< Element > &source)
Assignment operator.
const TMatrixT< Element > & Use(const TMatrixT< Element > &a) const
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,...
void MultT(const TMatrixT< Element > &a, const TMatrixTSym< Element > &b)
virtual TMatrixTBase< Element > & SetColIndexArray(Int_t *)
void Minus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix summation. Create a matrix C such that C = A - B.
Element Similarity(const TVectorT< Element > &v) const
Calculate scalar v * (*this) * v^T.
TMatrixT< Element > & Invert(Double_t *det=0)
Invert the matrix and calculate its determinant.
virtual Double_t Determinant() const
Return the matrix determinant.
TMatrixT< Element > & Use(Int_t nrows, Int_t ncols, Element *data)
void Plus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix summation. Create a matrix C such that C = A + B.
TMatrixTBase< Element > & ResizeTo(const TMatrixT< Element > &m)
virtual TMatrixTBase< Element > & SetRowIndexArray(Int_t *)
virtual void Clear(Option_t *="")
virtual const Int_t * GetRowIndexArray() const
void Minus(const TMatrixTSym< Element > &a, const TMatrixT< Element > &b)
TMatrixT< Element > & InvertFast(Double_t *det=0)
Invert the matrix and calculate its determinant, however upto (6x6) a fast Cramer inversion is used .
virtual Element * GetMatrixArray()
TMatrixT< Element > & operator-=(Element val)
Subtract val from every element of the matrix.
TMatrixT< Element > & Transpose(const TMatrixT< Element > &source)
Transpose matrix source.
void MultT(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Create a matrix C such that C = A * B^T.
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....
void TMult(const TMatrixTSym< Element > &a, const TMatrixTSym< Element > &b)
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...
Element operator()(Int_t rown, Int_t coln) const
Element * New_m(Int_t size)
Return data pointer .
virtual const Int_t * GetColIndexArray() const
TMatrixTRow< Element > operator[](Int_t rown)
virtual Int_t * GetColIndexArray()
virtual Int_t * GetRowIndexArray()
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.
void Plus(const TMatrixTSym< Element > &a, const TMatrixT< Element > &b)
TMatrixT< Element > & operator+=(Element val)
Add val to every element of the matrix.
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,...
Element & operator()(Int_t rown, Int_t coln)
void TMult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
Create a matrix C such that C = A' * B.
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...
void Mult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Create a matrix C such that C = A * B.
Element * fElements
data container
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 .
TMatrixT< Element > & operator/=(const TMatrixTDiag_const< Element > &diag)
Divide a matrix row by the diagonal of another matrix matrix(i,j) /= diag(j)
const TMatrixT< Element > & Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, const Element *data) const
TObject & operator=(const TObject &rhs)
TObject assignment operator.
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...
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TMatrixT< Element > operator!=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 != source2
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.
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.
TMatrixT< Element > operator+(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1+source2
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.
TMatrixT< Element > operator>=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 >= source2
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
TMatrixT< Element > operator||(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical OR.
TMatrixT< Element > operator<(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 < source2
TMatrixT< Element > operator>(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 > source2
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
TMatrixT< Element > & ElementDiv(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Divide target by the source, element-by-element.
TMatrixT< Element > operator-(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1-source2
TMatrixT< Element > operator<=(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 <= source2
TMatrixT< Element > operator&&(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
Logical AND.
TMatrixT< Element > operator*(Element val, const TMatrixT< Element > &source)
operation this = val*source
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 .