HashPolynomial.h
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2009 University of Aarhus
Contact Bjarke Hammersholt Roune for license information (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 HASH_POLYNOMIAL_GUARD
#define HASH_POLYNOMIAL_GUARD
#include "Term.h"
#include "HashMap.h"
class CoefBigTermConsumer;
class TermTranslator;
template<>
class FrobbyHash<Term> {
public:
size_t operator()(const Term& t) const {
return t.getHashCode();
}
};
class HashPolynomial {
public:
HashPolynomial(size_t varCount = 0);
void clearAndSetVarCount(size_t varCount);
void add(const mpz_class& coef, const Term& term);
void add(bool plus, const Term& term);
void feedTo(const TermTranslator& translator,
CoefBigTermConsumer& consumer,
bool inCanonicalOrder) const;
size_t getTermCount() const;
private:
size_t _varCount;
typedef HashMap<Term, mpz_class> TermMap;
TermMap _terms;
};
#endif
HashMap.h
The purpose of this file is to provide a definition of a hash map whenever possible.
Term.h
CoefBigTermConsumer
Definition CoefBigTermConsumer.h:29
FrobbyHash< Term >::operator()
size_t operator()(const Term &t) const
Definition HashPolynomial.h:33
FrobbyHash
Definition HashMap.h:35
HashMap
Definition HashMap.h:93
HashPolynomial::add
void add(const mpz_class &coef, const Term &term)
Add coef*term to the polynomial.
Definition HashPolynomial.cpp:36
HashPolynomial::getTermCount
size_t getTermCount() const
Definition HashPolynomial.cpp:117
HashPolynomial::_varCount
size_t _varCount
Definition HashPolynomial.h:62
HashPolynomial::clearAndSetVarCount
void clearAndSetVarCount(size_t varCount)
Definition HashPolynomial.cpp:31
HashPolynomial::TermMap
HashMap< Term, mpz_class > TermMap
Definition HashPolynomial.h:64
HashPolynomial::_terms
TermMap _terms
Definition HashPolynomial.h:65
HashPolynomial::feedTo
void feedTo(const TermTranslator &translator, CoefBigTermConsumer &consumer, bool inCanonicalOrder) const
Definition HashPolynomial.cpp:77
HashPolynomial::HashPolynomial
HashPolynomial(size_t varCount=0)
Definition HashPolynomial.cpp:27
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
Term::getHashCode
static size_t getHashCode(const Exponent *a, size_t varCount)
Definition Term.h:424