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

Public Member Functions

 TSymMatrix (int r, int c)
 
 TSymMatrix (int n)
 
 TSymMatrix (const TSymMatrix< MT > &m)
 
 TSymMatrix (int n, const char *valstr)
 
MatrixStorage StorageType () const
 Matrix storage class. More...
 
void New (int r, int c)
 Resize and reset the matrix. More...
 
void Zero ()
 
void Zero (int n)
 
void Zero (int r, int c)
 
void Identity ()
 
void Identity (int n)
 
void Identity (int r, int c)
 
MT Get (int r, int c) const
 Retrieve a matrix element. More...
 
const MT operator() (int r, int c) const
 
MT & operator() (int r, int c)
 
TSymMatrix< MT > & operator*= (MT f)
 
TSymMatrix< MT > & operator/= (MT f)
 
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 ColScale (const TVector< MT > &scale)
 
void RowScale (const TVector< MT > &scale)
 
void AddDiag (const TVector< MT > &d)
 
void AddDiag (const MT &d)
 
void Ax (const TVector< MT > &x, TVector< MT > &b) const
 
void ATx (const TVector< MT > &x, TVector< MT > &b) const
 
TSymMatrix< MT > & operator= (const TSymMatrix< MT > &m)
 
TSymMatrix< MT > & operator= (const MT &mt)
 
TSymMatrix< MT > operator+ (const TSymMatrix< MT > &m) const
 
TSymMatrix< MT > operator- (const TSymMatrix< MT > &m) const
 
TSymMatrix< MT > & operator+= (const TSymMatrix< MT > &m)
 
TSymMatrix< MT > & operator-= (const TSymMatrix< MT > &m)
 
TSymMatrix< MT > operator* (const MT &mt) const
 
TVector< MT > operator* (const TVector< MT > &x) const
 
MT * data_buffer ()
 
const MT * data_buffer () const
 
- 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
 

Protected Member Functions

int Idx (int r, int c) const
 

Protected Attributes

MT * val
 
int nz
 
- Protected Attributes inherited from TMatrix< MT >
int rows
 
int cols
 

Friends

bool CHdecomp (TSymMatrix< MT > &a, bool recover)
 
TVector< MT > CHsubst (const TSymMatrix< MT > &a, const TVector< MT > &b)
 

Additional Inherited Members

- Public Types inherited from TMatrix< MT >
enum  RC { ROW, COL }
 

Member Function Documentation

template<class MT>
TVector<MT> TSymMatrix< 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 TSymMatrix< MT >::Get ( int  r,
int  c 
) const
inlinevirtual

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 TMatrix< MT >.

Referenced by Line2D2::BndIntPFF(), Line2D2::IntFDD(), and Line2D2::IntPDD().

template<class MT>
void TSymMatrix< MT >::New ( int  nrows,
int  ncols 
)
inlinevirtual

Resize and reset the matrix.

Resets the logical size of the matrix to nrows x ncols. Derived classes reallocate the data block and any index arrays, and reset the matrix elements to zero.

Parameters
nrowsnew number of matrix rows
ncolsnew number of matrix columns

Reimplemented from TMatrix< MT >.

template<class MT>
TVector<MT> TSymMatrix< 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 >.

Referenced by TSymMatrix< double >::Col().

template<class MT>
int TSymMatrix< 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 TSymMatrix< MT >::StorageType ( ) const
inlinevirtual

Matrix storage class.

Returns
storage class identifier

Implements TMatrix< MT >.


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