5 /// a matrix storage baseclass.
11 virtual void OK() const=0;
14 virtual int rows() const = 0;
17 virtual int cols() const = 0;
19 /// set the size. contents lost
20 virtual void set_size(int i, int j) = 0;
26 /// set the size to square dimen. contents lost
27 virtual void set_size(int i) = 0;
33 virtual void resize(int i, int j) = 0;
36 keep contents. If enlarged contents unspecified
43 /// set the size to square dimen. contents kept
44 virtual void resize(int i) = 0;
46 Keep contents. If enlarged contents are unspecified
53 virtual Real& elem(int i,int j) = 0;
57 Generate an errormessage, if this happens
58 in the 0-part of a sparse matrix.
61 /// access a element, no modify
62 virtual const Real& elem(int i, int j) const = 0;
65 virtual svec<Real> row(int i) const = 0;
66 virtual svec<Real> column(int j) const = 0;
70 virtual void insert_row(int k)=0;
72 add a row to the matrix before row k. Contents
73 of added row are unspecified
79 virtual void delete_row(int k)=0;
81 delete a row from this matrix.
86 virtual ~virtual_smat() { }
87 virtual virtual_smat *clone()=0;
91 virtual bool mult_ok(int i, int j) const=0;
93 at end of matrix? when doing loop
101 virtual void mult_next(int &i, int &j) const = 0;
103 walk through matrix (regular multiply)
104 get next j for row i, or get next row i and reset j.
105 this will make sparse matrix implementation easy.
110 virtual bool trans_ok(int i, int j) const=0;
112 valid matrix entry. return false if at end of row
114 virtual void trans_next(int &i, int &j) const = 0;
116 walk through matrix (transposed multiply).
117 Get next i (for column j)
123 /// generate a "Full_storage" matrix
124 virtual_smat<Real> *get_full(int n, int m);
128 /** base class for interface with matrix storageclasses. There are no
129 iterators for matrixclasses, since matrices are (like arrays)
130 explicitly int-indexed.
132 Iteration is provided by *_next, *_ok, which update and check both
133 index variables simultaneously.
136 determine type of product matrix.