12 #ifndef ROOT_TMatrixTUtils
13 #define ROOT_TMatrixTUtils
38 template<
class Element>
class TVectorT;
39 template<
class Element>
class TMatrixT;
66 virtual void Operation(Element &element)
const = 0;
98 virtual void Operation(Element &element)
const = 0;
138 if (acoln < fMatrix->GetNcols() && acoln >= 0)
141 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
159 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
165 if (acoln < this->
fMatrix->GetNcols() || acoln >= 0)
166 return (this->
fPtr)[acoln];
168 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
177 if (acoln < this->
fMatrix->GetNcols() && acoln >= 0)
178 return (const_cast<Element *>(this->
fPtr))[acoln];
180 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
189 void Assign (Element val);
190 void operator= (std::initializer_list<Element>
l);
238 if (arown < fMatrix->GetNrows() && arown >= 0)
241 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
259 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
265 if (arown < this->
fMatrix->GetNrows() && arown >= 0)
266 return (this->
fPtr)[arown*this->
fInc];
268 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
278 if (arown < this->
fMatrix->GetNrows() && arown >= 0)
279 return (const_cast<Element *>(this->
fPtr))[arown*this->
fInc];
281 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
289 void Assign (Element val);
292 void operator= (std::initializer_list<Element>
l);
337 if (i < fNdiag && i >= 0)
340 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,
fNdiag);
359 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
363 if (i < this->
fNdiag && i >= 0)
366 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
372 if (i < this->
fNdiag && i >= 0)
373 return (const_cast<Element *>(this->
fPtr))[i*this->
fInc];
375 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
376 return (const_cast<Element *>(this->
fPtr))[0];
425 if (i < fNelems && i >= 0)
428 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,
fNelems);
445 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
449 if (i < this->
fNelems && i >= 0)
450 return (this->
fPtr)[i];
452 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,this->
fNelems);
458 if (i < this->
fNelems && i >= 0)
459 return (const_cast<Element *>(this->
fPtr))[i];
461 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,this->
fNelems);
513 const Element *ptr =
fMatrix->GetMatrixArray();
515 Error(
"operator()",
"Request row(%d) outside matrix range of 0 - %d",rown,
fNrowsSub);
519 Error(
"operator()",
"Request column(%d) outside matrix range of 0 - %d",coln,
fNcolsSub);
543 const Element *ptr = this->
fMatrix->GetMatrixArray();
544 if (rown >= this->
fNrowsSub || rown < 0) {
545 Error(
"operator()",
"Request row(%d) outside matrix range of 0 - %d",rown,this->
fNrowsSub);
548 if (coln >= this->
fNcolsSub || coln < 0) {
549 Error(
"operator()",
"Request column(%d) outside matrix range of 0 - %d",coln,this->
fNcolsSub);
553 return (const_cast<Element *>(ptr))[index];
Element operator[](Int_t i) const
void Rank1Update(const TVectorT< Element > &vec, Element alpha=1.0)
Perform a rank 1 operation on the matrix: A += alpha * v * v^T.
const TMatrixTSparse< Element > * fMatrix
Element operator()(Int_t i) const
TMatrixTSparseDiag_const< Element > & operator=(const TMatrixTSparseDiag_const< Element > &trc)
const Element & operator[](Int_t i) const
const Element & operator()(Int_t i) const
const Element & operator[](Int_t i) const
Element & operator()(Int_t i)
Int_t GetRowIndex() const
void operator+=(Element val)
Add val to every element of the matrix column.
const Element & operator()(Int_t i) const
virtual ~TMatrixTSparseDiag_const()
void operator*=(Element val)
Multiply every element of the matrix with val.
TMatrixTSparseRow< Element > & operator=(const TMatrixTSparseRow< Element > &r)
TMatrixTSparseDiag_const()
const TMatrixTBase< Element > * fMatrix
void Assign(Element val)
Assign val to every element of the matrix row.
TMatrixTFlat_const(const TMatrixTFlat_const< Element > &trc)
void operator+=(Element val)
Assign val to every element of the matrix diagonal.
const Element & operator()(Int_t i) const
void operator*=(Element val)
Multiply every element of the sub matrix by val .
const TMatrixTBase< Element > * GetMatrix() const
Element & operator()(Int_t i)
TMatrixTColumn< Element > & operator=(const TMatrixTColumn< Element > &c)
void operator=(Element val)
Assign val to every element of the matrix diagonal.
const Element & operator[](Int_t i) const
void operator+=(Element val)
Add val to every non-zero (!) element of the matrix row.
Element & operator()(Int_t i)
void operator*=(Element val)
Multiply every element of the matrix row with val.
TMatrixTSparseRow_const< Element > & operator=(const TMatrixTSparseRow_const< Element > &trc)
TMatrixTSub< Element > & operator=(const TMatrixTSub< Element > &s)
const Element & operator()(Int_t rown, Int_t coln) const
const TMatrixTBase< Element > * GetMatrix() const
Element & operator()(Int_t rown, Int_t coln)
void operator=(std::initializer_list< Element > l)
Element operator[](Int_t i) const
TMatrixTDiag_const< Element > & operator=(const TMatrixTDiag_const< Element > &trc)
virtual ~TElementPosActionT()
#define ClassDef(name, id)
TMatrixTSparseRow_const()
Element operator()(Int_t i) const
virtual void Operation(Element &element) const =0
TMatrixTSparseDiag_const(const TMatrixTSparseDiag_const< Element > &trc)
const TMatrixTBase< Element > * fMatrix
Element operator()(Int_t i) const
Element & operator[](Int_t i)
void operator*=(Element val)
Multiply every element of the matrix diagonal by val.
const Element & operator()(Int_t i) const
const Element & operator[](Int_t i) const
TMatrixTSparseDiag< Element > & operator=(const TMatrixTSparseDiag< Element > &d)
const Element & operator()(Int_t i) const
Element * GetDataPtr() const
const TMatrixTBase< Element > * GetMatrix() const
void Error(const char *location, const char *msgfmt,...)
virtual ~TMatrixTSub_const()
void operator=(Element val)
void operator=(Element val)
Assign val to every element of the matrix.
TMatrixTDiag< Element > & operator=(const TMatrixTDiag< Element > &d)
const Element * GetDataPtr() const
Element & operator[](Int_t i)
const Element & operator[](Int_t i) const
TMatrixTColumn_const< Element > & operator=(const TMatrixTColumn_const< Element > &trc)
TMatrixTSparseRow_const(const TMatrixTSparseRow_const< Element > &trc)
const TMatrixTBase< Element > * GetMatrix() const
Element operator[](Int_t i) const
Element operator[](Int_t i) const
const Int_t * GetColPtr() const
Element * GetDataPtr() const
Int_t GetColIndex() const
const Element & operator()(Int_t i) const
const Element & operator()(Int_t i) const
const Element & operator[](Int_t i) const
const TMatrixTBase< Element > * GetMatrix() const
Element & operator[](Int_t i)
const TMatrixTBase< Element > * fMatrix
Int_t GetRowIndex() const
TMatrixTRow< Element > & operator=(const TMatrixTRow< Element > &r)
void operator+=(Element val)
Add val to every element of the sub matrix.
TElementActionT & operator=(const TElementActionT< Element > &)
virtual ~TMatrixTRow_const()
const Element & operator()(Int_t i) const
void Assign(Element val)
Assign val to every element of the matrix column.
virtual ~TMatrixTFlat_const()
const TMatrixTBase< Element > * GetMatrix() const
void operator+=(Element val)
Add val to every element of the matrix.
Element & operator[](Int_t i)
TMatrixTRow_const< Element > & operator=(const TMatrixTRow_const< Element > &trc)
void operator=(Element val)
Assign val to every element of the sub matrix.
const Element * GetPtr() const
void operator+=(Element val)
Add val to every element of the matrix diagonal.
TMatrixTRow_const(const TMatrixTRow_const< Element > &trc)
const Element & operator[](Int_t i) const
const Element * GetPtr() const
virtual void Operation(Element &element) const =0
const TMatrixTSparse< Element > * fMatrix
virtual ~TElementActionT()
const TMatrixTBase< Element > * fMatrix
TMatrixTDiag_const(const TMatrixTDiag_const< Element > &trc)
void operator*=(Element val)
Multiply every element of the matrix row by val.
Element & operator[](Int_t i)
const Element * GetPtr() const
const TMatrixTBase< Element > * GetMatrix() const
const Element * GetPtr() const
void operator*=(Element val)
Multiply every element of the matrix column with val.
virtual ~TMatrixTDiag_const()
const Element * GetDataPtr() const
Element operator()(Int_t i) const
static Element & NaNValue()
void operator=(Element val)
Assign val to every non-zero (!) element of the matrix row.
Element & operator()(Int_t i)
virtual ~TMatrixTColumn_const()
const TMatrixTBase< Element > * fMatrix
void operator*=(Element val)
Assign val to every element of the matrix diagonal.
TMatrixTColumn_const(const TMatrixTColumn_const< Element > &trc)
virtual ~TMatrixTSparseRow_const()
Double_t Drand(Double_t &ix)
Random number generator [0....1] with seed ix.
void operator+=(Element val)
Add val to every element of the matrix row.
TMatrixTFlat_const< Element > & operator=(const TMatrixTFlat_const< Element > &trc)
Element & operator[](Int_t i)
TMatrixTFlat< Element > & operator=(const TMatrixTFlat< Element > &f)
void operator=(Element val)
Assign val to every element of the matrix diagonal.
TElementPosActionT< Element > & operator=(const TElementPosActionT< Element > &)
const Element & operator[](Int_t i) const