Frobby
0.9.0
src
UniHashPolynomial.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 UNI_HASH_POLYNOMIAL_GUARD
19
#define UNI_HASH_POLYNOMIAL_GUARD
20
21
#include "
HashMap.h
"
22
23
class
CoefBigTermConsumer
;
24
28
template
<>
29
class
FrobbyHash
<mpz_class> {
30
public
:
31
size_t
operator()
(
const
mpz_class& i)
const
{
32
// The constant is a prime. This method needs to be improved.
33
return
mpz_fdiv_ui(i.get_mpz_t(), 2106945901u);
34
}
35
};
36
41
class
UniHashPolynomial
{
42
public
:
45
void
add
(
bool
plus,
const
mpz_class& exponent);
46
48
void
add
(
int
coef,
size_t
exponent);
49
51
void
add
(
const
mpz_class& coef,
const
mpz_class& exponent);
52
53
void
feedTo
(
CoefBigTermConsumer
& consumer,
bool
inCanonicalOrder =
false
)
const
;
54
55
size_t
getTermCount
()
const
;
56
57
private
:
58
typedef
HashMap<mpz_class, mpz_class>
TermMap
;
59
TermMap
_terms
;
60
};
61
62
#endif
HashMap< mpz_class, mpz_class >
CoefBigTermConsumer
Definition:
CoefBigTermConsumer.h:29
UniHashPolynomial::getTermCount
size_t getTermCount() const
Definition:
UniHashPolynomial.cpp:110
UniHashPolynomial::TermMap
HashMap< mpz_class, mpz_class > TermMap
Definition:
UniHashPolynomial.h:58
UniHashPolynomial
A sparse univariate polynomial represented by a hash table mapping terms to coefficients.
Definition:
UniHashPolynomial.h:41
FrobbyHash
Definition:
HashMap.h:35
HashMap.h
UniHashPolynomial::feedTo
void feedTo(CoefBigTermConsumer &consumer, bool inCanonicalOrder=false) const
Definition:
UniHashPolynomial.cpp:64
FrobbyHash< mpz_class >::operator()
size_t operator()(const mpz_class &i) const
Definition:
UniHashPolynomial.h:31
UniHashPolynomial::add
void add(bool plus, const mpz_class &exponent)
Add +t^exponent or -t^exponent to the polynomial depending on whether plus is true or false,...
Definition:
UniHashPolynomial.cpp:25
UniHashPolynomial::_terms
TermMap _terms
Definition:
UniHashPolynomial.h:59
Generated by
1.8.17