24 #include "dnsmatrix.h"
81 void New (
int nrows,
int ncols);
90 virtual MT
Get (
int r,
int c)
const
91 {
return (r == c) ? this->val[r] : (MT)0; }
123 int SparseRow (
int r, idxtype *colidx, MT *val)
const;
202 bool Exists (
int r,
int c)
const;
227 MT
GetNext (
int &r,
int &c)
const;
269 #endif // !__DGMATRIX_H
TVector< MT > Row(int r) const
Returns a vector containing a copy of row 'r'.
Virtual base class for sparse matrix types.
Definition: gsmatrix.h:47
MT & operator()(int r, int c)
Element access.
void ATx(const TVector< MT > &x, TVector< MT > &b) const
Transpose matrix-vector multiplication.
void New(int nrows, int ncols)
Resizes and resets the matrix.
void Copy(const TDiagMatrix< MT > &mat)
Matrix copy operation.
TDiagMatrix & operator=(const TDiagMatrix< MT > &mat)
Matrix assignment.
void RowScale(const TVector< MT > &scale)
Scales the matrix rows.
TVector< MT > Col(int c) const
Returns a vector containing a copy of column 'c'.
MatrixStorage
Definition: matrix.h:20
virtual MT Get(int r, int c) const
Retrieves a matrix element.
Definition: dgmatrix.h:90
Diagonal matrix class.
Definition: crmatrix.h:39
TDiagMatrix operator-(const TDiagMatrix &mat) const
Matrix subtraction.
virtual ~TDiagMatrix()
Matrix destructor.
int Get_index(int r, int c) const
Returns data array index for an element.
MatrixStorage StorageType() const
Returns the matrix storage type.
Definition: dgmatrix.h:73
void ColScale(const TVector< MT > &scale)
Scales the matrix columns.
TDiagMatrix()
Creates a diagonal matrix of dimension 0 x 0.
void Ax(const TVector< MT > &x, TVector< MT > &b) const
Matrix-vector multiplication.
Dense matrix class.
Definition: crmatrix.h:38
TDiagMatrix operator+(const TDiagMatrix &mat) const
Matrix addition.
bool Exists(int r, int c) const
Checks allocation of a matrix element.
MT GetNext(int &r, int &c) const
Element iterator.
store diagonal matrix as vector
Definition: matrix.h:23
int SparseRow(int r, idxtype *colidx, MT *val) const
Returns a row of the matrix in sparse format.