Frobby  0.9.5
HashPolynomial.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2009 University of Aarhus
3  Contact Bjarke Hammersholt Roune for license information (www.broune.com)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see http://www.gnu.org/licenses/.
17 */
18 #ifndef HASH_POLYNOMIAL_GUARD
19 #define HASH_POLYNOMIAL_GUARD
20 
21 #include "Term.h"
22 #include "HashMap.h"
23 
25 class TermTranslator;
26 
30 template<>
31 class FrobbyHash<Term> {
32  public:
33  size_t operator()(const Term& t) const {
34  return t.getHashCode();
35  }
36 };
37 
43  public:
44  HashPolynomial(size_t varCount = 0);
45 
46  void clearAndSetVarCount(size_t varCount);
47 
49  void add(const mpz_class& coef, const Term& term);
50 
53  void add(bool plus, const Term& term);
54 
55  void feedTo(const TermTranslator& translator,
56  CoefBigTermConsumer& consumer,
57  bool inCanonicalOrder) const;
58 
59  size_t getTermCount() const;
60 
61  private:
62  size_t _varCount;
63 
66 };
67 
68 #endif
The purpose of this file is to provide a definition of a hash map whenever possible.
size_t operator()(const Term &t) const
A sparse multivariate polynomial represented by a hash table mapping terms to coefficients.
void add(const mpz_class &coef, const Term &term)
Add coef*term to the polynomial.
size_t getTermCount() const
void clearAndSetVarCount(size_t varCount)
HashMap< Term, mpz_class > TermMap
void feedTo(const TermTranslator &translator, CoefBigTermConsumer &consumer, bool inCanonicalOrder) const
HashPolynomial(size_t varCount=0)
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
static size_t getHashCode(const Exponent *a, size_t varCount)
Definition: Term.h:424