#include <alphabet.H>
Inheritance diagram for SimpleAlphabet:
you use new_variable("X"); then new_variable("c_2(r_4)"); repeatedly, and they are numbered 1, 2, 3 and so on. you get the name back with name_of(long). see also new_indeterminate in polynomials.H, which makes this transparent. The various algebra classes will make this even easier (as well as perform many many more things). example:
SimpleAlphabet alpha; Polynomial<double> X, Y, P; X= new_indeterminate(alpha, "X"); Y= new_indeterminate(alpha, "Y"); P= X*X + X*Y*(-4); // P is X^2 - 4XY cout << P; // prints X^2 + -4XY
alpha.new_variable("X"); X= Polynomial<double>( PowProd(1) ); X.alphabet=α
Definition at line 61 of file alphabet.H.
Public Member Functions | |
virtual string | nameof (long var_num) const |
returns the name of variable number var_num | |
long | new_variable (const string &thename) |
stores a new string -- a new variable | |
long | variables_in_use () const |
lets you know how many variables you have created so far. | |
Protected Attributes | |
map< long, string > | names |
the names | |
long | var_in_use |
this is the number of variables created -- READ ME ! |
|
returns the name of variable number var_num
Implements Alphabet. Definition at line 28 of file alphabet.cpp. References names. Referenced by SW_Maker::add_complex_relations(), Exponentiator< F_2 >::compute_exp_relations(), SW_Maker::create_regular_variables(), Chern_Maker::create_regular_variables(), Exponentiator< F_2 >::create_regular_variables(), UnstableAlgebra::display(), HomFinder::extend(), HomFinder::extend_all(), AffineAlgebra< F_2 >::find_redundancies(), AffineAlgebra< F_2 >::find_unitary_redundancies(), MilnorAnalyzer::re_setup(), UnstableAlgebra::saturate_and_reduce(), DerivationAnalyzer::setup(), MilnorAnalyzer::setup_for_Sq1(), and AffineAlgebra< F_2 >::tensor_with(). |
|
stores a new string -- a new variable
Reimplemented in AffineAlgebra< K >, AffineAlgebra< QQ >, and AffineAlgebra< F_2 >. Definition at line 37 of file alphabet.cpp. References names, and var_in_use. Referenced by AffineAlgebra< F_2 >::new_variable(). |
|
|
the names
Definition at line 64 of file alphabet.H. Referenced by nameof(), and new_variable(). |
|
this is the number of variables created -- READ ME ! There is (normally) always an uninterrupted sequence of variables created, numbered 1, 2, ..., var_in_use. Other routines expect that, so one should never kill a variable other than the top one. One reason is that the implementation of PowProd is such that less memory is used when we stick to variables of low indices. More explicitly if x and y are the first two variables, then y is encoded as x^0y^1 and thus occupies more memory than x=x^1. Gets worse with the 50th variable of course. So if you want to kill a variable, kill the top one. The AffineAlgebra class, which inherits from this, has a mechanism for swapping variables. Definition at line 80 of file alphabet.H. Referenced by new_variable(). |