27#include <vecLib/vBLAS.h>
67 TMatrixT(
const TMatrixT <Element> &another);
68 TMatrixT(
const TMatrixTSym <Element> &another);
88 void Plus (
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
92 void Minus(
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
96 void Mult (
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
101 void TMult(
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
106 void MultT(
const TMatrixT <Element> &
a,
const TMatrixT <Element> &
b);
135 ((
const_cast<TMatrixT<Element> *
>(
this))->Use(row_lwb,row_upb,col_lwb,col_upb,
const_cast<Element *
>(
data))); }
149 return ResizeTo(
m.GetRowLwb(),
m.GetRowUpb(),
m.GetColLwb(),
m.GetColUpb());
172 inline TMatrixTRow <Element>
operator[](
Int_t rown) {
return TMatrixTRow <Element>(*
this,rown); }
181 Error(
"operator=(const TMatrixT2 &)",
"matrices not compatible");
232 {
return Use(0,nrows-1,0,ncols-1,
data); }
234 {
return Use(0,nrows-1,0,ncols-1,
data); }
238 return Use(
a.GetRowLwb(),
a.GetRowUpb(),
239 a.GetColLwb(),
a.GetColUpb(),
a.GetMatrixArray());
244 return Use(
a.GetRowLwb(),
a.GetRowUpb(),
245 a.GetColLwb(),
a.GetColUpb(),
a.GetMatrixArray());
252 this->GetSub(row_lwb,row_upb,col_lwb,col_upb,tmp,
option);
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);
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);
270 return (fElements[arown*this->fNcols+acoln]);
276 const Int_t arown = rown-this->fRowLwb;
277 const Int_t acoln = coln-this->fColLwb;
278 if (arown >= this->fNrows || arown < 0) {
279 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",rown,this->fRowLwb,this->fRowLwb+this->fNrows);
282 if (acoln >= this->fNcols || acoln < 0) {
283 Error(
"operator()",
"Request column(%d) outside matrix range of %d - %d",coln,this->fColLwb,this->fColLwb+this->fNcols);
286 return (fElements[arown*this->fNcols+acoln]);
293template <
class Element>
296 assert(this->IsValid());
297 rown = rown - this->fRowLwb;
298 coln = coln - this->fColLwb;
299 assert((rown < this->fNrows && rown >= 0) &&
"SetElement() error: row index outside matrix range");
300 assert((coln < this->fNcols && coln >= 0) &&
"SetElement() error: column index outside matrix range");
301 fElements[rown * this->fNcols + coln] = val;
323#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
324#pragma GCC diagnostic push
325#pragma GCC diagnostic ignored "-Weffc++"
333#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
334#pragma GCC diagnostic pop
359template <
class Element>
void AMultB (
const Element *
const ap,
Int_t na,
Int_t ncolsa,
360 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp);
361template <
class Element>
void AtMultB(
const Element *
const ap,
Int_t ncolsa,
362 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp);
363template <
class Element>
void AMultBt(
const Element *
const ap,
Int_t na,
Int_t ncolsa,
364 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassDefOverride(name, id)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
TClass instances represent classes, structs and namespaces in the ROOT type system.
static Element & NaNValue()
Templates of Lazy Matrix classes.
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 override
Get submatrix [row_lwb..row_upb] x [col_lwb..col_upb]; The indexing range of the returned matrix depe...
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])
Int_t * GetColIndexArray() override
const TMatrixTRow_const< Element > operator[](Int_t rown) const
void Clear(Option_t *="") override
void Delete_m(Int_t size, Element *&)
Delete data pointer m, if it was assigned on the heap.
void SetElement(Int_t rown, Int_t coln, Element val)
Efficiently sets element (rown,coln) equal to val Index bound checks can be deactivated by defining N...
TMatrixT< Element > & operator*=(Element val)
Multiply every element of the matrix with val.
const Int_t * GetRowIndexArray() const override
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)
Element & operator()(Int_t rown, Int_t coln) override
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,...
const Int_t * GetColIndexArray() const override
const Element * GetMatrixArray() const override
void MultT(const TMatrixT< Element > &a, const TMatrixTSym< Element > &b)
void Minus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix subtraction. Replace this matrix with C such that C = A - B.
Element Similarity(const TVectorT< Element > &v) const
Calculate scalar v * (*this) * v^T.
TMatrixT< Element > & Use(Int_t nrows, Int_t ncols, Element *data)
void Plus(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix summation. Replace this matrix with C such that C = A + B.
TMatrixTBase< Element > & ResizeTo(const TMatrixT< Element > &m)
void Minus(const TMatrixTSym< Element > &a, const TMatrixT< Element > &b)
Element operator()(Int_t rown, Int_t coln) const override
TMatrixT< Element > & operator-=(Element val)
Subtract val from every element of the matrix.
Double_t Determinant() const override
Return the matrix determinant.
TMatrixT< Element > & Transpose(const TMatrixT< Element > &source)
Transpose matrix source.
TMatrixTBase< Element > & SetRowIndexArray(Int_t *) override
void MultT(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Replace this matrix with C such that C = A * B^T.
TMatrixT< Element > & InvertFast(Double_t *det=nullptr)
Invert the matrix and calculate its determinant, however upto (6x6) a fast Cramer inversion is used .
void TMult(const TMatrixTSym< Element > &a, const TMatrixTSym< Element > &b)
TMatrixTBase< Element > & SetColIndexArray(Int_t *) override
TMatrixTBase< Element > & SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase< Element > &source) override
Insert matrix source starting at [row_lwb][col_lwb], thereby overwriting the part [row_lwb....
Element * New_m(Int_t size)
Return data pointer .
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1) override
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
TMatrixT< Element > & Invert(Double_t *det=nullptr)
Invert the matrix and calculate its determinant.
TMatrixTRow< Element > operator[](Int_t rown)
Int_t * GetRowIndexArray() override
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,...
void TMult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
Replace this matrix with 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. Replace this matrix with 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
Element * GetMatrixArray() override
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 .