12#ifndef ROOT_TMatrixTUtils
13#define ROOT_TMatrixTUtils
38#include <initializer_list>
40template<
class Element>
class TVectorT;
41template<
class Element>
class TMatrixT;
140 if (acoln < fMatrix->GetNcols() && acoln >= 0)
143 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
161 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
167 if (acoln < this->
fMatrix->GetNcols() || acoln >= 0)
168 return (this->
fPtr)[acoln];
170 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
171 i,this->
fMatrix->GetColLwb(),this->fMatrix->GetColLwb()+this->fMatrix->GetNcols());
179 if (acoln < this->
fMatrix->GetNcols() && acoln >= 0)
180 return (
const_cast<Element *
>(this->
fPtr))[acoln];
182 Error(
"operator()",
"Request col(%d) outside matrix range of %d - %d",
183 i,this->
fMatrix->GetColLwb(),this->fMatrix->GetColLwb()+this->fMatrix->GetNcols());
191 void Assign (Element val);
192 void operator= (std::initializer_list<Element>
l);
240 if (arown < fMatrix->GetNrows() && arown >= 0)
243 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
261 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
267 if (arown < this->
fMatrix->GetNrows() && arown >= 0)
268 return (this->
fPtr)[arown*this->
fInc];
270 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
271 i,this->
fMatrix->GetRowLwb(),this->fMatrix->GetRowLwb()+this->fMatrix->GetNrows());
280 if (arown < this->
fMatrix->GetNrows() && arown >= 0)
281 return (
const_cast<Element *
>(this->
fPtr))[arown*this->
fInc];
283 Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
284 i,this->
fMatrix->GetRowLwb(),this->fMatrix->GetRowLwb()+this->fMatrix->GetNrows());
291 void Assign (Element val);
294 void operator= (std::initializer_list<Element>
l);
339 if (i < fNdiag && i >= 0)
342 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,
fNdiag);
361 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
365 if (i < this->
fNdiag && i >= 0)
368 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
374 if (i < this->
fNdiag && i >= 0)
375 return (
const_cast<Element *
>(this->
fPtr))[i*this->
fInc];
377 Error(
"operator()",
"Request diagonal(%d) outside matrix range of 0 - %d",i,this->
fNdiag);
378 return (
const_cast<Element *
>(this->
fPtr))[0];
427 if (i < fNelems && i >= 0)
430 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,
fNelems);
447 inline Element *
GetPtr()
const {
return const_cast<Element *
>(this->
fPtr); }
451 if (i < this->
fNelems && i >= 0)
452 return (this->
fPtr)[i];
454 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,this->
fNelems);
460 if (i < this->
fNelems && i >= 0)
461 return (
const_cast<Element *
>(this->
fPtr))[i];
463 Error(
"operator()",
"Request element(%d) outside matrix range of 0 - %d",i,this->
fNelems);
515 const Element *ptr =
fMatrix->GetMatrixArray();
517 Error(
"operator()",
"Request row(%d) outside matrix range of 0 - %d",rown,
fNrowsSub);
521 Error(
"operator()",
"Request column(%d) outside matrix range of 0 - %d",coln,
fNcolsSub);
545 const Element *ptr = this->
fMatrix->GetMatrixArray();
546 if (rown >= this->
fNrowsSub || rown < 0) {
547 Error(
"operator()",
"Request row(%d) outside matrix range of 0 - %d",rown,this->
fNrowsSub);
550 if (coln >= this->
fNcolsSub || coln < 0) {
551 Error(
"operator()",
"Request column(%d) outside matrix range of 0 - %d",coln,this->
fNcolsSub);
555 return (
const_cast<Element *
>(ptr))[
index];
566 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)