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);
132 ((
const_cast<TMatrixT<Element> *
>(
this))->Use(row_lwb,row_upb,col_lwb,col_upb,
const_cast<Element *
>(
data))); }
146 return ResizeTo(
m.GetRowLwb(),
m.GetRowUpb(),
m.GetColLwb(),
m.GetColUpb());
169 inline TMatrixTRow <Element>
operator[](
Int_t rown) {
return TMatrixTRow <Element>(*
this,rown); }
178 Error(
"operator=(const TMatrixT2 &)",
"matrices not compatible");
229 {
return Use(0,nrows-1,0,ncols-1,
data); }
231 {
return Use(0,nrows-1,0,ncols-1,
data); }
235 return Use(
a.GetRowLwb(),
a.GetRowUpb(),
236 a.GetColLwb(),
a.GetColUpb(),
a.GetMatrixArray());
241 return Use(
a.GetRowLwb(),
a.GetRowUpb(),
242 a.GetColLwb(),
a.GetColUpb(),
a.GetMatrixArray());
249 this->GetSub(row_lwb,row_upb,col_lwb,col_upb,tmp,
option);
256 const Int_t arown = rown-this->fRowLwb;
257 const Int_t acoln = coln-this->fColLwb;
258 if (arown >= this->fNrows || arown < 0) {
259 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",rown,this->fRowLwb,this->fRowLwb+this->fNrows);
262 if (acoln >= this->fNcols || acoln < 0) {
263 Error(
"operator()",
"Request column(%d) outside matrix range of %d - %d",coln,this->fColLwb,this->fColLwb+this->fNcols);
267 return (fElements[arown*this->fNcols+acoln]);
273 const Int_t arown = rown-this->fRowLwb;
274 const Int_t acoln = coln-this->fColLwb;
275 if (arown >= this->fNrows || arown < 0) {
276 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",rown,this->fRowLwb,this->fRowLwb+this->fNrows);
279 if (acoln >= this->fNcols || acoln < 0) {
280 Error(
"operator()",
"Request column(%d) outside matrix range of %d - %d",coln,this->fColLwb,this->fColLwb+this->fNcols);
283 return (fElements[arown*this->fNcols+acoln]);
305#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
306#pragma GCC diagnostic push
307#pragma GCC diagnostic ignored "-Weffc++"
315#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
316#pragma GCC diagnostic pop
341template <
class Element>
void AMultB (
const Element *
const ap,
Int_t na,
Int_t ncolsa,
342 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp);
343template <
class Element>
void AtMultB(
const Element *
const ap,
Int_t ncolsa,
344 const Element *
const bp,
Int_t nb,
Int_t ncolsb,Element *cp);
345template <
class Element>
void AMultBt(
const Element *
const ap,
Int_t na,
Int_t ncolsa,
346 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)
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 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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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.
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 .