From 183af4134b5b3dc113c624d4dc86d6ca891e97aa Mon Sep 17 00:00:00 2001 From: fred Date: Mon, 10 Feb 1997 20:15:44 +0000 Subject: [PATCH] flower-1.0.26 --- flower/Makefile | 4 +++ flower/Variables.make | 3 ++- flower/assoc.hh | 8 +++--- flower/associter.hh | 3 --- flower/choleski.hh | 30 ++++++++++------------ flower/compare.hh | 8 +++--- flower/cursor.hh | 24 ++++++++--------- flower/cursor.inl | 2 +- flower/dataf.cc | 6 ++--- flower/dstream.cc | 6 ++--- flower/dstream.hh | 30 +++++++++++----------- flower/interval.hh | 12 ++++----- flower/lgetopt.hh | 19 ++++++-------- flower/list.hh | 56 ++++++++++++++++++++-------------------- flower/matrix.hh | 40 ++++++++++++++--------------- flower/path.cc | 20 +++++++-------- flower/scalar.hh | 2 +- flower/smat.cc | 2 +- flower/string.hh | 52 ++++++++++++++++++------------------- flower/stringutil.hh | 34 ++++++++++++------------ flower/textdb.hh | 10 +++----- flower/textstr.hh | 19 +++++++------- flower/tvsmat.hh | 60 +++++++++++++++++++++---------------------- flower/varray.hh | 18 ++++++------- flower/vector.hh | 6 ++--- flower/vsmat.hh | 2 +- 26 files changed, 235 insertions(+), 241 deletions(-) diff --git a/flower/Makefile b/flower/Makefile index 1b8b0013f8..9c69264115 100644 --- a/flower/Makefile +++ b/flower/Makefile @@ -17,6 +17,10 @@ realclean: clean fversion.hh: Variables.make make_version make_version $(MAJVER) $(MINVER) $(PATCHLEVEL) "$(CXX) `$(CXXVER)`" > $@ +.PHONY: docxx +docxx: $(hh) $(cc) $(templatecc) $(inl) + -mkdir docxx + doc++ -p -d docxx $(hh) $(cc) $(templatecc) $(inl) dist: -mkdir $(DDIR) diff --git a/flower/Variables.make b/flower/Variables.make index 90d8cc8dc6..0dc6c79705 100644 --- a/flower/Variables.make +++ b/flower/Variables.make @@ -1,6 +1,7 @@ MAJVER=1 MINVER=0 -PATCHLEVEL=25 +PATCHLEVEL=26 + PACKAGENAME=flower #PROFILEFLAG=-pg diff --git a/flower/assoc.hh b/flower/assoc.hh index 4e0594519f..154a0242a2 100644 --- a/flower/assoc.hh +++ b/flower/assoc.hh @@ -12,11 +12,13 @@ struct Assoc_ent_ { }; /// hungarian: map +/** mindblowingly stupid Associative array implementation + */ template struct Assoc { Array< Assoc_ent_ > arr; - /****************/ + /* ************** */ int find(K key) const { for (int i = 0; i < arr.size(); i++) { @@ -60,7 +62,7 @@ public: int i = find_creat(key); arr[i].val = val; } - /** + /* should create "set" template */ V& operator[](K key) { @@ -71,7 +73,5 @@ public: return arr[find(key)].val; } }; -/** mindblowingly stupid Associative array implementation - */ #endif diff --git a/flower/associter.hh b/flower/associter.hh index bb312b8e9e..34b88df22d 100644 --- a/flower/associter.hh +++ b/flower/associter.hh @@ -35,8 +35,5 @@ struct Assoc_iter { K key() { return assoc_.arr[i].key; } V &val() { return assoc_.arr[i].val; } }; -/* - Iterator - */ #endif diff --git a/flower/choleski.hh b/flower/choleski.hh index c6cb91723b..14cf5e2326 100644 --- a/flower/choleski.hh +++ b/flower/choleski.hh @@ -3,6 +3,13 @@ #include "matrix.hh" +/** + structure for using the LU decomposition of a positive definite . + + #P# is split into + + LD transpose(L) + */ struct Choleski_decomposition { /// lower triangle of Choleski decomposition @@ -11,36 +18,27 @@ struct Choleski_decomposition { /// diagonal Vector D; ///Create decomposition of P - Choleski_decomposition(Matrix P); /** PRE P needs to be symmetric positive definite */ + Choleski_decomposition(Matrix P); Vector solve(Vector rhs) const; - Vector operator * (Vector rhs) const { return solve (rhs); } - /** + /** solve Px = rhs */ - - Matrix inverse() const; - /** +Vector operator * (Vector rhs) const { return solve (rhs); } + /** return the inverse of the matrix P. */ - Matrix original() const; + Matrix inverse() const; /** return P, calc'ed from L and D */ + Matrix original() const; + }; -/** - structure for using the LU decomposition of a positive definite . - - #P# is split into - - LD transpose(L) - */ - - #endif diff --git a/flower/compare.hh b/flower/compare.hh index f0e886e539..30a1998ad3 100644 --- a/flower/compare.hh +++ b/flower/compare.hh @@ -29,6 +29,10 @@ operator op(type t1, type t2)\ #endif /// handy notations for a signed comparison +/** + make the operators{<,<=,==,>=,>} and the MAX and MIN of two. + Please fill a & in the type argument if necessary. + */ #define template_instantiate_compare(type, function, prefix) \ prefix one_operator(type, function, >)\ prefix one_operator(type, function, >=)\ @@ -41,10 +45,6 @@ prefix inline type max(type t1, type t2) { return (t1 > t2 )? t1 : t2; }\ prefix inline type min(type t1, type t2) { return (t1 < t2 )? t1 : t2; }\ \ prefix bool operator<(type t1, type t2) /* stupid fix to allow ; */ - /** - make the operators{<,<=,==,>=,>} and the MAX and MIN of two. - Please fill a & in the type argument if necessary. - */ diff --git a/flower/cursor.hh b/flower/cursor.hh index 1484770688..d8274d2493 100644 --- a/flower/cursor.hh +++ b/flower/cursor.hh @@ -6,14 +6,22 @@ #include "link.hh" template class List; -/// +/// iterator to List +/** + add and insert extend the list + items are always stored as copies in List, but: + List : copies of String stored + List : copies of String* stored! + + the operations add and insert actually delegate the work to List class. + */ template class Cursor { public: - Cursor( const List& list, Link* pointer = 0 ); /** this isn't true, actually, #list# surely isn't const, but I get tired of the warning messages. */ + Cursor( const List& list, Link* pointer = 0 ); Cursor( const Cursor& cursor ); @@ -49,7 +57,6 @@ class Cursor bool backward(); /// put (copy) after me in List - void add( const T& thing ); /** analogously to editor. ok() interpreted as at end of line. @@ -61,9 +68,9 @@ class Cursor cursor points to same object, cursor.next() is newly added object. */ + void add( const T& thing ); /// put (copy) before me in List - void insert( const T& thing ); /** analogously to editor. ok() interpreted as at begin of line. @@ -76,6 +83,7 @@ class Cursor is newly inserted object. */ + void insert( const T& thing ); /// void backspace(); @@ -90,14 +98,6 @@ private: List& list_; Link* pointer_; }; -/** - add and insert extend the list - items are always stored as copies in List, but: - List : copies of String stored - List : copies of String* stored! - - the operations add and insert actually delegate the work to List class. - */ /* diff --git a/flower/cursor.inl b/flower/cursor.inl index 278d865bff..54d3703e60 100644 --- a/flower/cursor.inl +++ b/flower/cursor.inl @@ -2,7 +2,7 @@ #ifndef CURSOR_INL #define CURSOR_INL #include -//#include "list.hh" + template inline diff --git a/flower/dataf.cc b/flower/dataf.cc index d050e278c5..e3c42ad45f 100644 --- a/flower/dataf.cc +++ b/flower/dataf.cc @@ -79,6 +79,9 @@ Data_file::get_word() } /// get a char. +/** + Only class member who uses text_file::get + */ char Data_file::data_get() { char c = get(); @@ -91,9 +94,6 @@ Data_file::data_get() { return c; } -/** - Only class member who uses text_file::get - */ /// read line, gobble '\n' String Data_file::get_line() diff --git a/flower/dstream.cc b/flower/dstream.cc index 02b218d3cf..b045a0f455 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -58,7 +58,9 @@ Dstream::silence(String s) return false; return (*silent)[s]; } -/// + +/** only output possibility. Delegates all conversion to String class. + */ Dstream & Dstream::operator<<(String s) { @@ -93,8 +95,6 @@ Dstream::operator<<(String s) return *this; } -/** only output possibility. Delegates all conversion to String class. - */ Dstream::Dstream(ostream *r, const char * cfg_nm ) { diff --git a/flower/dstream.hh b/flower/dstream.hh index e38f30128f..0143eb0510 100644 --- a/flower/dstream.hh +++ b/flower/dstream.hh @@ -11,6 +11,20 @@ template struct Assoc; /// debug stream + /** + a class for providing debug output of nested structures, + with indents according to \{\}()[]. + + One can turn on and off specific messages using the Assoc silent. + This can be done automatically: + + #define DEBUG dstream_.identify_as(__PRETTY_FUNCTION__) + + DEBUG << "a message\n"; + + Init for the class names which should be silent can be given in a rc file. + + */ class Dstream { ostream *os; @@ -23,29 +37,15 @@ public: bool silence(String); - Dstream(ostream *r, const char * rcfile); /** if rcfile == 0, then do not read any rc file */ + Dstream(ostream *r, const char * rcfile); virtual ~Dstream(); Dstream &identify_as(String s); Dstream &operator << (String s); }; - /** - a class for providing debug output of nested structures, - with indents according to \{\}()[]. - - One can turn on and off specific messages using the Assoc silent. - This can be done automatically: - - #define DEBUG dstream_.identify_as(__PRETTY_FUNCTION__) - - DEBUG << "a message\n"; - - Init for the class names which should be silent can be given in a rc file. - - */ #endif diff --git a/flower/interval.hh b/flower/interval.hh index acf437ad0a..9cff84fb3c 100644 --- a/flower/interval.hh +++ b/flower/interval.hh @@ -13,11 +13,15 @@ /// a T interval +/** + this represents the closed interval [left,right]. + No invariants. T must be a totally ordered ring + */ template struct Interval_t { T left, right; - /****************/ + /* ************** */ T center() { return (left + right) / T(2);} void translate(T t) { @@ -43,11 +47,11 @@ struct Interval_t { T max()const { return right;} T min()const{ return left; } T &min(){ return left; } - void unite(Interval_t h); /** PRE *this and h are comparable */ + void unite(Interval_t h); void intersect(Interval_t h); T length() const; @@ -68,10 +72,6 @@ struct Interval_t { String str() const; bool elt_q(T r); }; -/** - this represents the closed interval [left,right]. - No invariants. T must be a totally ordered ring - */ /// partial ordering template diff --git a/flower/lgetopt.hh b/flower/lgetopt.hh index 0ff3e08419..67deb700bc 100644 --- a/flower/lgetopt.hh +++ b/flower/lgetopt.hh @@ -15,15 +15,16 @@ struct long_option_init { }; -/// +/// C++ for version of long_getopt. +/** For processing GNU style command line arguments. No pointer + (return values, arguments) contents are copied. */ class Getopt_long { public: - /// + /** errorcodes: no error, argument expected, no argument expected, + unknown option, illegal argument (eg. int expected). */ enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION, E_ILLEGALARG } ; - /** errorcodes: no error, argument expected, no argument expected, - unknown option, illegal argument (eg. int expected). */ private: @@ -48,12 +49,12 @@ private: void report(Errorcod c); public: /// what to do with errors - void seterror(ostream *os); /** report messages on #*os#, and abort. if #os# is null, then do not report nor abort, just set #error# */ + void seterror(ostream *os); /// argument. Set to 0 if not present char* optarg; @@ -73,18 +74,14 @@ public: Getopt_long(int c, char **v, long_option_init *lo); /// get the next option - long_option_init *operator()(); /** - RETURN: pointer to next option found. + @return pointer to next option found. 0 if error occurred, or next argument is no option. */ + long_option_init *operator()(); char *current_arg(); char * get_next_arg(); Errorcod error; }; -/** - C++ for version of long_getopt. For processing GNU style command line arguments. - No pointer (return values, arguments) contents are copied. - */ #endif diff --git a/flower/list.hh b/flower/list.hh index 4a4aab2f5b..4f3c1aa825 100644 --- a/flower/list.hh +++ b/flower/list.hh @@ -6,6 +6,27 @@ template class Cursor; template class Link; /// all-purpose doubly linked list +/** + a doubly linked list; + List can be seen as all items written down on paper, + from top to bottom + + class Cursor is used to extend List + + items are always stored as copies in List, but: + #List# : copies of #String# stored + #List# : copies of #String*# stored! + (do not use, use \Ref{PointerList} ## instead.) + + {\bf note:} + retrieving "invalid" cursors, i.e. + #top()/bottom()# from empty list, #find()# without success, + results in a nonvalid Cursor ( #!ok()# ) + + + INVARIANTEN! +*/ + template class List { @@ -30,8 +51,7 @@ class List void concatenate(List const &s); /// make *this empty - void set_empty(); - /** + /** POST: size == 0 @@ -39,15 +59,14 @@ class List WARNING: contents lost, and not deleted. */ - + void set_empty(); + /// add after after_me void add( const T& thing, Cursor &after_me ); /// put thing before #before_me# void insert( const T& thing, Cursor &before_me ); - - void remove( Cursor me ); - /** Remove link pointed to by me. Destructor of contents called + /** Remove link pointed to by me. Destructor of contents called (nop for pointers) POST @@ -56,34 +75,15 @@ class List WARNING: do not use #me# after calling */ + void remove( Cursor me ); + - /****************/ + /* ************** */ int size_; Link* top_; Link* bottom_; }; -/** - a doubly linked list; - List can be seen as all items written down on paper, - from top to bottom - - class Cursor is used to extend List - - items are always stored as copies in List, but: - #List# : copies of #String# stored - #List# : copies of #String*# stored! - (do not use, use \Ref{PointerList} ## instead.) - - {\bf note:} - retrieving "invalid" cursors, i.e. - #top()/bottom()# from empty list, #find()# without success, - results in a nonvalid Cursor ( #!ok()# ) - - - INVARIANTEN! -*/ - #include "list.inl" #include "cursor.hh" diff --git a/flower/matrix.hh b/flower/matrix.hh index 5283dc71ef..73a9f0487e 100644 --- a/flower/matrix.hh +++ b/flower/matrix.hh @@ -6,6 +6,16 @@ #include "vector.hh" /// a Real matrix +/** This is a class for a nonsquare block of #Real#s. The + implementation of sparse matrices is done in the appropriate #smat# + class. Matrix only does the mathematical actions (adding, + multiplying, etc.) + + + TODO + implement ref counting? */ + + class Matrix { virtual_smat *dat; @@ -15,11 +25,11 @@ public: int rows() const { return dat->rows(); } /// return the size of a matrix - int dim() const; /** - PRE + @pre the matrix needs to be square. */ + int dim() const; // Matrix() { dat = 0; } ~Matrix() { delete dat; } @@ -40,7 +50,6 @@ public: void operator/=(Real a) { (*this) *= 1/a; } /// add a row - void insert_row(Vector v,int k); /** add a row to the matrix before row k @@ -48,25 +57,26 @@ public: v.dim() == cols() 0 <= k <= rows() */ + void insert_row(Vector v,int k); /// - void delete_row(int k) { dat->delete_row(k); } /** delete a row from this matrix. PRE 0 <= k < rows(); */ + void delete_row(int k) { dat->delete_row(k); } void delete_column(int k) { dat->delete_column(k); } - /// - Matrix(int n); + /** square n matrix, initialised to null */ - /// - Matrix(int n, int m); + Matrix(int n); + /** n x m matrix, init to 0 */ + Matrix(int n, int m); Matrix(const Matrix &m); /// dyadic product: v * w.transpose @@ -98,18 +108,18 @@ public: Real norm() const; /// swap - void swap_columns(int c1, int c2); /** PRE 0 <= c1,c2 < cols() */ + void swap_columns(int c1, int c2); /// swap - void swap_rows(int c1, int c2); /** PRE 0 <= c1,c2 < rows() */ + void swap_rows(int c1, int c2); Vector row(int ) const; @@ -119,16 +129,6 @@ public: void print() const; }; -/** This is a class for a nonsquare block of #Real#s. The - implementation of sparse matrices is done in the appropriate #smat# - class. Matrix only does the mathematical actions (adding, - multiplying, etc.) - - - TODO - implement ref counting? */ - - inline Vector operator *(Vector &v, const Matrix& m) { return m.left_multiply(v); } Matrix operator *(const Matrix& m1,const Matrix &m2); diff --git a/flower/path.cc b/flower/path.cc index 2fd7eea3cb..2737d1cd15 100644 --- a/flower/path.cc +++ b/flower/path.cc @@ -8,7 +8,10 @@ #define PATHSEP '/' #endif - +/** + INPUT: path the original full filename + OUTPUT: 4 components of the path. They can be empty +*/ void split_path(String path, String &drive, String &dirs, String &filebase, String &extension) @@ -45,11 +48,6 @@ split_path(String path, filebase = path; } } -/** - INPUT: path the original full filename - OUTPUT: 4 components of the path. They can be empty -*/ - File_path::File_path(String pref) { @@ -58,7 +56,11 @@ File_path::File_path(String pref) } -/// +///find a file +/** + It will search in the current dir, in the construction-arg, and + in any other added path, in this order. + */ String File_path::find(String nm) { @@ -75,7 +77,3 @@ File_path::find(String nm) } return ""; } -/** - It will search in the current dir, in the construction-arg, and - in any other added path, in this order. - */ diff --git a/flower/scalar.hh b/flower/scalar.hh index bff21618c6..0213a92f0d 100644 --- a/flower/scalar.hh +++ b/flower/scalar.hh @@ -24,9 +24,9 @@ struct Scalar : public String { operator Real(); operator int(); /// - operator bool() const; /** perl -like string to bool conversion */ + operator bool() const; }; diff --git a/flower/smat.cc b/flower/smat.cc index f2143507b6..d89e3bc285 100644 --- a/flower/smat.cc +++ b/flower/smat.cc @@ -182,7 +182,7 @@ Full_storage::clone() { return new Full_storage(*this); } -/****************************************************************/ + virtual_smat * virtual_smat::get_full(int n, int m) diff --git a/flower/string.hh b/flower/string.hh index 7ed274979d..e58f614699 100644 --- a/flower/string.hh +++ b/flower/string.hh @@ -20,6 +20,30 @@ #include "stringutil.hh" /// the smart string class. +/** + + Intuitive string class. provides + + ref counting through #String_handle# + + conversion from bool, int, double, char *, char. + + conversion to int, upcase, downcase + + + printable. + + indexing (pos, posAny, lastPos) + + cutting (left, right, mid) + + concat (+=, +) + + signed comparison (<, >, ==, etc) + + No operator[] is provided, since this would be enormously slow. If needed, + convert to const char *. +*/ class String { protected: @@ -27,8 +51,8 @@ protected: public: /// init to "" - String() { } /** needed because other constructors are provided.*/ + String() { } String(Rational); /// String s = "abc"; String( const char* source ); @@ -95,11 +119,11 @@ public: int lastPos( const char* string ) const; /// index of leftmost c - int pos(char c ) const; /** RETURN: 0 if not found, else index + 1 */ + int pos(char c ) const; int pos(const char* string ) const; int posAny(const char* string ) const; @@ -117,30 +141,6 @@ public: int len() const; }; -/** - - Intuitive string class. provides - - ref counting thru #String_handle# - - conversion from bool, int, double, char *, char. - - conversion to int, upcase, downcase - - - printable. - - indexing (pos, posAny, lastPos) - - cutting (left, right, mid) - - concat (+=, +) - - signed comparison (<, >, ==, etc) - - No operator[] is provided, since this would be enormously slow. If needed, - convert to const char *. -*/ #include "compare.hh" diff --git a/flower/stringutil.hh b/flower/stringutil.hh index d7f7081617..6a7feb126a 100644 --- a/flower/stringutil.hh +++ b/flower/stringutil.hh @@ -8,7 +8,12 @@ const INITIALMAX=8; class String_handle; + /// Internal String struct +/** + the data itself. Handles simple tasks (resizing, resetting) + */ + class StringData { // GNU malloc: storage overhead is 8 bytes anyway. @@ -43,6 +48,10 @@ friend class String_handle; } + /** POST: maxlen >= j. + IN: j, maximum stringlength. + contents thrown away. + */ void setmax(int j) { OKW(); if (j > maxlen) { @@ -54,11 +63,11 @@ friend class String_handle; length = 0; } } + /** POST: maxlen >= j. - IN: j, maximum stringlength. - contents thrown away. - */ - /// + IN: j, maximum stringlength. + contents are kept if it grows. + */ void remax(int j) { OKW(); if (j > maxlen) { @@ -70,10 +79,6 @@ friend class String_handle; // length = strlen(string); } } - /** POST: maxlen >= j. - IN: j, maximum stringlength. - contents are kept if it grows. - */ /// check if writeable. void OKW() { @@ -153,13 +158,13 @@ friend class String_handle; } }; -/** - the data itself. Handles simple tasks (resizing, resetting) - */ -/****************************************************************/ /// ref. counting for strings +/** + handles ref. counting, and provides a very thin + interface using char * + */ class String_handle { StringData* data; @@ -229,11 +234,6 @@ public: void trunc(int j) { copy(); data->trunc(j); } int len() const { return data->length; } }; -/** - handles ref. counting, and provides a very thin - interface using char * - */ - #ifdef NDEBUG #if (NDEBUG == BLONDE) diff --git a/flower/textdb.hh b/flower/textdb.hh index afb04f0725..cdc8898539 100644 --- a/flower/textdb.hh +++ b/flower/textdb.hh @@ -3,8 +3,7 @@ #include "textstr.hh" -/**: do "#" comments, read quote enclosed fields */ - +/** do "#" comments, read quote enclosed fields */ /// a "const" Array. Contents can't be changed. class Text_record : Array { @@ -28,6 +27,9 @@ public: Array::size; }; +/** + add a subrec/fieldsep/record separator + */ /// abstraction for a datafile class Text_db : private Data_file { @@ -50,8 +52,4 @@ public: } }; - -/** - add a subrec/fieldsep/record separator - */ #endif diff --git a/flower/textstr.hh b/flower/textstr.hh index c89f58cf8d..489682effd 100644 --- a/flower/textstr.hh +++ b/flower/textstr.hh @@ -1,3 +1,4 @@ + #ifndef TEXTSTR_HH #define TEXTSTR_HH @@ -7,13 +8,21 @@ #include "varray.hh" /// line counting input stream. +/** + a stream for textfiles. linecounting. Thin interface getchar and + ungetchar. (ungetc is unlimited) + + should protect get and unget against improper use +*/ + + class Text_stream { int line_no; // could just have used streams. FILE *f; - Array pushback; + Array pushback; String name; public: @@ -61,14 +70,6 @@ class Text_stream /// GNU format message. void message(String s); }; -/** - a stream for textfiles. linecounting. Thin interface getchar and - ungetchar. (ungetc is unlimited) - - should protect get and unget against improper use -*/ - - /// read a data file class Data_file : private Text_stream { diff --git a/flower/tvsmat.hh b/flower/tvsmat.hh index 32f981d2e9..847c650b48 100644 --- a/flower/tvsmat.hh +++ b/flower/tvsmat.hh @@ -3,6 +3,17 @@ #include "varray.hh" /// a matrix storage baseclass. +/** 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 virtual_smat { @@ -17,11 +28,11 @@ public: virtual int cols() const = 0; /// set the size. contents lost - virtual void set_size(int i, int j) = 0; /** PRE i >=0, j>=0 */ + virtual void set_size(int i, int j) = 0; /// set the size to square dimen. contents lost virtual void set_size(int i) = 0; @@ -29,8 +40,7 @@ public: PRE i>=0 */ - /// set the size to i - virtual void resize(int i, int j) = 0; + /// set the size to i,j /** keep contents. If enlarged contents unspecified @@ -39,18 +49,18 @@ public: i>=0, j>=0 */ + virtual void resize(int i, int j) = 0; /// set the size to square dimen. contents kept - virtual void resize(int i) = 0; /** Keep contents. If enlarged contents are unspecified PRE i>=0 */ + virtual void resize(int i) = 0; /// access an element - virtual Real& elem(int i,int j) = 0; /** access an element. @@ -58,6 +68,7 @@ public: in the 0-part of a sparse matrix. */ + virtual Real& elem(int i,int j) = 0; /// access a element, no modify virtual const Real& elem(int i, int j) const = 0; @@ -67,51 +78,50 @@ public: #endif /// add a row - virtual void insert_row(int k)=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 - virtual void delete_row(int k)=0; - /** + /** delete a row from this matrix. PRE 0 <= k < rows(); - */ + */virtual void delete_row(int k)=0; + virtual ~virtual_smat() { } virtual virtual_smat *clone()=0; /// is there a next? - virtual bool mult_ok(int i, int j) const=0; - /** + /** at end of matrix? when doing loop for(i=0; i *get_full(int n, int m); }; -/** 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. - -*/ #endif diff --git a/flower/varray.hh b/flower/varray.hh index 229fdf3c45..0daafb84f8 100644 --- a/flower/varray.hh +++ b/flower/varray.hh @@ -16,6 +16,15 @@ inline void arrcpy(T*dest, T*src, int count) { } ///scaleable array/stack template, for T with def ctor. +/** + + This template implements a scaleable vector. With (or without) range + checking. It may be flaky for objects with complicated con- and + destructors. The type T should have a default constructor. It is + best suited for simple types, such as int, double or String + + It uses stack terminology, (push, pop, top), and can be used as a stack. + */ template class Array { protected: @@ -166,14 +175,5 @@ public: return r; } }; -/** - - This template implements a scaleable vector. With (or without) range - checking. It may be flaky for objects with complicated con- and - destructors. The type T should have a default constructor. It is - best suited for simple types, such as int, double or String - - It uses stack terminology, (push, pop, top), and can be used as a stack. - */ #endif diff --git a/flower/vector.hh b/flower/vector.hh index c039d5ce89..266254dbb8 100644 --- a/flower/vector.hh +++ b/flower/vector.hh @@ -10,6 +10,9 @@ class String; void set_matrix_debug(Dstream&ds); /// a row of numbers +/** + a vector. Storage is handled in Array, Vector only does the mathematics. + */ class Vector { Array dat; public: @@ -75,9 +78,6 @@ public: /// set to j-th element of unit-base void set_unit(int j) ; }; -/** - a vector. Storage is handled in Array, Vector only does the mathematics. - */ inline Vector operator+(Vector a, Vector const &b) { diff --git a/flower/vsmat.hh b/flower/vsmat.hh index 3112ae9b25..8765cbfe94 100644 --- a/flower/vsmat.hh +++ b/flower/vsmat.hh @@ -17,12 +17,12 @@ public: virtual int cols() const = 0; /// set the size. contents lost - virtual void set_size(int i, int j) = 0; /** PRE i >=0, j>=0 */ + virtual void set_size(int i, int j) = 0; /// set the size to square dimen. contents lost virtual void set_size(int i) = 0; /** -- 2.39.5