Frobby
0.9.5
|
TermTranslator handles translation between terms whose exponents are infinite precision integers and terms whose exponents are 32 bit integers. More...
#include <TermTranslator.h>
Public Member Functions | |
TermTranslator (size_t varCount, size_t upToExponent) | |
Constructs a translator of varCount variables that translates each number to itself, up to and not including upToExponent. More... | |
TermTranslator (const BigIdeal &bigIdeal, Ideal &ideal, bool sortVars=true) | |
Translates bigIdeal into ideal, and construct a translator to translate back. More... | |
TermTranslator (const vector< BigIdeal * > &bigIdeals, vector< Ideal * > &ideals) | |
Translates bigIdeals into ideals, while constructing a translator to translate back. More... | |
TermTranslator (const TermTranslator &translator) | |
~TermTranslator () | |
TermTranslator & | operator= (const TermTranslator &translator) |
const mpz_class & | getExponent (size_t variable, Exponent exponent) const |
This method translates from IDs to arbitrary precision integers. More... | |
const mpz_class & | getExponent (size_t variable, const Term &term) const |
This method translates from IDs to arbitrary precision integers. More... | |
const char * | getVarExponentString (size_t variable, Exponent exponent) const |
As getExponent, except the string "var^e" is returned or null if the exponent is zero, where var is the variable and e is the exponent. More... | |
const char * | getExponentString (size_t variable, Exponent exponent) const |
as getExponent, except the string "e" is returned, where e is the exponent. More... | |
Exponent | getMaxId (size_t variable) const |
The assigned IDs are those in the range [0, getMaxId(var)]. More... | |
void | addPurePowersAtInfinity (Ideal &ideal) const |
Adds a generator of the form v^e, e > 0, for any variable v where generator of that form is not already present. More... | |
void | setInfinityPowersToZero (Ideal &ideal) const |
The method addPurePowersAtInfinity adds high exponents that map to zero. More... | |
const VarNames & | getNames () const |
size_t | getVarCount () const |
void | dualize (const vector< mpz_class > &a) |
Replaces var^v by var^(a[i] - v) except that var^0 is left alone. More... | |
void | decrement () |
Replaces var^v by var^(v-1). More... | |
void | renameVariables (const VarNames &names) |
void | swapVariables (size_t a, size_t b) |
bool | lessThanReverseLex (const Exponent *a, const Exponent *b) const |
void | print (ostream &out) const |
string | toString () const |
Private Member Functions | |
void | makeStrings (bool includeVar) const |
void | clearStrings () |
void | initialize (const vector< BigIdeal * > &bigIdeals, bool sortVars) |
void | shrinkBigIdeal (const BigIdeal &bigIdeal, Ideal &ideal) const |
Exponent | shrinkExponent (size_t var, const mpz_class &exponent) const |
Private Attributes | |
vector< vector< mpz_class > > | _exponents |
vector< vector< const char * > > | _stringExponents |
vector< vector< const char * > > | _stringVarExponents |
VarNames | _names |
TermTranslator handles translation between terms whose exponents are infinite precision integers and terms whose exponents are 32 bit integers.
This is done by assigning the big integers IDs that are 32 bit integers such that the assignment of IDs preserves order of exponents for each variable.
The translation is done at the level of whole ideals.
The big integer 0 is always assigned the ID 0.
Definition at line 41 of file TermTranslator.h.
TermTranslator::TermTranslator | ( | size_t | varCount, |
size_t | upToExponent | ||
) |
Constructs a translator of varCount variables that translates each number to itself, up to and not including upToExponent.
Definition at line 32 of file TermTranslator.cpp.
Translates bigIdeal into ideal, and construct a translator to translate back.
sortVars indicates whether or not the order of the variable names should be sorted.
Definition at line 45 of file TermTranslator.cpp.
TermTranslator::TermTranslator | ( | const vector< BigIdeal * > & | bigIdeals, |
vector< Ideal * > & | ideals | ||
) |
Translates bigIdeals into ideals, while constructing a translator to translate back.
The variable names will be sorted, and the ideals will be embedded in a ring with the union of all variables present in bigIdeals.
Definition at line 54 of file TermTranslator.cpp.
TermTranslator::TermTranslator | ( | const TermTranslator & | translator | ) |
Definition at line 376 of file TermTranslator.cpp.
TermTranslator::~TermTranslator | ( | ) |
Definition at line 387 of file TermTranslator.cpp.
void TermTranslator::addPurePowersAtInfinity | ( | Ideal & | ideal | ) | const |
Adds a generator of the form v^e, e > 0, for any variable v where generator of that form is not already present.
e is chosen to be larger than any exponent (i.e. ID) already present, and it maps to 0. Note that this does NOT preserve order - the highest ID always maps to 0. The reason for this is that this is what is needed for computing irreducible decompositions.
Definition at line 232 of file TermTranslator.cpp.
|
private |
Definition at line 143 of file TermTranslator.cpp.
void TermTranslator::decrement | ( | ) |
Replaces var^v by var^(v-1).
Definition at line 296 of file TermTranslator.cpp.
void TermTranslator::dualize | ( | const vector< mpz_class > & | a | ) |
Replaces var^v by var^(a[i] - v) except that var^0 is left alone.
Definition at line 288 of file TermTranslator.cpp.
const mpz_class & TermTranslator::getExponent | ( | size_t | variable, |
const Term & | term | ||
) | const |
This method translates from IDs to arbitrary precision integers.
Definition at line 419 of file TermTranslator.cpp.
const mpz_class & TermTranslator::getExponent | ( | size_t | variable, |
Exponent | exponent | ||
) | const |
This method translates from IDs to arbitrary precision integers.
Definition at line 391 of file TermTranslator.cpp.
const char * TermTranslator::getExponentString | ( | size_t | variable, |
Exponent | exponent | ||
) | const |
as getExponent, except the string "e" is returned, where e is the exponent.
Definition at line 409 of file TermTranslator.cpp.
Exponent TermTranslator::getMaxId | ( | size_t | variable | ) | const |
The assigned IDs are those in the range [0, getMaxId(var)].
As a special case, getMaxId(var) maps to the same exponent as 0 does.
Definition at line 424 of file TermTranslator.cpp.
const VarNames & TermTranslator::getNames | ( | ) | const |
Definition at line 443 of file TermTranslator.cpp.
size_t TermTranslator::getVarCount | ( | ) | const |
Definition at line 447 of file TermTranslator.cpp.
const char * TermTranslator::getVarExponentString | ( | size_t | variable, |
Exponent | exponent | ||
) | const |
As getExponent, except the string "var^e" is returned or null if the exponent is zero, where var is the variable and e is the exponent.
Definition at line 399 of file TermTranslator.cpp.
|
private |
Definition at line 165 of file TermTranslator.cpp.
Definition at line 451 of file TermTranslator.cpp.
|
private |
Definition at line 346 of file TermTranslator.cpp.
TermTranslator & TermTranslator::operator= | ( | const TermTranslator & | translator | ) |
Definition at line 380 of file TermTranslator.cpp.
void TermTranslator::print | ( | ostream & | out | ) | const |
Definition at line 328 of file TermTranslator.cpp.
void TermTranslator::renameVariables | ( | const VarNames & | names | ) |
Definition at line 303 of file TermTranslator.cpp.
void TermTranslator::setInfinityPowersToZero | ( | Ideal & | ideal | ) | const |
The method addPurePowersAtInfinity adds high exponents that map to zero.
This method replaces those high powers with the power zero.
Also, make it use the methods of ideal, instead of rolling its own iteration code.
Definition at line 264 of file TermTranslator.cpp.
Definition at line 199 of file TermTranslator.cpp.
|
private |
Definition at line 430 of file TermTranslator.cpp.
void TermTranslator::swapVariables | ( | size_t | a, |
size_t | b | ||
) |
Definition at line 310 of file TermTranslator.cpp.
string TermTranslator::toString | ( | ) | const |
Definition at line 340 of file TermTranslator.cpp.
|
private |
Definition at line 132 of file TermTranslator.h.
|
private |
Definition at line 135 of file TermTranslator.h.
|
mutableprivate |
Definition at line 133 of file TermTranslator.h.
|
mutableprivate |
Definition at line 134 of file TermTranslator.h.