#include "TMatrixTSparse.h" |
TMatrixTSparse<float>
class description - header file - source file - inheritance tree (.pdf)
protected:
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)
void AMinusB(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
void AMinusB(const TMatrixTSparse<float>& a, const TMatrixT<float>& b, Int_t constr = 0)
void AMinusB(const TMatrixT<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
void AMultB(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
void AMultB(const TMatrixTSparse<float>& a, const TMatrixT<float>& b, Int_t constr = 0)
void AMultB(const TMatrixT<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
void AMultBt(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
void AMultBt(const TMatrixTSparse<float>& a, const TMatrixT<float>& b, Int_t constr = 0)
void AMultBt(const TMatrixT<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
void APlusB(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
void APlusB(const TMatrixTSparse<float>& a, const TMatrixT<float>& b, Int_t constr = 0)
void APlusB(const TMatrixT<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
public:
TMatrixTSparse<float>()
TMatrixTSparse<float>(Int_t nrows, Int_t ncols)
TMatrixTSparse<float>(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
TMatrixTSparse<float>(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros, Int_t* row, Int_t* col, float* data)
TMatrixTSparse<float>(const TMatrixTSparse<float>& another)
TMatrixTSparse<float>(const TMatrixT<float>& another)
TMatrixTSparse<float>(TMatrixTSparse<float>::EMatrixCreatorsOp1 op, const TMatrixTSparse<float>& prototype)
TMatrixTSparse<float>(const TMatrixTSparse<float>& a, TMatrixTSparse<float>::EMatrixCreatorsOp2 op, const TMatrixTSparse<float>& b)
TMatrixTSparse<float> GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t* option = "S") const
virtual ~TMatrixTSparse<float>()
static TClass* Class()
virtual void Clear(Option_t* = "")
virtual float ColNorm() const
virtual void ExtractRow(Int_t row, Int_t col, float* v, Int_t n = -1) const
virtual const Int_t* GetColIndexArray() const
virtual Int_t* GetColIndexArray()
virtual void GetMatrix2Array(float* data, Option_t* option = "") const
virtual const float* GetMatrixArray() const
virtual float* GetMatrixArray()
virtual const Int_t* GetRowIndexArray() const
virtual Int_t* GetRowIndexArray()
virtual TMatrixTBase<float>& GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, TMatrixTBase<float>& target, Option_t* option = "S") const
virtual TMatrixTBase<float>& InsertRow(Int_t row, Int_t col, const float* v, Int_t n = -1)
virtual TClass* IsA() const
virtual Bool_t IsSymmetric() const
void Mult(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b)
virtual Int_t NonZeros() const
virtual TMatrixTBase<float>& NormByDiag(const TVectorT<float>&, Option_t*)
virtual float operator()(Int_t rown, Int_t coln) const
virtual float& operator()(Int_t rown, Int_t coln)
TMatrixTSparse<float>& operator*=(float val)
TMatrixTSparse<float>& operator*=(const TMatrixTSparse<float>& source)
TMatrixTSparse<float>& operator*=(const TMatrixT<float>& source)
TMatrixTSparse<float>& operator+=(float val)
TMatrixTSparse<float>& operator+=(const TMatrixTSparse<float>& source)
TMatrixTSparse<float>& operator+=(const TMatrixT<float>& source)
TMatrixTSparse<float>& operator-=(float val)
TMatrixTSparse<float>& operator-=(const TMatrixTSparse<float>& source)
TMatrixTSparse<float>& operator-=(const TMatrixT<float>& source)
TMatrixTSparse<float>& operator=(const TMatrixT<float>& source)
TMatrixTSparse<float>& operator=(const TMatrixTSparse<float>& source)
TMatrixTSparse<float>& operator=(float val)
const TMatrixTSparseRow_const<float> operator[](Int_t rown) const
TMatrixTSparseRow<float> operator[](Int_t rown)
virtual TMatrixTBase<float>& Randomize(float alpha, float beta, Double_t& seed)
virtual TMatrixTSparse<float>& RandomizePD(float alpha, float beta, Double_t& seed)
virtual TMatrixTBase<float>& ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros = -1)
virtual TMatrixTBase<float>& ResizeTo(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros = -1)
TMatrixTBase<float>& ResizeTo(const TMatrixTSparse<float>& m)
virtual float RowNorm() const
virtual TMatrixTBase<float>& SetColIndexArray(Int_t* data)
virtual TMatrixTBase<float>& SetMatrixArray(const float* data, Option_t* = "")
virtual TMatrixTBase<float>& SetMatrixArray(Int_t nr_nonzeros, Int_t* irow, Int_t* icol, float* data)
virtual TMatrixTBase<float>& SetRowIndexArray(Int_t* data)
TMatrixTSparse<float>& SetSparseIndex(Int_t nelem_new)
TMatrixTSparse<float>& SetSparseIndex(const TMatrixTBase<float>& another)
TMatrixTSparse<float>& SetSparseIndexAB(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b)
virtual TMatrixTBase<float>& SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase<float>& source)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
TMatrixTSparse<float>& T()
TMatrixTSparse<float>& Transpose(const TMatrixTSparse<float>& source)
virtual TMatrixTBase<float>& UnitMatrix()
TMatrixTSparse<float>& 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, float* pData)
TMatrixTSparse<float>& Use(Int_t nrows, Int_t ncols, Int_t nr_nonzeros, Int_t* pRowIndex, Int_t* pColIndex, float* pData)
TMatrixTSparse<float>& Use(TMatrixTSparse<float>& a)
virtual TMatrixTBase<float>& Zero()
protected:
Int_t* fRowIndex [fNrowIndex] row index
Int_t* fColIndex [fNelems] column index
float* fElements [fNelems]
public:
static const TMatrixTSparse<float>::EMatrixCreatorsOp1 kZero
static const TMatrixTSparse<float>::EMatrixCreatorsOp1 kUnit
static const TMatrixTSparse<float>::EMatrixCreatorsOp1 kTransposed
static const TMatrixTSparse<float>::EMatrixCreatorsOp1 kAtA
static const TMatrixTSparse<float>::EMatrixCreatorsOp2 kMult
static const TMatrixTSparse<float>::EMatrixCreatorsOp2 kMultTranspose
static const TMatrixTSparse<float>::EMatrixCreatorsOp2 kPlus
static const TMatrixTSparse<float>::EMatrixCreatorsOp2 kMinus
TMatrixTSparse
Template class of a general sparse matrix in the Harwell-Boeing
format
Besides the usual shape/size decsriptors of a matrix like fNrows,
fRowLwb,fNcols and fColLwb, we also store a row index, fRowIndex and
column index, fColIndex only for those elements unequal zero:
fRowIndex[0,..,fNrows]: Stores for each row the index range of
the elements in the data and column array
fColIndex[0,..,fNelems-1]: Stores the column number for each data
element != 0
As an example how to access all sparse data elements:
for (Int_t irow = 0; irow < this->fNrows; irow++) {
const Int_t sIndex = fRowIndex[irow];
const Int_t eIndex = fRowIndex[irow+1];
for (Int_t index = sIndex; index < eIndex; index++) {
const Int_t icol = fColIndex[index];
const Element data = fElements[index];
printf("data(%d,%d) = %.4e\n",irow+this->fRowLwb,icol+
this->fColLwb,data);
}
}
When checking whether sparse matrices are compatible (like in an
assigment !), not only the shape parameters are compared but also
the sparse structure through fRowIndex and fColIndex .
Several methods exist to fill a sparse matrix with data entries.
Most are the same like for dense matrices but some care has to be
taken with regard to performance. In the constructor, always the
shape of the matrix has to be specified in some form . Data can be
entered through the following methods :
1. constructor
TMatrixTSparse(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,
Int_t col_upb,Int_t nr_nonzeros,
Int_t *row, Int_t *col,Element *data);
It uses SetMatrixArray(..), see below
2. copy constructors
3. SetMatrixArray(Int_t nr,Int_t *irow,Int_t *icol,Element *data)
where it is expected that the irow,icol and data array contain
nr entries . Only the entries with non-zero data[i] value are
inserted !
4. TMatrixTSparse a(n,m); for(....) { a(i,j) = ....
This is a very flexible method but expensive :
- if no entry for slot (i,j) is found in the sparse index table
it will be entered, which involves some memory management !
- before invoking this method in a loop it is smart to first
set the index table through a call to SetSparseIndex(..)
5. SetSub(Int_t row_lwb,Int_t col_lwb,const TMatrixTBase &source)
the matrix to be inserted at position (row_lwb,col_lwb) can be
both dense or sparse .
void AMultBt(const TMatrixTSparse<Element> &a,const TMatrixTSparse<Element> &b,Int_t constr=0)
void AMultBt(const TMatrixTSparse<Element> &a,const TMatrixT<Element> &b,Int_t constr=0)
void AMultBt(const TMatrixT<Element> &a,const TMatrixTSparse<Element> &b,Int_t constr=0)
void AMinusB(const TMatrixTSparse<Element> &a,const TMatrixTSparse<Element> &b,Int_t constr=0)
void AMinusB(const TMatrixTSparse<Element> &a,const TMatrixT<Element> &b,Int_t constr=0)
void AMinusB(const TMatrixT<Element> &a,const TMatrixTSparse<Element> &b,Int_t constr=0)
void Mult(const TMatrixTSparse<Element> &a,const TMatrixTSparse<Element> &b)
const TMatrixTSparseRow_const<Element> operator[](Int_t rown)
or as a[i][j]
Last update: root/matrix:$Name: $:$Id: TMatrixTSparse.cxx,v 1.8 2006/05/22 04:53:26 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.