Frobby 0.9.5
BigPolynomial.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 BIG_POLYNOMIAL_GUARD
18#define BIG_POLYNOMIAL_GUARD
19
20class VarNames;
21class Term;
22class TermTranslator;
23
24#include "VarNames.h"
25#include <vector>
26
28 public:
31
32 size_t getTermCount() const;
33 size_t getVarCount() const;
34 const VarNames& getNames() const;
35
36 // Removes all terms but does not change getNames().
37 void clear();
38 void clearAndSetNames(const VarNames& names);
39
41 void sortVariables();
42
43 const mpz_class& getCoef(size_t index) const;
44 const vector<mpz_class>& getTerm(size_t index) const;
45
46 void newLastTerm();
47 vector<mpz_class>& getLastTerm();
49
50 void renameVars(const VarNames& names);
51
52 void add(const mpz_class& coef, const vector<mpz_class> term);
53 void add(const mpz_class& coef, const Term& term,
55
56 bool operator==(const BigPolynomial& poly) const;
57
58 void print(FILE* file) const;
59 void print(ostream& out) const;
60
61 private:
62 struct BigCoefTerm {
64 vector<mpz_class> term;
65
66 bool operator==(const BigCoefTerm& coefTerm) const;
67 };
68 typedef vector<BigCoefTerm>::iterator iterator;
69 typedef vector<BigCoefTerm>::const_iterator const_iterator;
70
72 (const BigCoefTerm& a, const BigCoefTerm& b);
73
76};
77
79
80#endif
ostream & operator<<(ostream &out, const BigPolynomial &ideal)
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
mpz_class & getLastCoef()
const vector< mpz_class > & getTerm(size_t index) const
size_t getTermCount() const
vector< BigCoefTerm >::const_iterator const_iterator
vector< BigCoefTerm > _coefTerms
void add(const mpz_class &coef, const vector< mpz_class > term)
VarNames _names
size_t getVarCount() const
void clearAndSetNames(const VarNames &names)
const mpz_class & getCoef(size_t index) const
void renameVars(const VarNames &names)
vector< BigCoefTerm >::iterator iterator
void print(FILE *file) const
vector< mpz_class > & getLastTerm()
const VarNames & getNames() const
bool operator==(const BigPolynomial &poly) const
void sortTermsReverseLex()
static bool compareCoefTermsReverseLex(const BigCoefTerm &a, const BigCoefTerm &b)
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
Defines the variables of a polynomial ring and facilities IO involving them.
Definition VarNames.h:40
vector< mpz_class > term
bool operator==(const BigCoefTerm &coefTerm) const