12 #ifndef ROOT_TMatrixTSparse
13 #define ROOT_TMatrixTSparse
20 #include <vecLib/vBLAS.h>
33 template<
class Element>
class TMatrixT;
126 Int_t *pRowIndex,
Int_t *pColIndex,Element *pData);
128 const Int_t *pRowIndex,
const Int_t *pColIndex,
const Element *pData)
const
131 const_cast<Int_t *>(pRowIndex),
132 const_cast<Int_t *>(pColIndex),
133 const_cast<Element *>(pData))); }
135 Int_t *pRowIndex,
Int_t *pColIndex,Element *pData);
137 const Int_t *pRowIndex,
const Int_t *pColIndex,
const Element *pData)
const;
155 virtual Element
RowNorm ()
const;
156 virtual Element
ColNorm ()
const;
160 {
MayNotUse(
"NormByDiag");
return *
this; }
179 if (
this == &source)
APlusB (tmp,tmp,1);
180 else APlusB (tmp,source,1);
183 APlusB(tmp,source,1);
return *
this; }
185 if (
this == &source)
AMinusB (tmp,tmp,1);
189 AMinusB(tmp,source,1);
return *
this; }
191 if (
this == &source)
AMultB (tmp,tmp,1);
192 else AMultB (tmp,source,1);
222 template <
class Element>
224 Int_t *pRowIndex,
Int_t *pColIndex,Element *pData)
225 {
return Use(0,nrows-1,0,ncols-1,nr_nonzeros,pRowIndex,pColIndex,pData); }
226 template <
class Element>
228 const Int_t *pRowIndex,
const Int_t *pColIndex,
const Element *pData)
const
229 {
return Use(0,nrows-1,0,ncols-1,nr_nonzeros,pRowIndex,pColIndex,pData); }
230 template <
class Element>
236 template <
class Element>
243 template <
class Element>
248 this->GetSub(row_lwb,row_upb,col_lwb,col_upb,tmp,option);
void AMinusB(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
General matrix subtraction.
virtual TMatrixTBase< Element > & InsertRow(Int_t row, Int_t col, const Element *v, Int_t n=-1)
Insert in row rown, n elements of array v at column coln.
virtual void GetMatrix2Array(Element *data, Option_t *="") const
Copy matrix data to array . It is assumed that array is of size >= fNelems.
TMatrixTSparse< Element > & operator*=(const TMatrixT< Element > &source)
TMatrixTSparse< Element > & Transpose(const TMatrixTSparse< Element > &source)
Transpose a matrix.
virtual Int_t NonZeros() const
Compute the number of elements != 0.0.
virtual const Element * GetMatrixArray() const
virtual TMatrixTBase< Element > & UnitMatrix()
Make a unit matrix (matrix need not be a square one).
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...
Int_t GetNoElements() const
virtual TMatrixTBase< Element > & SetMatrixArray(const Element *data, Option_t *="")
Copy array data to matrix .
TMatrixTSparse< Element > & operator+=(const TMatrixT< Element > &source)
TMatrixTSparse< Element > & operator-=(const TMatrixTSparse< Element > &source)
virtual ~TMatrixTSparse()
virtual Element RowNorm() const
Row matrix norm, MAX{ SUM{ |M(i,j)|, over j}, over i}.
double beta(double x, double y)
Calculates the beta function.
void AMultB(const TMatrixTSparse< Element > &a, const TMatrixT< Element > &b, Int_t constr=0)
virtual TMatrixTBase< Element > & NormByDiag(const TVectorT< Element > &, Option_t *)
option:
#define ClassDef(name, id)
virtual TMatrixTBase< Element > & SetRowIndexArray(Int_t *data)
TTime operator-(const TTime &t1, const TTime &t2)
TMatrixTSparseRow< Element > operator[](Int_t rown)
TMatrixTSparse< Element > & operator*=(const TMatrixTSparse< Element > &source)
virtual TMatrixTBase< Element > & Randomize(Element alpha, Element beta, Double_t &seed)
randomize matrix element values
void AMultBt(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
General matrix multiplication.
void APlusB(const TMatrixT< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
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 .
virtual TMatrixTSparse< Element > & RandomizePD(Element alpha, Element beta, Double_t &seed)
randomize matrix element values but keep matrix symmetric positive definite
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
virtual Bool_t IsSymmetric() const
Check whether matrix is symmetric.
TMatrixTSparse< Element > & SetSparseIndexAB(const TMatrixTSparse< Element > &a, const TMatrixT< Element > &b)
TMatrixTBase< Element > & ResizeTo(const TMatrixTSparse< Element > &m)
TMatrixTSparse< Element > & operator-=(Element val)
Subtract val from every element of the matrix.
const TMatrixTSparse< Element > & Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros, const Int_t *pRowIndex, const Int_t *pColIndex, const Element *pData) const
virtual TMatrixTBase< Element > & Zero()
Set matrix elements to zero.
virtual const Int_t * GetRowIndexArray() const
virtual Element ColNorm() const
Column matrix norm, MAX{ SUM{ |M(i,j)|, over i}, over j}.
virtual void Clear(Option_t *="")
TTime operator*(const TTime &t1, const TTime &t2)
TMatrixTSparse< Element > & operator*=(Element val)
Multiply every element of the matrix with val.
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
TMatrixTSparse< Element > & SetSparseIndex(Int_t nelem_new)
Increase/decrease the number of non-zero elements to nelems_new.
The ROOT global object gROOT contains a list of all defined classes.
TMatrixTSparse< Element > & T()
void Allocate(Int_t nrows, Int_t ncols, Int_t row_lwb=0, Int_t col_lwb=0, Int_t init=0, Int_t nr_nonzeros=0)
Allocate new matrix.
virtual TMatrixTBase< Element > & SetColIndexArray(Int_t *data)
TMatrixTSparse< Element > & Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros, Int_t *pRowIndex, Int_t *pColIndex, Element *pData)
Element operator()(Int_t rown, Int_t coln) const
TMatrixTSparse< Element > & SetSparseIndexAB(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b)
Set the row/column indices to the "sum" of matrices a and b It is checked that enough space has been ...
TMatrixT< Element > & ElementDiv(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Divide target by the source, element-by-element.
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO...> &to, const THist< DIMENSIONS, PRECISION_FROM, STAT_FROM...> &from)
Add two histograms.
virtual const Int_t * GetColIndexArray() const
TMatrixTSparse< Element > & operator+=(const TMatrixTSparse< Element > &source)
TMatrixTSparse< Element > & operator-=(const TMatrixT< Element > &source)
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros=-1)
Set size of the matrix to nrows x ncols with nr_nonzeros non-zero entries if nr_nonzeros > 0 ...
TMatrixTSparse< Element > & operator+=(Element val)
Add val to every element of the matrix.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual void ExtractRow(Int_t row, Int_t col, Element *v, Int_t n=-1) const
Store in array v, n matrix elements of row rown starting at column coln.
virtual 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
Get submatrix [row_lwb..row_upb][col_lwb..col_upb]; The indexing range of the returned matrix depends...
TMatrixTSparse< Element > & operator=(const TMatrixT< Element > &source)
Notice that the sparsity of the matrix is NOT changed : its fRowIndex/fColIndex are used ! ...
void AMultB(const TMatrixT< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
void Mult(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b)
void AMultB(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
void APlusB(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
General matrix addition.
virtual TMatrixTBase< Element > & SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase< Element > &source)
Insert matrix source starting at [row_lwb][col_lwb], thereby overwriting the part [row_lwb...
const TMatrixTSparseRow_const< Element > operator[](Int_t rown) const