Frobby
0.10.0
Toggle main menu visibility
Loading...
Searching...
No Matches
src
UniHashPolynomial.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 UNI_HASH_POLYNOMIAL_GUARD
19
#define UNI_HASH_POLYNOMIAL_GUARD
20
21
#include <unordered_map>
22
23
class
CoefBigTermConsumer
;
24
27
class
MpzHash
{
28
public
:
29
size_t
operator()(
const
mpz_class& i)
const
{
30
// The constant is a prime. This method needs to be improved.
31
return
mpz_fdiv_ui(i.get_mpz_t(), 2106945901u);
32
}
33
};
34
39
class
UniHashPolynomial
{
40
public
:
43
void
add
(
bool
plus,
const
mpz_class& exponent);
44
46
void
add
(
int
coef,
size_t
exponent);
47
49
void
add
(
const
mpz_class& coef,
const
mpz_class& exponent);
50
51
void
feedTo(
CoefBigTermConsumer
& consumer,
bool
inCanonicalOrder =
false
)
const
;
52
53
size_t
getTermCount()
const
;
54
55
private
:
56
typedef
unordered_map<mpz_class, mpz_class, MpzHash> TermMap;
57
TermMap _terms;
58
};
59
60
#endif
CoefBigTermConsumer
Definition
CoefBigTermConsumer.h:29
MpzHash
Definition
UniHashPolynomial.h:27
UniHashPolynomial
Definition
UniHashPolynomial.h:39
UniHashPolynomial::add
void add(bool plus, const mpz_class &exponent)
Definition
UniHashPolynomial.cpp:25
Generated by
1.17.0