Toast++  1.0.2 (r.539)
Forward and inverse modelling in optical tomography
Public Member Functions | Public Attributes | Friends | List of all members
TSymCompRowMatrix< MT > Class Template Reference
Inheritance diagram for TSymCompRowMatrix< MT >:
TGenericSparseMatrix< MT > TMatrix< MT >

Public Member Functions

void New (int nrows, int ncols)
 Reset the matrix dimensions. More...
 
 TSymCompRowMatrix (int rows, int cols)
 
 TSymCompRowMatrix (int rows, int cols, const int *rptr, const int *cidx, const MT *data=0)
 
MatrixStorage StorageType () const
 Matrix storage class. More...
 
void Initialise (const int *_rowptr, const int *_colidx, const MT *data=0)
 
void AllowColIndexing (bool yes)
 
void SetColAccess (bool yes) const
 
MT & operator() (int r, int c)
 
MT Get (int r, int c) const
 Retrieve a matrix element. More...
 
void Add (int r, int c, const MT &val)
 
TVector< MT > Row (int r) const
 Returns a vector containing a copy of row `r'. More...
 
TVector< MT > Col (int c) const
 Returns a vector containing a copy of column 'c'. More...
 
int SparseRow (int r, idxtype *ci, MT *rv) const
 Returns a row of the matrix in sparse format. More...
 
void RowScale (const TVector< MT > &scale)
 
void ColScale (const TVector< MT > &scale)
 
MT GetNext (int &r, int &c) const
 
void Ax (const TVector< MT > &x, TVector< MT > &b) const
 
void Ax (const TVector< MT > &x, TVector< MT > &b, int r1, int r2) const
 
void ATx (const TVector< MT > &x, TVector< MT > &b) const
 
int Shrink ()
 
void SymbolicCholeskyFactorize (idxtype *&frowptr, idxtype *&fcolidx) const
 
- Public Member Functions inherited from TGenericSparseMatrix< MT >
 TGenericSparseMatrix ()
 Create a sparse matrix of size 0 x 0.
 
 TGenericSparseMatrix (int rows, int cols, int nv=0, const MT *data=0)
 Create a sparse matrix of logical size rows x cols. More...
 
 TGenericSparseMatrix (int rows, int cols, int nv, MT *data, CopyMode cmode=DEEP_COPY)
 
 TGenericSparseMatrix (const TGenericSparseMatrix< MT > &m)
 Constructs a matrix as a copy of 'm'.
 
virtual ~TGenericSparseMatrix ()
 Destructor.
 
virtual bool Exists (int r, int c) const =0
 Checks allocation of a matrix element. More...
 
virtual void Unlink ()
 
void Initialise (int nv, const MT *data)
 
void Initialise (int nv, MT *data, CopyMode cmode)
 
void Zero ()
 
int nVal () const
 
MT & Val (int i)
 
MT * ValPtr ()
 
const MT * ValPtr () const
 
TGenericSparseMatrixoperator*= (const MT &sc)
 
TVector< MT > operator* (const TVector< MT > &x) const
 
TVector< MT > ATx (const TVector< MT > &x) const
 
double FillFraction () const
 
virtual void Display (std::ostream &os) const
 
virtual void PrintFillinGraph (const char *fname, int maxdim=600, bool binary=true, bool antialias=true)
 
virtual void ExportRCV (std::ostream &os)
 Write sparse matrix to ASCII output stream. More...
 
- Public Member Functions inherited from TMatrix< MT >
 TMatrix ()
 Create a matrix of size 0 x 0.
 
 TMatrix (int nrows, int ncols)
 Create a matrix of logical size nrows x ncols. More...
 
 TMatrix (const TMatrix< MT > &m)
 Create a matrix as a copy of another matrix. More...
 
virtual ~TMatrix ()
 Destroy the matrix. More...
 
int Dim (RC rc) const
 Return a matrix dimension. More...
 
int nRows () const
 Return number of rows of the matrix. More...
 
int nCols () const
 Return number of columns of the matrix. More...
 
bool isSparse () const
 Return sparse storage flag. More...
 
bool isFull () const
 Return dense storage flag. More...
 
MT operator() (int r, int c) const
 Matrix element access (read only) More...
 
virtual void SetRow (int r, const TVector< MT > &row)
 Substitute a row of the matrix. More...
 
virtual TVector< MT > Diag () const
 Returns the matrix diagonal as a vector. More...
 
virtual TVector< MT > ColNorm () const
 Returns vector of column norms. More...
 
TVector< MT > operator* (const TVector< MT > &x) const
 
TVector< MT > ATx (const TVector< MT > &x) const
 
virtual void Transpone ()
 
virtual MT RowMult (int r, MT *x) const
 
void Export (std::ostream &os) const
 Write matrix to ASCII stream. More...
 
void Print (std::ostream &os=std::cout, int n=80) const
 
void PrintNzeroGraph (char *fname)
 
virtual int pcg (const TVector< MT > &b, TVector< MT > &x, double &tol, TPreconditioner< MT > *precon=0, int maxit=0) const
 
virtual void pcg (const TVector< MT > *b, TVector< MT > *x, int nrhs, double tol, int maxit=0, TPreconditioner< MT > *precon=0, IterativeSolverResult *res=0) const
 
virtual int bicgstab (const TVector< MT > &b, TVector< MT > &x, double &tol, TPreconditioner< MT > *precon=0, int maxit=0) const
 
virtual void bicgstab (const TVector< MT > *b, TVector< MT > *x, int nrhs, double tol, int maxit=0, TPreconditioner< MT > *precon=0, IterativeSolverResult *res=0) const
 
template<>
int pcg (const FVector &b, FVector &x, double &tol, TPreconditioner< float > *precon, int maxit) const
 
template<>
void pcg (const FVector *b, FVector *x, int nrhs, double tol, int maxit, TPreconditioner< float > *precon, IterativeSolverResult *res) const
 
template<>
int bicgstab (const FVector &b, FVector &x, double &tol, TPreconditioner< float > *precon, int maxit) const
 
template<>
void bicgstab (const FVector *b, FVector *x, int nrhs, double tol, int maxit, TPreconditioner< float > *precon, IterativeSolverResult *res) const
 

Public Attributes

idxtype * rowptr
 
idxtype * colidx
 
idxtype * colptr
 
idxtype * rowidx
 
idxtype * vofs
 
bool col_access
 

Friends

bool CholeskyFactorize (const TSymCompRowMatrix< MT > &A, TCompRowMatrix< MT > &L, TVector< MT > &d, bool recover)
 
std::istream & operator>> (std::istream &is, TSymCompRowMatrix< MT > &m)
 
std::ostream & operator<< (std::ostream &os, const TSymCompRowMatrix< MT > &m)
 

Additional Inherited Members

- Public Types inherited from TMatrix< MT >
enum  RC { ROW, COL }
 
- Static Public Member Functions inherited from TGenericSparseMatrix< MT >
static void GlobalSelectIterativeSolver (IterativeMethod method)
 
static void GlobalSelectIterativeSolver_complex (IterativeMethod method)
 
static IterativeMethod GetGlobalIterativeSolver ()
 
static IterativeMethod GetGlobalIterativeSolver_complex ()
 
- Protected Member Functions inherited from TGenericSparseMatrix< MT >
void Append (MT v=0)
 
- Protected Attributes inherited from TGenericSparseMatrix< MT >
MT * val
 
int nbuf
 
int nval
 
- Protected Attributes inherited from TMatrix< MT >
int rows
 
int cols
 

Member Function Documentation

template<class MT>
TVector<MT> TSymCompRowMatrix< MT >::Col ( int  c) const
inlinevirtual

Returns a vector containing a copy of column 'c'.

Parameters
ccolumn index (>= 0)
Returns
vector containing column c
Note
Sparse matrix types expand to a dense column, with missing entries filled with zeros, so this can be used as a "scatter" operation.
See Also
Row

Implements TMatrix< MT >.

template<class MT>
MT TSymCompRowMatrix< MT >::Get ( int  r,
int  c 
) const
virtual

Retrieve a matrix element.

Parameters
rmatrix row (0 <= r < nRows())
cmatrix column (0 <= c < nCols())
Returns
matrix element (*this)r,c
Note
This is a read operation and returns the element value. For writing operations, use Put() or operator().
See Also
operator()

Implements TGenericSparseMatrix< MT >.

template<class MT>
void TSymCompRowMatrix< MT >::New ( int  nrows,
int  ncols 
)
virtual

Reset the matrix dimensions.

Parameters
nrowsnumber of matrix rows
ncolsnumber of matrix columns
Note
This method unlinks the matrix from its current data block by calling Unlink(), then resets its logical dimensions by calling TMatrix::New().
To allocate a new data block for the matrix after New(), use Initialise().
See Also
Unlink, Initialise, TMatrix::New

Reimplemented from TGenericSparseMatrix< MT >.

template<class MT>
TVector<MT> TSymCompRowMatrix< MT >::Row ( int  r) const
virtual

Returns a vector containing a copy of row `r'.

Parameters
rrow index (>= 0)
Returns
vector containing row r
Note
Sparse matrix types expand to a dense row, with missing entries filled with zeros, so this can be used as a "scatter" operation.
See Also
SparseRow, SetRow

Implements TMatrix< MT >.

template<class MT>
int TSymCompRowMatrix< MT >::SparseRow ( int  r,
idxtype *  colidx,
MT *  val 
) const
virtual

Returns a row of the matrix in sparse format.

Returns a list of column indices and values for all allocated entries of row r. This is only really useful for sparse matrix types. For dense matrices this simply returns the complete row, with indices 0, 1, 2, ... n-1

Parameters
rrow index (>= 0)
colidxpointer to array of column indices
valpointer to array of element values
Returns
Actual number of allocated matrix entries in the row.
Note
The arrays must be allocated by the caller and be of sufficient size.
See Also
Row, SetRow

Implements TMatrix< MT >.

template<class MT>
MatrixStorage TSymCompRowMatrix< MT >::StorageType ( ) const
inlinevirtual

Matrix storage class.

Returns
storage class identifier

Implements TMatrix< MT >.

References MATRIX_SYMCOMPROW.


The documentation for this class was generated from the following file: