Toast++
1.0.2 (r.539)
Forward and inverse modelling in optical tomography
|
Virtual base class for sparse matrix types. More...
#include <gsmatrix.h>
Public Member Functions | |
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 void | New (int nrows, int ncols) |
Reset the matrix dimensions. More... | |
virtual MT | Get (int r, int c) const =0 |
Retrieve a matrix element. More... | |
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 |
virtual MT & | operator() (int r, int c)=0 |
virtual void | Add (int r, int c, const MT &val) |
virtual int | Get_index (int r, int c) const =0 |
virtual MT | GetNext (int &r, int &c) const =0 |
TGenericSparseMatrix & | operator*= (const MT &sc) |
TVector< MT > | operator* (const TVector< MT > &x) const |
virtual void | Ax (const TVector< MT > &x, TVector< MT > &b) const =0 |
virtual void | Ax (const TVector< MT > &x, TVector< MT > &b, int i1, int i2) const =0 |
virtual void | ATx (const TVector< MT > &x, TVector< MT > &b) const =0 |
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... | |
virtual MatrixStorage | StorageType () const =0 |
Matrix storage class. More... | |
MT | operator() (int r, int c) const |
Matrix element access (read only) More... | |
virtual TVector< MT > | Row (int r) const =0 |
Returns a vector containing a copy of row `r'. More... | |
virtual void | SetRow (int r, const TVector< MT > &row) |
Substitute a row of the matrix. More... | |
virtual int | SparseRow (int r, idxtype *colidx, MT *val) const =0 |
Returns a row of the matrix in sparse format. More... | |
virtual TVector< MT > | Col (int c) const =0 |
Returns a vector containing a copy of column 'c'. 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... | |
virtual void | ColScale (const TVector< MT > &scale)=0 |
virtual void | RowScale (const TVector< MT > &scale)=0 |
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 | |
void | Append (MT v=0) |
Protected Attributes | |
MT * | val |
int | nbuf |
int | nval |
Protected Attributes inherited from TMatrix< MT > | |
int | rows |
int | cols |
Friends | |
int | QRFactorize (TGenericSparseMatrix< MT > &A, TVector< MT > &c, TVector< MT > &d) |
void | RSolve (const TGenericSparseMatrix< MT > &A, const TVector< MT > &d, TVector< MT > &b) |
void | QRSolve (const TGenericSparseMatrix< MT > &A, const TVector< MT > &c, const TVector< MT > &d, const TVector< MT > &b, TVector< MT > &x) |
int | IterativeSolve (const TGenericSparseMatrix< MT > &A, const TVector< MT > &b, TVector< MT > &x, double &tol, TPreconditioner< MT > *precon, int maxit) |
void | IterativeSolve (const TGenericSparseMatrix< MT > &A, const TVector< MT > *b, TVector< MT > *x, int nrhs, double tol, int maxit, TPreconditioner< MT > *precon, IterativeSolverResult *res) |
int | CG (const TGenericSparseMatrix< MT > &A, const TVector< MT > &b, TVector< MT > &x, double &tol, TPreconditioner< MT > *precon, int maxit) |
int | BiCG (const TGenericSparseMatrix< MT > &A, const TVector< MT > &b, TVector< MT > &x, double &tol, TPreconditioner< MT > *precon, int maxit) |
int | ComplexBiCGSolve (const TGenericSparseMatrix< MT > &Are, const TGenericSparseMatrix< MT > &Aim, const TVector< MT > &bre, const TVector< MT > &bim, TVector< MT > &xre, TVector< MT > &xim, double &tol, int maxit) |
int | GaussSeidel (const TGenericSparseMatrix< MT > &A, const TVector< MT > &b, TVector< MT > &x, double &tol, int maxit) |
Additional Inherited Members | |
Public Types inherited from TMatrix< MT > | |
enum | RC { ROW, COL } |
Virtual base class for sparse matrix types.
The following template types are instantiated by default:
TGenericSparseMatrix< MT >::TGenericSparseMatrix | ( | int | rows, |
int | cols, | ||
int | nv = 0 , |
||
const MT * | data = 0 |
||
) |
Create a sparse matrix of logical size rows x cols.
rows | number of rows (>= 0) |
cols | number of columns (>= 0) |
nv | number of nonzero entries (0 <= nv <= rows.cols) |
data | data array of size >= nv |
cmode | if set to SHALLOW_COPY, the provided data array is used directly instead of copied to a local buffer. The buffer must remain valid during the lifetime of the matrix. |
|
pure virtual |
Checks allocation of a matrix element.
r | row index (>= 0) |
c | column index (>= 0) |
Implemented in TCompRowMatrix< MT >, TCompRowMatrix< double >, TCompRowMatrix< int >, TCompRowMatrix< T >, TCompRowMatrix< std::complex< float > >, TDiagMatrix< MT >, TCompRowMatrixMPI< MT >, and TCoordMatrix< MT >.
|
inlinevirtual |
Write sparse matrix to ASCII output stream.
This writes the nonzero elements of the matrix in a row-column-value format
containing integer row and column index, and one (double) or two (complex) floating point values, all white-space separated.
Reimplemented in TCompRowMatrix< MT >, TCompRowMatrix< double >, TCompRowMatrix< int >, TCompRowMatrix< T >, and TCompRowMatrix< std::complex< float > >.
|
pure virtual |
Retrieve a matrix element.
Implements TMatrix< MT >.
Implemented in TCompRowMatrix< MT >, TCompRowMatrix< double >, TCompRowMatrix< int >, TCompRowMatrix< T >, TCompRowMatrix< std::complex< float > >, TCompRowMatrixMPI< MT >, TCoordMatrix< MT >, TDiagMatrix< MT >, and TSymCompRowMatrix< MT >.
|
virtual |
Reset the matrix dimensions.
nrows | number of matrix rows |
ncols | number of matrix columns |
Reimplemented from TMatrix< MT >.
Reimplemented in TCompRowMatrix< MT >, TCompRowMatrix< double >, TCompRowMatrix< int >, TCompRowMatrix< T >, TCompRowMatrix< std::complex< float > >, TCoordMatrix< MT >, TDiagMatrix< MT >, and TSymCompRowMatrix< MT >.
References TMatrix< MT >::New().