#include <tables.H>
Inheritance diagram for Tuple< T >:
The class Tuple represents an n-tuple of elements of type T, where n can be dynamically adjusted. It is meant to be a light, simple replacement for regular arrays.
Definition at line 27 of file tables.H.
Public Member Functions | |
Tuple () | |
default constructor | |
Tuple (long thesize) | |
constructor | |
Tuple (const Tuple< T > &that) | |
~Tuple () | |
destructor: releases memory. | |
void | block_copy (T *dest, const T *source, long amount) |
void | resize (long thesize) |
dynamically resize | |
void | copy (const Tuple< T > &that) |
copy of another tuple | |
Tuple< T > & | operator= (const Tuple< T > &that) |
asignment operator = | |
void | steal (Tuple< T > &that) |
steal data | |
long | size () const |
returns the current size (tuple_size) | |
void | set_sep (const char s) |
sets the separator which is used when displaying. 0 means no separation. | |
T & | operator[] (long i) |
reading or writing data | |
const T & | operator[] (long i) const |
bool | operator== (const Tuple< T > &that) const |
compares tuples | |
Protected Attributes | |
long | tuple_size |
current size of the n-tuple (n, what.) | |
T * | data |
pointer to the data itself | |
char | sep |
separator, when printing. 0 means no separation. | |
Friends | |
ostream & | operator<< (ostream &os, const Tuple< T > &M) |
prints a tuple on a stream | |
ofstream & | operator<< (ofstream &file, Tuple< T > &M) |
write to file | |
void | operator>> (ifstream &file, Tuple< T > &M) |
read from file |
|
default constructor sets the size to 0. |
|
constructor
|
|
destructor: releases memory.
|
|
copy of another tuple the size of the tuple is adjusted, and data is copied into it from "that"
Definition at line 103 of file tables.H. Referenced by Table< Polynomial< K > >::copy(). |
|
asignment operator = the size of the tuple is adjusted, and data is copied into it from "that"
|
|
compares tuples
|
|
reading or writing data this returns the T object at position i, and it may be used on the left or right of an assignement with =.
Tuple<int> v(7); v[5]=-3; |
|
dynamically resize so far, no mechanism in case there isn't enough memory. resizing is of course quite slow and memory consuming, so use with moderation.
Definition at line 84 of file tables.H. Referenced by Exponentiator< F_2 >::compute_lambda_relation(), Exponentiator< F_2 >::compute_tensor_relation(), Exponentiator< F_2 >::create_extra_variables(), AffineAlgebra< F_2 >::get_variables(), GradedAlgebra< F_2 >::list_monomials(), PowProd::operator/=(), MilnorAnalyzer::re_setup(), RepresentationRing::read_variables(), HomFinder::restrict_to_elemab(), DerivationAnalyzer::setup(), MilnorAnalyzer::setup_for_Sq1(), PowProd::shift(), PowProd::swap(), GradedAlgebra< F_2 >::top_degree(), and UnstableAlgebra::write_trivial_steenrod_operations(). |
|
sets the separator which is used when displaying. 0 means no separation.
Definition at line 148 of file tables.H. Referenced by multiPolynomial< F_2 >::multiPolynomial(). |
|
|
steal data If a and b are tuples, and if you use a.steal(b), then a becomes what b was, while b is emptied. Point: no copy of memory is performed, so the operation is extremely fast. This may be used for example to swap x and y efficiently: simply use dummy.steal(x); x.steal(y); y.steal(dummy); Definition at line 136 of file tables.H. Referenced by Table< Polynomial< K > >::steal(), UnstableAlgebra::swap_variables_order(), and RepresentationRing::swap_variables_order(). |
|
write to file
|
|
prints a tuple on a stream this assumes that objects of type T sent to os!
Tuple<long> M(12); cout << "value of M: " << M; |
|
read from file
|
|
pointer to the data itself
Definition at line 33 of file tables.H. Referenced by Tuple< Polynomial< K > >::copy(), Matrix< Polynomial< K > >::operator+=(), Matrix< Polynomial< K > >::operator-=(), Tuple< Polynomial< K > >::operator==(), and Tuple< Polynomial< K > >::steal(). |
|
separator, when printing. 0 means no separation.
Definition at line 35 of file tables.H. Referenced by Tuple< Polynomial< K > >::copy(). |
|
current size of the n-tuple (n, what.)
Definition at line 31 of file tables.H. Referenced by Tuple< Polynomial< K > >::copy(), Tuple< Polynomial< K > >::operator==(), and Tuple< Polynomial< K > >::steal(). |