Frobby
0.10.0
Toggle main menu visibility
Loading...
Searching...
No Matches
src
HashPolynomial.h
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 <unordered_map>
23
24
class
CoefBigTermConsumer
;
25
class
TermTranslator
;
26
28
class
TermHash
{
29
public
:
30
size_t
operator()(
const
Term
& t)
const
{
31
return
t.getHashCode();
32
}
33
};
34
39
class
HashPolynomial {
40
public
:
41
HashPolynomial(
size_t
varCount = 0);
42
43
void
clearAndSetVarCount(
size_t
varCount);
44
46
void
add
(
const
mpz_class& coef,
const
Term
& term);
47
50
void
add
(
bool
plus,
const
Term
& term);
51
52
void
feedTo(
const
TermTranslator
& translator,
53
CoefBigTermConsumer
& consumer,
54
bool
inCanonicalOrder)
const
;
55
56
size_t
getTermCount()
const
;
57
58
private
:
59
size_t
_varCount;
60
61
typedef
unordered_map<Term, mpz_class, TermHash> TermMap;
62
TermMap _terms;
63
};
64
65
#endif
CoefBigTermConsumer
Definition
CoefBigTermConsumer.h:29
HashPolynomial::add
void add(const mpz_class &coef, const Term &term)
Definition
HashPolynomial.cpp:36
TermHash
Definition
HashPolynomial.h:28
TermTranslator
Definition
TermTranslator.h:41
Term
Definition
Term.h:49
Generated by
1.17.0