From: fred Date: Wed, 26 Mar 1997 21:21:35 +0000 (+0000) Subject: lilypond-0.0.46.jcn1 X-Git-Tag: release/1.5.59~6176 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=64dfa72da35bfd74a66ee767b63c8682b3629e07;p=lilypond.git lilypond-0.0.46.jcn1 --- diff --git a/flower/include/matrix-storage.hh b/flower/include/matrix-storage.hh new file mode 100644 index 0000000000..8e34d604f4 --- /dev/null +++ b/flower/include/matrix-storage.hh @@ -0,0 +1,168 @@ +/* + matrix-storage.hh -- declare Matrix_storage + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef MATRIX_STORAGE_HH +#define MATRIX_STORAGE_HH + +#include "varray.hh" +#include "real.hh" +#include "class-name.hh" + +/** + + base class for interface with matrix storageclasses. There are no + iterators for matrixclasses, since matrices are (like arrays) + explicitly int-indexed. + + Iteration is provided by *_next, *_ok, which update and check both + index variables simultaneously. + + TODO + determine type of product matrix. + +*/ +class Matrix_storage { + + +public: + /// check invariants + virtual void OK() const=0; + + /// height of matrix + virtual int rows() const = 0; + + /// width of matrix + virtual int cols() const = 0; + + + /** set the size. contents lost. + PRE + i >=0, j>=0 + */ + virtual void set_size(int rows, int cols) = 0; + + /**set the size to square dimen. contents lost + PRE + i>=0 + */ + virtual void set_size(int i) = 0; + /**set the size to i. + + keep contents. If enlarged contents unspecified + + PRE + i>=0, j>=0 + + */ + virtual void resize(int rows, int cols ) = 0; + + /** + set the size to square dimen. contents kept + Keep contents. If enlarged contents are unspecified + + PRE + i>=0 + */ + virtual void resize(int i) = 0; + + + /** + access an element. + + Generate an errormessage, if this happens + in the 0-part of a sparse matrix. + */ + + virtual Real& elem(int i,int j) = 0; + + /// access a element, no modify + virtual Real const & elem(int i, int j) const = 0; + + virtual Array row(int i) const = 0; + virtual Array column(int j) const = 0; + + + /** + add a row to the matrix before row k. Contents + of added row are unspecified + + 0 <= k <= rows() + */ + virtual void insert_row(int k)=0; + + + /** + delete a row from this matrix. + + PRE + 0 <= k < rows(); + */ + virtual void delete_row(int k)=0; + virtual void delete_column(int k)=0; + virtual ~Matrix_storage() { } + virtual Matrix_storage *clone()=0; + + + + /** + at end of matrix?. when doing loop + + for(i=0; i