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());
187 void Assign (Element val);
188 void operator= (std::initializer_list<Element>
l);
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());
287 void Assign (Element val);
290 void operator= (std::initializer_list<Element>
l);
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];
562 void operator=(
const TMatrixTBase <Element> &
m);
#define ClassDef(name, id)
#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 r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
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< Element > * 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< Element > & operator=(const TMatrixTColumn_const< Element > &trc)
const Element * GetPtr() const
void operator+=(Element val)
Add val to every element of the matrix column.
Element & operator[](Int_t i)
const Element & operator[](Int_t i) const
Element & operator()(Int_t i)
TMatrixTColumn< Element > & operator=(const TMatrixTColumn< Element > &c)
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)
const Element * GetPtr() const
virtual ~TMatrixTDiag_const()
const Element & operator()(Int_t i) const
const Element & operator[](Int_t i) const
const TMatrixTBase< Element > * GetMatrix() const
const TMatrixTBase< Element > * 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*=(Element val)
Assign val to every element of the matrix diagonal.
const Element & operator[](Int_t i) const
const TMatrixTBase< Element > * 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.
Element & operator[](Int_t i)
TMatrixTFlat< Element > & operator=(const TMatrixTFlat< Element > &f)
const Element & operator[](Int_t i) const
Element & operator()(Int_t i)
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.
TMatrixTRow_const(const TMatrixTRow_const< Element > &trc)
virtual ~TMatrixTRow_const()
TMatrixTRow_const< Element > & operator=(const TMatrixTRow_const< Element > &trc)
const Element * GetPtr() const
const Element & operator()(Int_t i) const
Int_t GetRowIndex() const
const TMatrixTBase< Element > * fMatrix
const TMatrixTBase< Element > * GetMatrix() const
const Element & operator[](Int_t i) const
const Element & operator[](Int_t i) const
void Assign(Element val)
Assign val to every element of the matrix row.
TMatrixTRow< Element > & operator=(const TMatrixTRow< Element > &r)
const Element & operator()(Int_t i) const
void operator*=(Element val)
Multiply every element of the matrix row with val.
void operator+=(Element val)
Add val to every element of the matrix row.
void operator=(std::initializer_list< Element > l)
Element & operator()(Int_t i)
Element & operator[](Int_t i)
TMatrixTSparseDiag_const()
const Element * GetDataPtr() const
Element operator()(Int_t i) const
const TMatrixTSparse< Element > * fMatrix
const TMatrixTBase< Element > * GetMatrix() const
TMatrixTSparseDiag_const< Element > & operator=(const TMatrixTSparseDiag_const< Element > &trc)
Element operator[](Int_t i) const
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
TMatrixTSparseDiag< Element > & operator=(const TMatrixTSparseDiag< Element > &d)
void operator=(Element val)
Assign val to every element of the matrix diagonal.
void operator*=(Element val)
Multiply every element of the matrix diagonal by val.
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< Element > * fMatrix
virtual ~TMatrixTSparseRow_const()
TMatrixTSparseRow_const< Element > & operator=(const TMatrixTSparseRow_const< Element > &trc)
Int_t GetRowIndex() const
Element operator()(Int_t i) const
const TMatrixTBase< Element > * GetMatrix() const
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) const
Element * GetDataPtr() const
void operator*=(Element val)
Multiply every element of the matrix row by val.
Element operator()(Int_t i) const
TMatrixTSparseRow< Element > & operator=(const TMatrixTSparseRow< Element > &r)
const TMatrixTBase< Element > * fMatrix
virtual ~TMatrixTSub_const()
const TMatrixTBase< Element > * GetMatrix() const
const Element & operator()(Int_t rown, Int_t coln) const
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=(Element val)
Assign val to every element of the sub matrix.
TMatrixTSub< Element > & operator=(const TMatrixTSub< Element > &s)