Frobby  0.9.5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TermTranslator Class Reference

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 ()
 
TermTranslatoroperator= (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 VarNamesgetNames () 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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TermTranslator() [1/4]

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.

◆ TermTranslator() [2/4]

TermTranslator::TermTranslator ( const BigIdeal bigIdeal,
Ideal ideal,
bool  sortVars = true 
)

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() [3/4]

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() [4/4]

TermTranslator::TermTranslator ( const TermTranslator translator)

Definition at line 376 of file TermTranslator.cpp.

◆ ~TermTranslator()

TermTranslator::~TermTranslator ( )

Definition at line 387 of file TermTranslator.cpp.

Member Function Documentation

◆ addPurePowersAtInfinity()

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.

◆ clearStrings()

void TermTranslator::clearStrings ( )
private

Definition at line 143 of file TermTranslator.cpp.

◆ decrement()

void TermTranslator::decrement ( )

Replaces var^v by var^(v-1).

Definition at line 296 of file TermTranslator.cpp.

◆ dualize()

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.

◆ getExponent() [1/2]

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.

◆ getExponent() [2/2]

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.

◆ getExponentString()

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.

◆ getMaxId()

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.

◆ getNames()

const VarNames & TermTranslator::getNames ( ) const

Definition at line 443 of file TermTranslator.cpp.

◆ getVarCount()

size_t TermTranslator::getVarCount ( ) const

Definition at line 447 of file TermTranslator.cpp.

◆ getVarExponentString()

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.

◆ initialize()

void TermTranslator::initialize ( const vector< BigIdeal * > &  bigIdeals,
bool  sortVars 
)
private

Definition at line 165 of file TermTranslator.cpp.

◆ lessThanReverseLex()

bool TermTranslator::lessThanReverseLex ( const Exponent a,
const Exponent b 
) const

Definition at line 451 of file TermTranslator.cpp.

◆ makeStrings()

void TermTranslator::makeStrings ( bool  includeVar) const
private

Definition at line 346 of file TermTranslator.cpp.

◆ operator=()

TermTranslator & TermTranslator::operator= ( const TermTranslator translator)

Definition at line 380 of file TermTranslator.cpp.

◆ print()

void TermTranslator::print ( ostream &  out) const

Definition at line 328 of file TermTranslator.cpp.

◆ renameVariables()

void TermTranslator::renameVariables ( const VarNames names)

Definition at line 303 of file TermTranslator.cpp.

◆ setInfinityPowersToZero()

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.

Todo:
Figure out what is going on with the continue in this method.

Also, make it use the methods of ideal, instead of rolling its own iteration code.

Definition at line 264 of file TermTranslator.cpp.

◆ shrinkBigIdeal()

void TermTranslator::shrinkBigIdeal ( const BigIdeal bigIdeal,
Ideal ideal 
) const
private

Definition at line 199 of file TermTranslator.cpp.

◆ shrinkExponent()

Exponent TermTranslator::shrinkExponent ( size_t  var,
const mpz_class &  exponent 
) const
private

Definition at line 430 of file TermTranslator.cpp.

◆ swapVariables()

void TermTranslator::swapVariables ( size_t  a,
size_t  b 
)

Definition at line 310 of file TermTranslator.cpp.

◆ toString()

string TermTranslator::toString ( ) const

Definition at line 340 of file TermTranslator.cpp.

Member Data Documentation

◆ _exponents

vector<vector<mpz_class> > TermTranslator::_exponents
private

Definition at line 132 of file TermTranslator.h.

◆ _names

VarNames TermTranslator::_names
private

Definition at line 135 of file TermTranslator.h.

◆ _stringExponents

vector<vector<const char*> > TermTranslator::_stringExponents
mutableprivate

Definition at line 133 of file TermTranslator.h.

◆ _stringVarExponents

vector<vector<const char*> > TermTranslator::_stringVarExponents
mutableprivate

Definition at line 134 of file TermTranslator.h.


The documentation for this class was generated from the following files: