BigPolynomial.h
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#ifndef BIG_POLYNOMIAL_GUARD
#define BIG_POLYNOMIAL_GUARD
class VarNames;
class Term;
class TermTranslator;
#include "VarNames.h"
#include <vector>
class BigPolynomial {
public:
BigPolynomial();
BigPolynomial(const VarNames& names);
size_t getTermCount() const;
size_t getVarCount() const;
const VarNames& getNames() const;
// Removes all terms but does not change getNames().
void clear();
void clearAndSetNames(const VarNames& names);
void sortTermsReverseLex();
void sortVariables();
const mpz_class& getCoef(size_t index) const;
const vector<mpz_class>& getTerm(size_t index) const;
void newLastTerm();
vector<mpz_class>& getLastTerm();
mpz_class& getLastCoef();
void renameVars(const VarNames& names);
void add(const mpz_class& coef, const vector<mpz_class> term);
void add(const mpz_class& coef, const Term& term,
const TermTranslator& translator);
bool operator==(const BigPolynomial& poly) const;
void print(FILE* file) const;
void print(ostream& out) const;
private:
struct BigCoefTerm {
mpz_class coef;
vector<mpz_class> term;
bool operator==(const BigCoefTerm& coefTerm) const;
};
typedef vector<BigCoefTerm>::iterator iterator;
typedef vector<BigCoefTerm>::const_iterator const_iterator;
static bool compareCoefTermsReverseLex
(const BigCoefTerm& a, const BigCoefTerm& b);
VarNames _names;
vector<BigCoefTerm> _coefTerms;
};
ostream& operator<<(ostream& out, const BigPolynomial& ideal);
#endif
operator<<
ostream & operator<<(ostream &out, const BigPolynomial &ideal)
Definition BigPolynomial.cpp:159
VarNames.h
BigPolynomial
Definition BigPolynomial.h:27
BigPolynomial::getLastCoef
mpz_class & getLastCoef()
Definition BigPolynomial.cpp:89
BigPolynomial::getTerm
const vector< mpz_class > & getTerm(size_t index) const
Definition BigPolynomial.cpp:72
BigPolynomial::getTermCount
size_t getTermCount() const
Definition BigPolynomial.cpp:34
BigPolynomial::const_iterator
vector< BigCoefTerm >::const_iterator const_iterator
Definition BigPolynomial.h:69
BigPolynomial::_coefTerms
vector< BigCoefTerm > _coefTerms
Definition BigPolynomial.h:75
BigPolynomial::add
void add(const mpz_class &coef, const vector< mpz_class > term)
Definition BigPolynomial.cpp:100
BigPolynomial::_names
VarNames _names
Definition BigPolynomial.h:74
BigPolynomial::getVarCount
size_t getVarCount() const
Definition BigPolynomial.cpp:38
BigPolynomial::newLastTerm
void newLastTerm()
Definition BigPolynomial.cpp:78
BigPolynomial::sortVariables
void sortVariables()
Definition BigPolynomial.cpp:50
BigPolynomial::BigPolynomial
BigPolynomial()
Definition BigPolynomial.cpp:27
BigPolynomial::clearAndSetNames
void clearAndSetNames(const VarNames &names)
Definition BigPolynomial.cpp:61
BigPolynomial::getCoef
const mpz_class & getCoef(size_t index) const
Definition BigPolynomial.cpp:66
BigPolynomial::renameVars
void renameVars(const VarNames &names)
Definition BigPolynomial.cpp:95
BigPolynomial::iterator
vector< BigCoefTerm >::iterator iterator
Definition BigPolynomial.h:68
BigPolynomial::clear
void clear()
Definition BigPolynomial.cpp:57
BigPolynomial::print
void print(FILE *file) const
Definition BigPolynomial.cpp:132
BigPolynomial::getLastTerm
vector< mpz_class > & getLastTerm()
Definition BigPolynomial.cpp:83
BigPolynomial::getNames
const VarNames & getNames() const
Definition BigPolynomial.cpp:42
BigPolynomial::operator==
bool operator==(const BigPolynomial &poly) const
Definition BigPolynomial.cpp:124
BigPolynomial::sortTermsReverseLex
void sortTermsReverseLex()
Definition BigPolynomial.cpp:46
BigPolynomial::compareCoefTermsReverseLex
static bool compareCoefTermsReverseLex(const BigCoefTerm &a, const BigCoefTerm &b)
Definition BigPolynomial.cpp:151
TermTranslator
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
Definition TermTranslator.h:41
Term
Term represents a product of variables which does not include a coefficient.
Definition Term.h:49
VarNames
Defines the variables of a polynomial ring and facilities IO involving them.
Definition VarNames.h:40
BigPolynomial::BigCoefTerm
Definition BigPolynomial.h:62
BigPolynomial::BigCoefTerm::term
vector< mpz_class > term
Definition BigPolynomial.h:64
BigPolynomial::BigCoefTerm::operator==
bool operator==(const BigCoefTerm &coefTerm) const
Definition BigPolynomial.cpp:128
BigPolynomial::BigCoefTerm::coef
mpz_class coef
Definition BigPolynomial.h:63