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

A TermGrader assigns a value, the degree, to each monomial. More...

#include <TermGrader.h>

Public Member Functions

 TermGrader (const vector< mpz_class > &varDegrees, const TermTranslator &translator)
 
mpz_class getDegree (const Term &term) const
 Returns the degree of term. More...
 
void getDegree (const Term &term, mpz_class &degree) const
 Assigns the degree of term to degree. More...
 
void getDegree (const Term &term, const Projection &projection, mpz_class &degree) const
 Assigns the degree of the preimage of term through the projection to degree. More...
 
void getUpperBound (const Term &divisor, const Term &dominator, mpz_class &bound) const
 Assigns to bound the degree of the largest term v such that divisor divides v and v divides dominator. More...
 
mpz_class getUpperBound (const Term &divisor, const Term &dominator) const
 Returns the degree of the largest term v such that divisor divides v and v divides dominator. More...
 
Exponent getLargestLessThan2 (size_t var, const mpz_class &value, bool strict=true) const
 Returns the index of the largest stored exponent of var that is less than value. More...
 
Exponent getLargestLessThan2 (size_t var, Exponent from, Exponent to, const mpz_class &value, bool strict=true) const
 Returns the value in the interval [from, to] that is closest to getLargestLessThan(var, value, strict). More...
 
void getIncrementedDegree (const Term &term, const Projection &projection, mpz_class &degree) const
 
bool getMinIndexLessThan (size_t var, Exponent from, Exponent to, Exponent &index, const mpz_class &maxDegree) const
 Finds minimal index in [from, to] to such that degree(t) <= maxDegree. More...
 
bool getMaxIndexLessThan (size_t var, Exponent from, Exponent to, Exponent &index, const mpz_class &maxDegree) const
 Finds maximal index in [from, to] to such that degree(t) <= maxDegree. More...
 
const mpz_class & getGrade (size_t var, Exponent exponent) const
 
Exponent getMaxExponent (size_t var) const
 
size_t getVarCount () const
 
void print (ostream &out) const
 
int getGradeSign (size_t var) const
 Returns 1 if the grade strictly increases with the exponent of var, returns -1 if it strictly decreases, and returns 0 if changing the exponent has no impact on the grade. More...
 

Private Attributes

vector< vector< mpz_class > > _grades
 
vector< int > _signs
 

Detailed Description

A TermGrader assigns a value, the degree, to each monomial.

Definition at line 27 of file TermGrader.h.

Constructor & Destructor Documentation

◆ TermGrader()

TermGrader::TermGrader ( const vector< mpz_class > &  varDegrees,
const TermTranslator translator 
)

Definition at line 24 of file TermGrader.cpp.

Member Function Documentation

◆ getDegree() [1/3]

mpz_class TermGrader::getDegree ( const Term term) const

Returns the degree of term.

Definition at line 47 of file TermGrader.cpp.

◆ getDegree() [2/3]

void TermGrader::getDegree ( const Term term,
const Projection projection,
mpz_class &  degree 
) const

Assigns the degree of the preimage of term through the projection to degree.

Definition at line 60 of file TermGrader.cpp.

◆ getDegree() [3/3]

void TermGrader::getDegree ( const Term term,
mpz_class &  degree 
) const

Assigns the degree of term to degree.

Definition at line 53 of file TermGrader.cpp.

◆ getGrade()

const mpz_class & TermGrader::getGrade ( size_t  var,
Exponent  exponent 
) const

Definition at line 275 of file TermGrader.cpp.

◆ getGradeSign()

int TermGrader::getGradeSign ( size_t  var) const

Returns 1 if the grade strictly increases with the exponent of var, returns -1 if it strictly decreases, and returns 0 if changing the exponent has no impact on the grade.

Definition at line 302 of file TermGrader.cpp.

◆ getIncrementedDegree()

void TermGrader::getIncrementedDegree ( const Term term,
const Projection projection,
mpz_class &  degree 
) const

Definition at line 266 of file TermGrader.cpp.

◆ getLargestLessThan2() [1/2]

Exponent TermGrader::getLargestLessThan2 ( size_t  var,
const mpz_class &  value,
bool  strict = true 
) const

Returns the index of the largest stored exponent of var that is less than value.

If strict is true, then it is strictly less than, otherwise it is less than or equal to. If no such exponent exists, then the return value is 0.

If the sign is zero, then 0 is returned. Uses a linear scan, and is only really used to check the output of the other overload.

Definition at line 179 of file TermGrader.cpp.

◆ getLargestLessThan2() [2/2]

Exponent TermGrader::getLargestLessThan2 ( size_t  var,
Exponent  from,
Exponent  to,
const mpz_class &  value,
bool  strict = true 
) const

Returns the value in the interval [from, to] that is closest to getLargestLessThan(var, value, strict).

Only uses a logarithmic number of comparisons.

Definition at line 199 of file TermGrader.cpp.

◆ getMaxExponent()

Exponent TermGrader::getMaxExponent ( size_t  var) const

Definition at line 282 of file TermGrader.cpp.

◆ getMaxIndexLessThan()

bool TermGrader::getMaxIndexLessThan ( size_t  var,
Exponent  from,
Exponent  to,
Exponent index,
const mpz_class &  maxDegree 
) const

Finds maximal index in [from, to] to such that degree(t) <= maxDegree.

Returns true if such a t exists, and false otherwise.

Definition at line 152 of file TermGrader.cpp.

◆ getMinIndexLessThan()

bool TermGrader::getMinIndexLessThan ( size_t  var,
Exponent  from,
Exponent  to,
Exponent index,
const mpz_class &  maxDegree 
) const

Finds minimal index in [from, to] to such that degree(t) <= maxDegree.

Returns true if such a t exists, and false otherwise.

Definition at line 125 of file TermGrader.cpp.

◆ getUpperBound() [1/2]

mpz_class TermGrader::getUpperBound ( const Term divisor,
const Term dominator 
) const

Returns the degree of the largest term v such that divisor divides v and v divides dominator.

Returning the value implies a copy so that this overload is less efficient than the one placing the value in a parameter. This purpose of this method is to be more convenient for tests.

Definition at line 118 of file TermGrader.cpp.

◆ getUpperBound() [2/2]

void TermGrader::getUpperBound ( const Term divisor,
const Term dominator,
mpz_class &  bound 
) const

Assigns to bound the degree of the largest term v such that divisor divides v and v divides dominator.

Definition at line 69 of file TermGrader.cpp.

◆ getVarCount()

size_t TermGrader::getVarCount ( ) const

Definition at line 287 of file TermGrader.cpp.

◆ print()

void TermGrader::print ( ostream &  out) const

Definition at line 291 of file TermGrader.cpp.

Member Data Documentation

◆ _grades

vector<vector<mpz_class> > TermGrader::_grades
private

Definition at line 119 of file TermGrader.h.

◆ _signs

vector<int> TermGrader::_signs
private

Definition at line 120 of file TermGrader.h.


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