#include <tables.H>
Inheritance diagram for Table< T >:
A 2-dimensional array of elements of type T may be defined using Tuple< Tuple<T> > M. It is even recommended when we want a "matrix with lines of different sizes". Elements may be accessed or modified via M(i)(j). Setting M.set_sep('
') assures that M displays quite well.
However, the operation of assignment, for example, is terribly slow and memory consuming. So we provide the Table class, which is optimized for this, and also improves various things like the way tables are displayed, the way elements are accessed, etc. This is achieved by defining a table of size (i,j) to be a tuple of size i*j together with a bunch of pointers to where the "lines" start.
The methods are similar to those of Tuple, so there are less comments.
Definition at line 256 of file tables.H.
Public Member Functions | |
Table () | |
default constructor | |
Table (long i, long j) | |
constructor | |
Table (const Table< T > &that) | |
constructor | |
~Table () | |
destructor: releases memory | |
void | resize (long i, long j) |
resize | |
void | copy (const Table< T > &that) |
copy from another table | |
void | steal (Table< T > &that) |
steal data | |
Table< T > | operator= (const Table< T > &that) |
assigment operator = | |
void | readline (long i, const Tuple< T > &line) |
loads a line from a Tuple | |
void | get_data_from_tuple_list (const list< Tuple< T > > &L) |
T & | operator() (long i, long j) |
read or write data, eg x= M(i,j); or M(i,j)=5; | |
const T & | operator() (long i, long j) const |
long | nlines () const |
current number of lines | |
long | ncols () const |
current number of rows | |
void | set_delim (char theleft, char theright) |
set delimiters (for display purposes) | |
Protected Member Functions | |
long | col_width () const |
width of the largest column | |
void | write_ptrs () |
write "bookmarks" | |
Protected Attributes | |
T ** | pdata |
pointers to the lines | |
long | nb_lines |
self-evident | |
long | nb_cols |
self-evident | |
char | left |
chars printed on the borders | |
char | right |
chars printed on the borders | |
Friends | |
ostream & | operator<< (ostream &os, const Table< T > &M) |
displays the table with neatly aligned columns |
|
default constructor sets the size to 1 line, 1 row. |
|
constructor
|
|
constructor
|
|
destructor: releases memory
|
|
width of the largest column for display purposes.
|
|
copy from another table
Definition at line 366 of file tables.H. Referenced by Table< Polynomial< K > >::operator=(). |
|
current number of rows
Definition at line 445 of file tables.H. Referenced by multiIdeal< K >::simplify(). |
|
current number of lines
Definition at line 443 of file tables.H. Referenced by DerivationAnalyzer::constant_subalgebra(), and HomFinder::set_hom_from_matrix(). |
|
read or write data, eg x= M(i,j); or M(i,j)=5;
|
|
assigment operator =
|
|
loads a line from a Tuple this assumes that "line" is large enough. Data is read to fill the specified line.
|
|
resize
Definition at line 343 of file tables.H. Referenced by DerivationAnalyzer::constant_subalgebra(), SW_Maker::create_regular_variables(), Chern_Maker::create_regular_variables(), Exponentiator< F_2 >::create_regular_variables(), multiIdeal< K >::grobnerize_with_coefficients(), and Ideal< F_2 >::grobnerize_with_coefficients(). |
|
set delimiters (for display purposes)
|
|
steal data
Definition at line 376 of file tables.H. Referenced by Matrix< Polynomial< K > >::operator *=(). |
|
write "bookmarks" this fills in an array of pointers to the different "lines" in the table. Allows faster access. this assumes that pdata does not point to anything; a "new " operation is performed on pdata. Definition at line 296 of file tables.H. Referenced by Table< Polynomial< K > >::copy(), and Table< Polynomial< K > >::resize(). |
|
displays the table with neatly aligned columns
|
|
chars printed on the borders
Definition at line 263 of file tables.H. Referenced by Table< Polynomial< K > >::copy(). |
|
self-evident
Definition at line 261 of file tables.H. Referenced by Table< Polynomial< K > >::copy(), Matrix< Polynomial< K > >::operator+=(), Matrix< Polynomial< K > >::operator-=(), and Table< Polynomial< K > >::steal(). |
|
self-evident
Definition at line 261 of file tables.H. Referenced by Table< Polynomial< K > >::copy(), Matrix< Polynomial< K > >::operator+=(), Matrix< Polynomial< K > >::operator-=(), and Table< Polynomial< K > >::steal(). |
|
pointers to the lines
Definition at line 259 of file tables.H. Referenced by Table< Polynomial< K > >::steal(). |
|
chars printed on the borders
Definition at line 263 of file tables.H. Referenced by Table< Polynomial< K > >::copy(). |