#include "TMatrixTSparse.h"

TMatrixTSparse


class description - source file - inheritance tree (.pdf)

class TMatrixTSparse : public TMatrixTBase<double>

Inheritance Chart:
TObject
<-
TMatrixTBase<double>
<-
TMatrixTSparse<double>

    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<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1) void AMinusB(const TMatrixTSparse<double>& a, const TMatrixT<double>& b, Int_t constr = 1) void AMinusB(const TMatrixT<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1) void AMultB(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1) void AMultB(const TMatrixTSparse<double>& a, const TMatrixT<double>& b, Int_t constr = 1) void AMultB(const TMatrixT<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1) void AMultBt(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1) void AMultBt(const TMatrixTSparse<double>& a, const TMatrixT<double>& b, Int_t constr = 1) void AMultBt(const TMatrixT<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1) void APlusB(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1) void APlusB(const TMatrixTSparse<double>& a, const TMatrixT<double>& b, Int_t constr = 1) void APlusB(const TMatrixT<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1) public:
TMatrixTSparse<double>() TMatrixTSparse<double>(Int_t nrows, Int_t ncols) TMatrixTSparse<double>(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb) TMatrixTSparse<double>(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, double* data) TMatrixTSparse<double>(const TMatrixTSparse<double>& another) TMatrixTSparse<double>(const TMatrixT<double>& another) TMatrixTSparse<double>(TMatrixTSparse<double>::EMatrixCreatorsOp1 op, const TMatrixTSparse<double>& prototype) TMatrixTSparse<double>(const TMatrixTSparse<double>& a, TMatrixTSparse<double>::EMatrixCreatorsOp2 op, const TMatrixTSparse<double>& b) TMatrixTSparse<double> GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t* option = "S") const virtual ~TMatrixTSparse<double>() static TClass* Class() virtual void Clear(Option_t* = "") virtual double ColNorm() const virtual void ExtractRow(Int_t row, Int_t col, double* v, Int_t n = -1) const virtual const Int_t* GetColIndexArray() const virtual Int_t* GetColIndexArray() virtual void GetMatrix2Array(double* data, Option_t* option = "") const virtual const double* GetMatrixArray() const virtual double* GetMatrixArray() virtual const Int_t* GetRowIndexArray() const virtual Int_t* GetRowIndexArray() virtual TMatrixTBase<double>& GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, TMatrixTBase<double>& target, Option_t* option = "S") const virtual TMatrixTBase<double>& InsertRow(Int_t row, Int_t col, const double* v, Int_t n = -1) virtual TClass* IsA() const virtual Bool_t IsSymmetric() const void Mult(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b) virtual Int_t NonZeros() const virtual TMatrixTBase<double>& NormByDiag(const TVectorT<double>&, Option_t*) virtual double operator()(Int_t rown, Int_t coln) const virtual double& operator()(Int_t rown, Int_t coln) TMatrixTSparse<double>& operator*=(double val) TMatrixTSparse<double>& operator*=(const TMatrixTSparse<double>& source) TMatrixTSparse<double>& operator*=(const TMatrixT<double>& source) TMatrixTSparse<double>& operator+=(double val) TMatrixTSparse<double>& operator+=(const TMatrixTSparse<double>& source) TMatrixTSparse<double>& operator+=(const TMatrixT<double>& source) TMatrixTSparse<double>& operator-=(double val) TMatrixTSparse<double>& operator-=(const TMatrixTSparse<double>& source) TMatrixTSparse<double>& operator-=(const TMatrixT<double>& source) TMatrixTSparse<double>& operator=(const TMatrixT<double>& source) TMatrixTSparse<double>& operator=(const TMatrixTSparse<double>& source) TMatrixTSparse<double>& operator=(double val) const TMatrixTSparseRow_const<double> operator[](Int_t rown) const TMatrixTSparseRow<double> operator[](Int_t rown) virtual TMatrixTBase<double>& Randomize(double alpha, double beta, Double_t& seed) virtual TMatrixTSparse<double>& RandomizePD(double alpha, double beta, Double_t& seed) virtual TMatrixTBase<double>& ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros = -1) virtual TMatrixTBase<double>& ResizeTo(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros = -1) TMatrixTBase<double>& ResizeTo(const TMatrixTSparse<double>& m) virtual double RowNorm() const virtual TMatrixTBase<double>& SetColIndexArray(Int_t* data) virtual TMatrixTBase<double>& SetMatrixArray(const double* data, Option_t* = "") virtual TMatrixTBase<double>& SetMatrixArray(Int_t nr_nonzeros, Int_t* irow, Int_t* icol, double* data) virtual TMatrixTBase<double>& SetRowIndexArray(Int_t* data) TMatrixTSparse<double>& SetSparseIndex(Int_t nelem_new) TMatrixTSparse<double>& SetSparseIndex(const TMatrixTBase<double>& another) TMatrixTSparse<double>& SetSparseIndexAB(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b) virtual TMatrixTBase<double>& SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase<double>& source) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) TMatrixTSparse<double>& T() TMatrixTSparse<double>& Transpose(const TMatrixTSparse<double>& source) virtual TMatrixTBase<double>& UnitMatrix() TMatrixTSparse<double>& 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, double* pData) TMatrixTSparse<double>& Use(Int_t nrows, Int_t ncols, Int_t nr_nonzeros, Int_t* pRowIndex, Int_t* pColIndex, double* pData) TMatrixTSparse<double>& Use(TMatrixTSparse<double>& a) virtual TMatrixTBase<double>& Zero()

Data Members


    protected:
Int_t* fRowIndex [fNrowIndex] row index Int_t* fColIndex [fNelems] column index double* fElements [fNelems] public:
static const TMatrixTSparse<double>::EMatrixCreatorsOp1 kZero static const TMatrixTSparse<double>::EMatrixCreatorsOp1 kUnit static const TMatrixTSparse<double>::EMatrixCreatorsOp1 kTransposed static const TMatrixTSparse<double>::EMatrixCreatorsOp1 kAtA static const TMatrixTSparse<double>::EMatrixCreatorsOp2 kMult static const TMatrixTSparse<double>::EMatrixCreatorsOp2 kMultTranspose static const TMatrixTSparse<double>::EMatrixCreatorsOp2 kPlus static const TMatrixTSparse<double>::EMatrixCreatorsOp2 kMinus

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 .                                            
                                                                      




Inline Functions


                                         void ~TMatrixTSparse()
                                         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 AMultB(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1)
                                         void AMultB(const TMatrixTSparse<double>& a, const TMatrixT<double>& b, Int_t constr = 1)
                                         void AMultB(const TMatrixT<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1)
                                         void AMultBt(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1)
                                         void AMultBt(const TMatrixTSparse<double>& a, const TMatrixT<double>& b, Int_t constr = 1)
                                         void AMultBt(const TMatrixT<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1)
                                         void APlusB(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1)
                                         void APlusB(const TMatrixTSparse<double>& a, const TMatrixT<double>& b, Int_t constr = 1)
                                         void APlusB(const TMatrixT<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1)
                                         void AMinusB(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1)
                                         void AMinusB(const TMatrixTSparse<double>& a, const TMatrixT<double>& b, Int_t constr = 1)
                                         void AMinusB(const TMatrixT<double>& a, const TMatrixTSparse<double>& b, Int_t constr = 1)
                       TMatrixTSparse<double> TMatrixTSparse()
                       TMatrixTSparse<double> TMatrixTSparse(Int_t nrows, Int_t ncols)
                       TMatrixTSparse<double> TMatrixTSparse(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb)
                       TMatrixTSparse<double> 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, double* data)
                       TMatrixTSparse<double> TMatrixTSparse(const TMatrixTSparse<double>& another)
                       TMatrixTSparse<double> TMatrixTSparse(const TMatrixT<double>& another)
                       TMatrixTSparse<double> TMatrixTSparse(TMatrixTSparse<double>::EMatrixCreatorsOp1 op, const TMatrixTSparse<double>& prototype)
                       TMatrixTSparse<double> TMatrixTSparse(const TMatrixTSparse<double>& a, TMatrixTSparse<double>::EMatrixCreatorsOp2 op, const TMatrixTSparse<double>& b)
                                const double* GetMatrixArray() const
                                      double* GetMatrixArray()
                                 const Int_t* GetRowIndexArray() const
                                       Int_t* GetRowIndexArray()
                                 const Int_t* GetColIndexArray() const
                                       Int_t* GetColIndexArray()
                        TMatrixTBase<double>& SetRowIndexArray(Int_t* data)
                        TMatrixTBase<double>& SetColIndexArray(Int_t* data)
                                         void GetMatrix2Array(double* data, Option_t* option = "") const
                        TMatrixTBase<double>& SetMatrixArray(const double* data, Option_t* = "")
                        TMatrixTBase<double>& SetMatrixArray(Int_t nr_nonzeros, Int_t* irow, Int_t* icol, double* data)
                      TMatrixTSparse<double>& SetSparseIndex(Int_t nelem_new)
                      TMatrixTSparse<double>& SetSparseIndex(const TMatrixTBase<double>& another)
                      TMatrixTSparse<double>& SetSparseIndexAB(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b)
                        TMatrixTBase<double>& InsertRow(Int_t row, Int_t col, const double* v, Int_t n = -1)
                                         void ExtractRow(Int_t row, Int_t col, double* v, Int_t n = -1) const
                        TMatrixTBase<double>& ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros = -1)
                        TMatrixTBase<double>& ResizeTo(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros = -1)
                        TMatrixTBase<double>& ResizeTo(const TMatrixTSparse<double>& m)
                                         void Clear(Option_t* = "")
                      TMatrixTSparse<double>& 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, double* pData)
                      TMatrixTSparse<double>& Use(Int_t nrows, Int_t ncols, Int_t nr_nonzeros, Int_t* pRowIndex, Int_t* pColIndex, double* pData)
                      TMatrixTSparse<double>& Use(TMatrixTSparse<double>& a)
                        TMatrixTBase<double>& GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, TMatrixTBase<double>& target, Option_t* option = "S") const
                       TMatrixTSparse<double> GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Option_t* option = "S") const
                        TMatrixTBase<double>& SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase<double>& source)
                                       Bool_t IsSymmetric() const
                      TMatrixTSparse<double>& Transpose(const TMatrixTSparse<double>& source)
                      TMatrixTSparse<double>& T()
                                         void Mult(const TMatrixTSparse<double>& a, const TMatrixTSparse<double>& b)
                        TMatrixTBase<double>& Zero()
                        TMatrixTBase<double>& UnitMatrix()
                                       double RowNorm() const
                                       double ColNorm() const
                                        Int_t NonZeros() const
                        TMatrixTBase<double>& NormByDiag(const TVectorT<double>&, Option_t*)
                                       double operator()(Int_t rown, Int_t coln) const
                                      double& operator()(Int_t rown, Int_t coln)
        const TMatrixTSparseRow_const<double> operator[](Int_t rown) const
                    TMatrixTSparseRow<double> operator[](Int_t rown)
                      TMatrixTSparse<double>& operator=(const TMatrixT<double>& source)
                      TMatrixTSparse<double>& operator=(const TMatrixTSparse<double>& source)
                      TMatrixTSparse<double>& operator=(double val)
                      TMatrixTSparse<double>& operator-=(double val)
                      TMatrixTSparse<double>& operator+=(double val)
                      TMatrixTSparse<double>& operator*=(double val)
                      TMatrixTSparse<double>& operator+=(const TMatrixTSparse<double>& source)
                      TMatrixTSparse<double>& operator+=(const TMatrixT<double>& source)
                      TMatrixTSparse<double>& operator-=(const TMatrixTSparse<double>& source)
                      TMatrixTSparse<double>& operator-=(const TMatrixT<double>& source)
                      TMatrixTSparse<double>& operator*=(const TMatrixTSparse<double>& source)
                      TMatrixTSparse<double>& operator*=(const TMatrixT<double>& source)
                        TMatrixTBase<double>& Randomize(double alpha, double beta, Double_t& seed)
                      TMatrixTSparse<double>& RandomizePD(double alpha, double beta, Double_t& seed)
                                      TClass* Class()
                                      TClass* IsA() const
                                         void ShowMembers(TMemberInspector& insp, char* parent)
                                         void Streamer(TBuffer& b)
                                         void StreamerNVirtual(TBuffer& b)


Last update: root/matrix:$Name: $:$Id: TMatrixTSparse.cxx,v 1.3 2006/01/25 18:49:03 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.