41 std::ostream &operator<< (std::ostream &os, const TCoordMatrix<MT> &m);
77 TCoordMatrix (
int rows,
int cols,
int vals, idxtype *_rowidx, idxtype *_colidx,
84 void New (
int rows,
int cols);
90 void Initialise (
int nv, idxtype *_rowidx, idxtype *_colidx, MT *data = 0);
96 MT &operator() (
int r,
int c);
97 MT
Get (
int r,
int c)
const;
101 bool Exists (
int r,
int c)
const;
110 int SparseRow (
int r, idxtype *ci, MT *rv)
const;
121 MT GetNext (
int &r,
int &c)
const;
130 inline MT &Val (
int i) {
return this->val[i]; }
131 inline const MT &Val (
int i)
const {
return this->val[i]; }
134 void Sort (
bool roworder=
true)
const;
136 inline const idxtype *RowIndex ()
const {
return rowidx; }
137 inline const idxtype *ColIndex ()
const {
return colidx; }
139 inline idxtype RowIndex (
int i)
const {
return rowidx[i]; }
140 inline idxtype ColIndex (
int i)
const {
return colidx[i]; }
170 friend std::ostream &operator<< <> (std::ostream &os,
174 int Get_index (
int r,
int c)
const;
176 int Insert (
int r,
int c, MT v = 0);
183 mutable int iterator_pos;
198 #ifndef __CDMATRIX_CC
204 #endif // !__CDMATRIX_CC
206 #endif // !__CDMATRIX_H
Virtual base class for sparse matrix types.
Definition: gsmatrix.h:47
Coordinate-storage sparse matrix class.
Definition: cdmatrix.h:26
TVector< MT > Col(int c) const
Returns a vector containing a copy of column 'c'.
void New(int rows, int cols)
Reset the matrix dimensions.
MatrixStorage
Definition: matrix.h:20
friend TCompRowMatrix< MT > catv(const TCompRowMatrix< MT > &A, const TCompRowMatrix< MT > &B)
Concatenate two matrices vertically.
TVector< MT > Row(int r) const
Returns a vector containing a copy of row `r'.
bool Exists(int r, int c) const
Checks allocation of a matrix element.
Compressed-row sparse matrix class.
Definition: cdmatrix.h:27
friend TCompRowMatrix< MT > cath(const TCompRowMatrix< MT > &A, const TCompRowMatrix< MT > &B)
Concatenate two matrices horizontally.
MT Get(int r, int c) const
Retrieve a matrix element.
int SparseRow(int r, idxtype *ci, MT *rv) const
Returns a row of the matrix in sparse format.
MatrixStorage StorageType() const
Matrix storage class.
Definition: cdmatrix.h:82
coordinate storage (sparse)
Definition: matrix.h:24
TCoordMatrix()
Creates a coordinate matrix of dimension 0 x 0.