#include "TMatrixTSparse.h"

TMatrixTSparse<float>


class description - header file - source file
viewCVS header - viewCVS source

class TMatrixTSparse<float>: public TMatrixTBase<float>

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
TMatrixTSparse<float>()
TMatrixTSparse<float>(const TMatrixTSparse<float>& another)
TMatrixTSparse<float>(const TMatrixT<float>& another)
TMatrixTSparse<float>(Int_t nrows, Int_t ncols)
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>(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)
virtual~TMatrixTSparse<float>()
virtual TMatrixTBase<float>&TMatrixTBase<float>::Abs()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual TMatrixTBase<float>&TMatrixTBase<float>::Apply(const TElementActionT<float>& action)
virtual TMatrixTBase<float>&TMatrixTBase<float>::Apply(const TElementPosActionT<float>& action)
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual floatColNorm() const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")
virtual Double_tTMatrixTBase<float>::Determinant() const
virtual voidTMatrixTBase<float>::Determinant(Double_t& d1, Double_t& d2) const
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTMatrixTBase<float>::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
virtual floatTMatrixTBase<float>::E2Norm() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidExtractRow(Int_t row, Int_t col, float* v, Int_t n = -1) const
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual const Int_t*GetColIndexArray() const
virtual Int_t*GetColIndexArray()
Int_tTMatrixTBase<float>::GetColLwb() const
Int_tTMatrixTBase<float>::GetColUpb() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual voidGetMatrix2Array(float* data, Option_t* option = "") const
virtual const float*GetMatrixArray() const
virtual float*GetMatrixArray()
virtual const char*TObject::GetName() const
Int_tTMatrixTBase<float>::GetNcols() const
Int_tTMatrixTBase<float>::GetNoElements() const
Int_tTMatrixTBase<float>::GetNrows() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const Int_t*GetRowIndexArray() const
virtual Int_t*GetRowIndexArray()
Int_tTMatrixTBase<float>::GetRowLwb() const
Int_tTMatrixTBase<float>::GetRowUpb() const
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 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 const char*TObject::GetTitle() const
floatTMatrixTBase<float>::GetTol() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual TMatrixTBase<float>&InsertRow(Int_t row, Int_t col, const float* v, Int_t n = -1)
virtual voidTObject::Inspect() const
voidTMatrixTBase<float>::Invalidate()
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tTMatrixTBase<float>::IsOwner() const
virtual Bool_tTObject::IsSortable() const
virtual Bool_tIsSymmetric() const
Bool_tTMatrixTBase<float>::IsValid() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTMatrixTBase<float>::MakeValid()
virtual floatTMatrixTBase<float>::Max() const
voidTObject::MayNotUse(const char* method) const
virtual floatTMatrixTBase<float>::Min() const
voidMult(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b)
virtual Int_tNonZeros() const
floatTMatrixTBase<float>::Norm1() const
virtual TMatrixTBase<float>&NormByDiag(const TVectorT<float>&, Option_t*)
floatTMatrixTBase<float>::NormInf() const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
Bool_tTMatrixTBase<float>::operator!=(float val) const
virtual floatoperator()(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)
Bool_tTMatrixTBase<float>::operator<(float val) const
Bool_tTMatrixTBase<float>::operator<=(float val) const
TMatrixTSparse<float>&operator=(const TMatrixT<float>& source)
TMatrixTSparse<float>&operator=(const TMatrixTSparse<float>& source)
TMatrixTSparse<float>&operator=(float val)
Bool_tTMatrixTBase<float>::operator==(float val) const
Bool_tTMatrixTBase<float>::operator>(float val) const
Bool_tTMatrixTBase<float>::operator>=(float val) const
const TMatrixTSparseRow_const<float>operator[](Int_t rown) const
TMatrixTSparseRow<float>operator[](Int_t rown)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTMatrixTBase<float>::Print(Option_t* name = "") const
virtual TMatrixTBase<float>&Randomize(float alpha, float beta, Double_t& seed)
virtual TMatrixTSparse<float>&RandomizePD(float alpha, float beta, Double_t& seed)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
TMatrixTBase<float>&ResizeTo(const TMatrixTSparse<float>& m)
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)
virtual floatRowNorm() const
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual TMatrixTBase<float>&SetColIndexArray(Int_t* data)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
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)
static voidTObject::SetObjectStat(Bool_t stat)
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)
floatTMatrixTBase<float>::SetTol(float newTol)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual TMatrixTBase<float>&TMatrixTBase<float>::Shift(Int_t row_shift, Int_t col_shift)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual TMatrixTBase<float>&TMatrixTBase<float>::Sqr()
virtual TMatrixTBase<float>&TMatrixTBase<float>::Sqrt()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual floatTMatrixTBase<float>::Sum() const
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
TMatrixTSparse<float>&T()
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TMatrixTSparse<float>&Transpose(const TMatrixTSparse<float>& source)
virtual TMatrixTBase<float>&UnitMatrix()
TMatrixTSparse<float>&Use(TMatrixTSparse<float>& a)
TMatrixTSparse<float>&Use(Int_t nrows, Int_t ncols, Int_t nr_nonzeros, Int_t* pRowIndex, Int_t* pColIndex, float* pData)
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)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
virtual TMatrixTBase<float>&Zero()
protected:
voidAllocate(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)
voidAMinusB(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
voidAMinusB(const TMatrixTSparse<float>& a, const TMatrixT<float>& b, Int_t constr = 0)
voidAMinusB(const TMatrixT<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
voidAMultB(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
voidAMultB(const TMatrixTSparse<float>& a, const TMatrixT<float>& b, Int_t constr = 0)
voidAMultB(const TMatrixT<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
voidAMultBt(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
voidAMultBt(const TMatrixTSparse<float>& a, const TMatrixT<float>& b, Int_t constr = 0)
voidAMultBt(const TMatrixT<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
voidAPlusB(const TMatrixTSparse<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
voidAPlusB(const TMatrixTSparse<float>& a, const TMatrixT<float>& b, Int_t constr = 0)
voidAPlusB(const TMatrixT<float>& a, const TMatrixTSparse<float>& b, Int_t constr = 0)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
static voidTMatrixTBase<float>::DoubleLexSort(Int_t n, Int_t* first, Int_t* second, float* data)
static voidTMatrixTBase<float>::IndexedLexSort(Int_t n, Int_t* first, Int_t swapFirst, Int_t* second, Int_t swapSecond, Int_t* index)
voidTObject::MakeZombie()

Data Members

public:
enum EMatrixCreatorsOp1 { kZero
kUnit
kTransposed
kAtA
};
enum EMatrixCreatorsOp2 { kMult
kMultTranspose
kPlus
kMinus
};
enum TMatrixTBase::[unnamed] { kSizeMax
kWorkMax
};
enum TMatrixTBase::EMatrixStatusBits { kStatus
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
Int_t*fRowIndex[fNrowIndex] row index
Int_t*fColIndex[fNelems] column index
float*fElements[fNelems]
Int_tTMatrixTBase<float>::fNrowsnumber of rows
Int_tTMatrixTBase<float>::fNcolsnumber of columns
Int_tTMatrixTBase<float>::fRowLwblower bound of the row index
Int_tTMatrixTBase<float>::fColLwblower bound of the col index
Int_tTMatrixTBase<float>::fNelemsnumber of elements in matrix
Int_tTMatrixTBase<float>::fNrowIndexlength of row index array (= fNrows+1) wich is only used for sparse matrices
floatTMatrixTBase<float>::fTolsqrt(epsilon); epsilon is smallest number number so that 1+epsilon > 1
Bool_tTMatrixTBase<float>::fIsOwner!default kTRUE, when Use array kFALSE

Class Description

                                                                      
 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 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)
 Elementary constructors
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)
const Int_t * GetRowIndexArray()
Int_t * GetRowIndexArray()
const Int_t * GetColIndexArray()
Int_t * GetColIndexArray()
TMatrixTBase<Element> & SetRowIndexArray(Int_t *data)
{ memmove(fRowIndex,data,(this->fNrows+1)*sizeof(Int_t)); return *this; }
TMatrixTBase<Element> & SetColIndexArray(Int_t *data)
{ memmove(fColIndex,data,this->fNelems*sizeof(Int_t)); return *this; }
TMatrixTSparse<Element> & SetSparseIndexAB(const TMatrixTSparse<Element> &a,const TMatrixTSparse<Element> &b)
TMatrixTBase<Element> & ResizeTo(Int_t nrows,Int_t ncols,Int_t nr_nonzeros=-1)
TMatrixTBase<Element> & ResizeTo(Int_t row_lwb,Int_t row_upb,Int_t col_lwb,Int_t col_upb,Int_t nr_nonzeros=-1)
TMatrixTBase<Element> & ResizeTo(const TMatrixTSparse<Element> &m)
void Clear(Option_t * /*option*/ ="")
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")
TMatrixTBase<Element> & SetSub(Int_t row_lwb,Int_t col_lwb,const TMatrixTBase<Element> &source)
Bool_t IsSymmetric()
{ return (*this == TMatrixTSparse<Element>(kTransposed,*this)); }
void Mult(const TMatrixTSparse<Element> &a,const TMatrixTSparse<Element> &b)
{ AMultB(a,b,0); }
Int_t NonZeros()
{ return this->fNelems; }
TMatrixTBase<Element> & NormByDiag(const TVectorT<Element> &/*v*/,Option_t * /*option*/)
{ MayNotUse("NormByDiag"); return *this; }
Element operator()(Int_t rown,Int_t coln)
 Either access a_ij as a(i,j)
Element & operator()(Int_t rown,Int_t coln)
const TMatrixTSparseRow_const<Element> operator[](Int_t rown)
 or as a[i][j]
{ return TMatrixTSparseRow_const<Element>(*this,rown); }
TMatrixTSparseRow <Element> operator[](Int_t rown)
{ return TMatrixTSparseRow <Element>(*this,rown); }
TMatrixTSparse<Element> & operator=(const TMatrixT<Element> &source)
TMatrixTSparse<Element> & operator=(const TMatrixTSparse<Element> &source)
TMatrixTSparse<Element> & operator-=(Element val)
TMatrixTSparse<Element> & operator+=(Element val)
TMatrixTSparse<Element> & operator*=(Element val)
TMatrixTSparse<Element> & operator+=(const TMatrixTSparse<Element> &source)
TMatrixTSparse<Element> & operator+=(const TMatrixT<Element> &source)
APlusB(tmp,source,1)
TMatrixTSparse<Element> & operator-=(const TMatrixTSparse<Element> &source)
TMatrixTSparse<Element> & operator-=(const TMatrixT<Element> &source)
TMatrixTSparse<Element> & operator*=(const TMatrixTSparse<Element> &source)
TMatrixTSparse<Element> & operator*=(const TMatrixT<Element> &source)
AMultB(tmp,source,1)
TMatrixTSparse<Element> & RandomizePD(Element alpha,Element beta,Double_t &seed)
return Use(a.GetRowLwb(),a.GetRowUpb(),a.GetColLwb(),a.GetColUpb(), a.GetNoElements(),a.GetRowIndexArray(), a.GetColIndexArray(),a.GetMatrixArray())
this-> GetSub(row_lwb,row_upb,col_lwb,col_upb,tmp,option)

Last update: root/matrix:$Name: $:$Id: TMatrixTSparse.cxx,v 1.10 2006/10/06 06:52:34 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.