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 void delete_column(int k
)=0;
87 virtual ~virtual_smat() { }
88 virtual virtual_smat
*clone()=0;
92 virtual bool mult_ok(int i
, int j
) const=0;
94 at end of matrix? when doing loop
102 virtual void mult_next(int &i
, int &j
) const = 0;
104 walk through matrix (regular multiply)
105 get next j for row i, or get next row i and reset j.
106 this will make sparse matrix implementation easy.
111 virtual bool trans_ok(int i
, int j
) const=0;
113 valid matrix entry. return false if at end of row
115 virtual void trans_next(int &i
, int &j
) const = 0;
117 walk through matrix (transposed multiply).
118 Get next i (for column j)
124 /// generate a "Full_storage" matrix
125 static virtual_smat
*get_full(int n
, int m
);
129 /** base class for interface with matrix storageclasses. There are no
130 iterators for matrixclasses, since matrices are (like arrays)
131 explicitly int-indexed.
133 Iteration is provided by *_next, *_ok, which update and check both
134 index variables simultaneously.
137 determine type of product matrix.