5 /** base class for interface with matrix storageclasses. There are no
6 iterators for matrixclasses, since matrices are (like arrays)
7 explicitly int-indexed.
9 Iteration is provided by *_next, *_ok, which update and check both
10 index variables simultaneously.
13 determine type of product matrix.
21 virtual void OK() const=0;
24 virtual int rows() const = 0;
27 virtual int cols() const = 0;
30 /** set the size. contents lost.
34 virtual void set_size(int i
, int j
) = 0;
36 /**set the size to square dimen. contents lost
40 virtual void set_size(int i
) = 0;
43 keep contents. If enlarged contents unspecified
49 virtual void resize(int i
, int j
) = 0;
52 set the size to square dimen. contents kept
53 Keep contents. If enlarged contents are unspecified
58 virtual void resize(int i
) = 0;
64 Generate an errormessage, if this happens
65 in the 0-part of a sparse matrix.
68 virtual Real
& elem(int i
,int j
) = 0;
70 /// access a element, no modify
71 virtual const Real
& elem(int i
, int j
) const = 0;
74 virtual Array
<Real
> row(int i
) const = 0;
75 virtual Array
<Real
> column(int j
) const = 0;
80 add a row to the matrix before row k. Contents
81 of added row are unspecified
85 virtual void insert_row(int k
)=0;
89 delete a row from this matrix.
94 virtual void delete_row(int k
)=0;
95 virtual void delete_column(int k
)=0;
96 virtual ~virtual_smat() { }
97 virtual virtual_smat
*clone()=0;
102 at end of matrix?. when doing loop
109 virtual bool mult_ok(int i
, int j
) const=0;
112 walk through matrix (regular multiply).
113 get next j for row i, or get next row i and reset j.
114 this will make sparse matrix implementation easy.
119 virtual void mult_next(int &i
, int &j
) const = 0;
122 valid matrix entry. return false if at end of row
124 virtual bool trans_ok(int i
, int j
) const=0;
127 walk through matrix (transposed multiply).
128 Get next i (for column j)
134 virtual void trans_next(int &i
, int &j
) const = 0;
135 /// generate a "Full_storage" matrix
136 static virtual_smat
*get_full(int n
, int m
);