Frobby  0.9.5
TermGrader.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #ifndef TERM_GRADER_GUARD
18 #define TERM_GRADER_GUARD
19 
20 #include <vector>
21 
22 class Projection;
23 class Term;
24 class TermTranslator;
25 
27 class TermGrader {
28 public:
29  TermGrader(const vector<mpz_class>& varDegrees,
30  const TermTranslator& translator);
31 
33  mpz_class getDegree(const Term& term) const;
34 
36  void getDegree(const Term& term, mpz_class& degree) const;
37 
41  void getDegree(const Term& term,
42  const Projection& projection,
43  mpz_class& degree) const;
44 
48  void getUpperBound(const Term& divisor,
49  const Term& dominator,
50  mpz_class& bound) const;
51 
59  mpz_class getUpperBound(const Term& divisor,
60  const Term& dominator) const;
61 
70  Exponent getLargestLessThan2(size_t var,
71  const mpz_class& value, bool strict = true) const;
72 
77  Exponent getLargestLessThan2(size_t var, Exponent from, Exponent to,
78  const mpz_class& value, bool strict =
79  true) const;
80 
81  void getIncrementedDegree(const Term& term,
82  const Projection& projection,
83  mpz_class& degree) const;
84 
88  bool getMinIndexLessThan(size_t var,
89  Exponent from,
90  Exponent to,
91  Exponent& index,
92  const mpz_class& maxDegree) const;
93 
97  bool getMaxIndexLessThan(size_t var,
98  Exponent from,
99  Exponent to,
100  Exponent& index,
101  const mpz_class& maxDegree) const;
102 
103 
104  const mpz_class& getGrade(size_t var, Exponent exponent) const;
105 
106  Exponent getMaxExponent(size_t var) const;
107 
108  size_t getVarCount() const;
109 
110  void print(ostream& out) const;
111 
116  int getGradeSign(size_t var) const;
117 
118 private:
119  vector<vector<mpz_class> > _grades;
120  vector<int> _signs;
121 };
122 
123 ostream& operator<<(ostream& out, const TermGrader& grader);
124 
125 #endif
ostream & operator<<(ostream &out, const TermGrader &grader)
Definition: TermGrader.cpp:307
A TermGrader assigns a value, the degree, to each monomial.
Definition: TermGrader.h:27
void getIncrementedDegree(const Term &term, const Projection &projection, mpz_class &degree) const
Definition: TermGrader.cpp:266
void print(ostream &out) const
Definition: TermGrader.cpp:291
vector< int > _signs
Definition: TermGrader.h:120
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.
Definition: TermGrader.cpp:180
mpz_class getDegree(const Term &term) const
Returns the degree of term.
Definition: TermGrader.cpp:47
size_t getVarCount() const
Definition: TermGrader.cpp:287
Exponent getMaxExponent(size_t var) const
Definition: TermGrader.cpp:282
TermGrader(const vector< mpz_class > &varDegrees, const TermTranslator &translator)
Definition: TermGrader.cpp:24
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.
Definition: TermGrader.cpp:153
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...
Definition: TermGrader.cpp:69
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.
Definition: TermGrader.cpp:126
int getGradeSign(size_t var) const
Returns 1 if the grade strictly increases with the exponent of var, returns -1 if it strictly decreas...
Definition: TermGrader.cpp:302
const mpz_class & getGrade(size_t var, Exponent exponent) const
Definition: TermGrader.cpp:275
vector< vector< mpz_class > > _grades
Definition: TermGrader.h:119
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
Term represents a product of variables which does not include a coefficient.
Definition: Term.h:49
unsigned int Exponent
Definition: stdinc.h:89