12#ifndef ROOT_TMatrixTUtils
13#define ROOT_TMatrixTUtils
38#include <initializer_list>
40template<
class Element>
class TVectorT;
41template<
class Element>
class TMatrixT;
136 if (acoln < fMatrix->GetNcols() && acoln >= 0)
139 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
157 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
163 if (acoln < this->
fMatrix->GetNcols() || acoln >= 0)
164 return (this->
fPtr)[acoln];
166 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
167 i,this->
fMatrix->GetColLwb(),this->fMatrix->GetColLwb()+this->fMatrix->GetNcols());
175 if (acoln < this->
fMatrix->GetNcols() && acoln >= 0)
176 return (
const_cast<Element *
>(this->
fPtr))[acoln];
178 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
179 i,this->
fMatrix->GetColLwb(),this->fMatrix->GetColLwb()+this->fMatrix->GetNcols());
236 if (arown < fMatrix->GetNrows() && arown >= 0)
239 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
257 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
263 if (arown < this->
fMatrix->GetNrows() && arown >= 0)
264 return (this->
fPtr)[arown*this->
fInc];
266 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
267 i,this->
fMatrix->GetRowLwb(),this->fMatrix->GetRowLwb()+this->fMatrix->GetNrows());
276 if (arown < this->
fMatrix->GetNrows() && arown >= 0)
277 return (
const_cast<Element *
>(this->
fPtr))[arown*this->
fInc];
279 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
280 i,this->
fMatrix->GetRowLwb(),this->fMatrix->GetRowLwb()+this->fMatrix->GetNrows());
335 if (i < fNdiag && i >= 0)
338 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,
fNdiag);
357 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
361 if (i < this->
fNdiag && i >= 0)
364 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
370 if (i < this->
fNdiag && i >= 0)
371 return (
const_cast<Element *
>(this->
fPtr))[i*this->
fInc];
373 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
374 return (
const_cast<Element *
>(this->
fPtr))[0];
423 if (i < fNelems && i >= 0)
426 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,
fNelems);
443 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
447 if (i < this->
fNelems && i >= 0)
448 return (this->
fPtr)[i];
450 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,this->
fNelems);
456 if (i < this->
fNelems && i >= 0)
457 return (
const_cast<Element *
>(this->
fPtr))[i];
459 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,this->
fNelems);
511 const Element *ptr =
fMatrix->GetMatrixArray();
513 Error(
"operator()",
"Request row(%d) outside matrix range of 0 - %d",rown,
fNrowsSub);
517 Error(
"operator()",
"Request column(%d) outside matrix range of 0 - %d",coln,
fNcolsSub);
541 const Element *ptr = this->
fMatrix->GetMatrixArray();
542 if (rown >= this->
fNrowsSub || rown < 0) {
543 Error(
"operator()",
"Request row(%d) outside matrix range of 0 - %d",rown,this->
fNrowsSub);
546 if (coln >= this->
fNcolsSub || coln < 0) {
547 Error(
"operator()",
"Request column(%d) outside matrix range of 0 - %d",coln,this->
fNcolsSub);
551 return (
const_cast<Element *
>(ptr))[index];
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Double_t Drand(Double_t &ix)
Random number generator [0....1] with seed ix.
TElementActionT & operator=(const TElementActionT< Element > &)
virtual ~TElementActionT()
virtual void Operation(Element &element) const =0
virtual ~TElementPosActionT()
TElementPosActionT< Element > & operator=(const TElementPosActionT< Element > &)
virtual void Operation(Element &element) const =0
static Element & NaNValue()
const TMatrixTBase< Double_t > * fMatrix
Int_t GetColIndex() const
const Element & operator[](Int_t i) const
TMatrixTColumn_const(const TMatrixTColumn_const< Element > &trc)
const TMatrixTBase< Element > * GetMatrix() const
virtual ~TMatrixTColumn_const()
const Element & operator()(Int_t i) const
TMatrixTColumn_const(const TMatrixTSym< Element > &matrix, Int_t col)
Constructor with column "col" of matrix.
TMatrixTColumn_const< Element > & operator=(const TMatrixTColumn_const< Element > &trc)
const Element * GetPtr() const
TMatrixTColumn_const(const TMatrixT< Element > &matrix, Int_t col)
Constructor with column "col" of matrix.
void operator*=(const TMatrixTColumn_const< Element > &c)
Multiply every element of the matrix column with the corresponding element of column mc.
TMatrixTColumn(TMatrixTSym< Element > &matrix, Int_t col)
Constructor with column "col" of matrix.
void operator+=(const TMatrixTColumn_const< Element > &c)
Add to every element of the matrix row the corresponding element of row mc.
void operator+=(Element val)
Add val to every element of the matrix column.
TMatrixTColumn(TMatrixT< Element > &matrix, Int_t col)
Constructor with column "col" of matrix.
Element & operator[](Int_t i)
const Element & operator[](Int_t i) const
TMatrixTColumn(const TMatrixTColumn< Element > &mc)
Copy constructor.
Element & operator()(Int_t i)
TMatrixTColumn< Element > & operator=(const TMatrixTColumn< Element > &c)
void operator=(const TMatrixTColumn_const< Element > &c)
Assignment operator.
void operator=(const TVectorT< Element > &vec)
Assign a vector to a matrix column.
void operator=(Element val)
void Assign(Element val)
Assign val to every element of the matrix column.
const Element & operator()(Int_t i) const
void operator*=(Element val)
Multiply every element of the matrix column with val.
TMatrixTDiag_const(const TMatrixTDiag_const< Element > &trc)
TMatrixTDiag_const< Element > & operator=(const TMatrixTDiag_const< Element > &trc)
TMatrixTDiag_const(const TMatrixTSym< Element > &matrix)
Constructor.
const Element * GetPtr() const
virtual ~TMatrixTDiag_const()
TMatrixTDiag_const(const TMatrixT< Element > &matrix)
Constructor.
const Element & operator()(Int_t i) const
const Element & operator[](Int_t i) const
const TMatrixTBase< Element > * GetMatrix() const
const TMatrixTBase< Double_t > * fMatrix
Element & operator[](Int_t i)
Element & operator()(Int_t i)
void operator+=(Element val)
Assign val to every element of the matrix diagonal.
void operator=(Element val)
Assign val to every element of the matrix diagonal.
const Element & operator[](Int_t i) const
const Element & operator()(Int_t i) const
TMatrixTDiag< Element > & operator=(const TMatrixTDiag< Element > &d)
void operator=(const TMatrixTDiag_const< Element > &d)
Assignment operator.
void operator=(const TVectorT< Element > &vec)
Assign a vector to the matrix diagonal.
void operator*=(const TMatrixTDiag_const< Element > &d)
Multiply every element of the matrix diagonal with the corresponding element of diagonal md.
void operator*=(Element val)
Assign val to every element of the matrix diagonal.
TMatrixTDiag(TMatrixTSym< Element > &matrix)
Constructor.
TMatrixTDiag(const TMatrixTDiag< Element > &md)
Copy constructor.
void operator+=(const TMatrixTDiag_const< Element > &d)
Add to every element of the matrix diagonal the corresponding element of diagonal md.
TMatrixTDiag(TMatrixT< Element > &matrix)
Constructor.
TMatrixTFlat_const(const TMatrixT< Element > &matrix)
Constructor.
TMatrixTFlat_const(const TMatrixTSym< Element > &matrix)
Constructor.
const Element & operator[](Int_t i) const
const TMatrixTBase< Double_t > * fMatrix
TMatrixTFlat_const< Element > & operator=(const TMatrixTFlat_const< Element > &trc)
const TMatrixTBase< Element > * GetMatrix() const
const Element * GetPtr() const
const Element & operator()(Int_t i) const
virtual ~TMatrixTFlat_const()
TMatrixTFlat_const(const TMatrixTFlat_const< Element > &trc)
void operator+=(Element val)
Add val to every element of the matrix.
TMatrixTFlat(TMatrixT< Element > &matrix)
Constructor.
Element & operator[](Int_t i)
TMatrixTFlat(TMatrixTSym< Element > &matrix)
Constructor.
TMatrixTFlat(const TMatrixTFlat< Element > &mf)
Copy constructor.
void operator=(const TMatrixTFlat_const< Element > &f)
Assignment operator.
TMatrixTFlat< Element > & operator=(const TMatrixTFlat< Element > &f)
const Element & operator[](Int_t i) const
Element & operator()(Int_t i)
void operator*=(const TMatrixTFlat_const< Element > &f)
Multiply every element of the matrix with the corresponding element of diagonal mf.
const Element & operator()(Int_t i) const
void operator*=(Element val)
Multiply every element of the matrix with val.
void operator=(Element val)
Assign val to every element of the matrix.
void operator=(const TVectorT< Element > &vec)
Assign a vector to the matrix. The matrix is traversed row-wise.
void operator+=(const TMatrixTFlat_const< Element > &f)
Add to every element of the matrix the corresponding element of matrix mf.
TMatrixTRow_const(const TMatrixTRow_const< Element > &trc)
virtual ~TMatrixTRow_const()
TMatrixTRow_const< Element > & operator=(const TMatrixTRow_const< Element > &trc)
TMatrixTRow_const(const TMatrixT< Element > &matrix, Int_t row)
Constructor with row "row" of matrix.
const Element * GetPtr() const
const Element & operator()(Int_t i) const
Int_t GetRowIndex() const
const TMatrixTBase< Double_t > * fMatrix
TMatrixTRow_const(const TMatrixTSym< Element > &matrix, Int_t row)
Constructor with row "row" of symmetric matrix.
const TMatrixTBase< Element > * GetMatrix() const
const Element & operator[](Int_t i) const
const Element & operator[](Int_t i) const
void operator*=(const TMatrixTRow_const< Element > &r)
Multiply every element of the matrix row with the corresponding element of row r.
TMatrixTRow(TMatrixTSym< Element > &matrix, Int_t row)
Constructor with row "row" of symmetric matrix.
void Assign(Element val)
Assign val to every element of the matrix row.
TMatrixTRow< Element > & operator=(const TMatrixTRow< Element > &r)
TMatrixTRow(const TMatrixTRow< Element > &mr)
Copy constructor.
const Element & operator()(Int_t i) const
void operator*=(Element val)
Multiply every element of the matrix row with val.
void operator=(const TMatrixTRow_const< Element > &r)
Assignment operator.
void operator+=(Element val)
Add val to every element of the matrix row.
void operator=(std::initializer_list< Element > l)
void operator+=(const TMatrixTRow_const< Element > &r)
Add to every element of the matrix row the corresponding element of row r.
TMatrixTRow(TMatrixT< Element > &matrix, Int_t row)
Constructor with row "row" of symmetric matrix.
Element & operator()(Int_t i)
Element & operator[](Int_t i)
void operator=(const TVectorT< Element > &vec)
Assign a vector to a matrix row.
TMatrixTSparseDiag_const()
const Element * GetDataPtr() const
Element operator()(Int_t i) const
const TMatrixTSparse< Double_t > * fMatrix
TMatrixTSparseDiag_const(const TMatrixTSparse< Element > &matrix)
Constructor.
const TMatrixTBase< Element > * GetMatrix() const
TMatrixTSparseDiag_const< Element > & operator=(const TMatrixTSparseDiag_const< Element > &trc)
Element operator[](Int_t i) const
const Double_t * fDataPtr
virtual ~TMatrixTSparseDiag_const()
TMatrixTSparseDiag_const(const TMatrixTSparseDiag_const< Element > &trc)
Element & operator[](Int_t i)
Element operator[](Int_t i) const
Element operator()(Int_t i) const
Element & operator()(Int_t i)
operator() : pick element diag(i)
TMatrixTSparseDiag(const TMatrixTSparseDiag< Element > &md)
Constructor.
void operator*=(const TMatrixTSparseDiag_const< Element > &d)
Multiply every element of the matrix diagonal with the corresponding element of diagonal md.
void operator+=(const TMatrixTSparseDiag_const< Element > &d)
Add to every element of the matrix diagonal the corresponding element of diagonal md.
TMatrixTSparseDiag< Element > & operator=(const TMatrixTSparseDiag< Element > &d)
void operator=(Element val)
Assign val to every element of the matrix diagonal.
void operator=(const TVectorT< Element > &vec)
Assign a vector to the matrix diagonal.
void operator*=(Element val)
Multiply every element of the matrix diagonal by val.
void operator=(const TMatrixTSparseDiag_const< Element > &d)
Assignment operator.
TMatrixTSparseDiag(TMatrixTSparse< Element > &matrix)
Constructor.
void operator+=(Element val)
Add val to every element of the matrix diagonal.
Element * GetDataPtr() const
const Int_t * GetColPtr() const
TMatrixTSparseRow_const(const TMatrixTSparseRow_const< Element > &trc)
Element operator[](Int_t i) const
TMatrixTSparseRow_const()
const Element * GetDataPtr() const
const TMatrixTSparse< Double_t > * fMatrix
virtual ~TMatrixTSparseRow_const()
TMatrixTSparseRow_const< Element > & operator=(const TMatrixTSparseRow_const< Element > &trc)
Int_t GetRowIndex() const
Element operator()(Int_t i) const
TMatrixTSparseRow_const(const TMatrixTSparse< Element > &matrix, Int_t row)
Constructor with row "row" of matrix.
const Double_t * fDataPtr
const TMatrixTBase< Element > * GetMatrix() const
TMatrixTSparseRow(const TMatrixTSparseRow< Element > &mr)
Copy constructor.
void operator+=(Element val)
Add val to every non-zero (!) element of the matrix row.
void operator=(Element val)
Assign val to every non-zero (!) element of the matrix row.
Element & operator[](Int_t i)
Element & operator()(Int_t i)
operator() : pick element row(i)
Element operator[](Int_t i) const
void operator=(const TMatrixTSparseRow_const< Element > &r)
Assignment operator.
TMatrixTSparseRow(TMatrixTSparse< Element > &matrix, Int_t row)
Constructor with row "row" of matrix.
Element * GetDataPtr() const
void operator*=(Element val)
Multiply every element of the matrix row by val.
void operator=(const TVectorT< Element > &vec)
Assign a vector to a matrix row.
Element operator()(Int_t i) const
void operator*=(const TMatrixTSparseRow_const< Element > &r)
Multiply every element of the matrix row with the corresponding element of row r.
TMatrixTSparseRow< Element > & operator=(const TMatrixTSparseRow< Element > &r)
void operator+=(const TMatrixTSparseRow_const< Element > &r)
Add to every element of the matrix row the corresponding element of row r.
const TMatrixTBase< Double_t > * fMatrix
virtual ~TMatrixTSub_const()
TMatrixTSub_const(const TMatrixTSym< Element > &matrix, Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
make a reference to submatrix [row_lwbs..row_upbs][col_lwbs..col_upbs]; The indexing range of the ref...
const TMatrixTBase< Element > * GetMatrix() const
TMatrixTSub_const(const TMatrixT< Element > &matrix, Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
make a reference to submatrix [row_lwbs..row_upbs][col_lwbs..col_upbs]; The indexing range of the ref...
const Element & operator()(Int_t rown, Int_t coln) const
TMatrixTSub(TMatrixT< Element > &matrix, Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
Constructor.
void operator+=(const TMatrixTSub_const< Element > &s)
Add to every element of the submatrix the corresponding element of submatrix ms.
void Rank1Update(const TVectorT< Element > &vec, Element alpha=1.0)
Perform a rank 1 operation on the matrix: A += alpha * v * v^T.
void operator*=(Element val)
Multiply every element of the sub matrix by val .
Element & operator()(Int_t rown, Int_t coln)
void operator+=(Element val)
Add val to every element of the sub matrix.
void operator*=(const TMatrixT< Element > &m)
Multiply submatrix with matrix source.
void operator*=(const TMatrixTSym< Element > &m)
Multiply submatrix with matrix source.
void operator=(Element val)
Assign val to every element of the sub matrix.
void operator+=(const TMatrixTBase< Element > &m)
Add to every element of the submatrix the corresponding element of matrix mt.
void operator=(const TMatrixTBase< Element > &m)
Assignment operator.
TMatrixTSub< Element > & operator=(const TMatrixTSub< Element > &s)
void operator=(const TMatrixTSub_const< Element > &s)
Assignment operator.
void operator*=(const TMatrixTSub_const< Element > &s)
Multiply submatrix with submatrix ms.
TMatrixTSub(TMatrixTSym< Element > &matrix, Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
Constructor.
TMatrixTSub(const TMatrixTSub< Element > &ms)
Copy constructor.