Frobby
0.10.0
Toggle main menu visibility
Loading...
Searching...
No Matches
src
IdealComparator.h
1
/* Frobby: Software for monomial ideal computations.
2
Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see http://www.gnu.org/licenses/.
16
*/
17
#ifndef IDEAL_COMPARATOR_GUARD
18
#define IDEAL_COMPARATOR_GUARD
19
20
class
Ideal
;
21
class
BigIdeal
;
22
class
TermTranslator
;
23
24
// These three classes are in the same file because they use
25
// templates in a way so that they all have the same implementation.
26
// They all define the same order given the natural bijection between
27
// the three different objects, and it is true of all of them that the
28
// order of the generators matter, and that non-minimal generators
29
// also matter. So to get an actual canonical order on the ideals as
30
// mathematical objects, each ideal must be in a canonical form already.
31
32
// Defines a total order on Ideal. The ideals compared must have the same
33
// number of variables, though the number can vary between individual
34
// calls to operator().
35
class
IdealComparator
{
36
public
:
37
bool
operator()(
const
Ideal
& a,
const
Ideal
& b)
const
;
38
bool
operator()(
const
Ideal
* a,
const
Ideal
* b)
const
;
39
};
40
41
// Defines a total order on Ideal based on the translated values. Each
42
// ideal must have the same number of variables as the translator.
43
class
TranslatedIdealComparator {
44
public
:
45
TranslatedIdealComparator(
TermTranslator
& translator);
46
bool
operator()(
const
Ideal
& a,
const
Ideal
& b)
const
;
47
bool
operator()(
const
Ideal
* a,
const
Ideal
* b)
const
;
48
private
:
49
TermTranslator
& _translator;
50
};
51
52
// Defines a total order on BigIdeal.
53
class
BigIdealComparator
{
54
public
:
55
bool
operator()(
const
BigIdeal
& a,
const
BigIdeal
& b)
const
;
56
bool
operator()(
const
BigIdeal
* a,
const
BigIdeal
* b)
const
;
57
};
58
59
namespace
IdealComparatorHelpers {
60
bool
idealLessThan(
const
BigIdeal
& a,
const
BigIdeal
& b);
61
bool
idealLessThan(
const
Ideal
& a,
const
Ideal
& b);
62
bool
idealLessThan(
const
Ideal
& a,
const
Ideal
& b,
63
TermTranslator
& translator);
64
}
65
66
inline
bool
IdealComparator::operator()(
const
Ideal
& a,
const
Ideal
& b)
const
{
67
return
IdealComparatorHelpers::idealLessThan(a, b);
68
}
69
70
inline
bool
IdealComparator::operator()(
const
Ideal
* a,
const
Ideal
* b)
const
{
71
return
IdealComparatorHelpers::idealLessThan(*a, *b);
72
}
73
74
inline
bool
TranslatedIdealComparator::operator()(
const
Ideal
& a,
75
const
Ideal
& b)
const
{
76
return
IdealComparatorHelpers::idealLessThan(a, b, _translator);
77
}
78
79
inline
bool
TranslatedIdealComparator::operator()(
const
Ideal
* a,
80
const
Ideal
* b)
const
{
81
return
IdealComparatorHelpers::idealLessThan(*a, *b, _translator);
82
}
83
84
inline
bool
BigIdealComparator::operator()(
const
BigIdeal
& a,
85
const
BigIdeal
& b)
const
{
86
return
IdealComparatorHelpers::idealLessThan(a, b);
87
}
88
89
inline
bool
BigIdealComparator::operator()(
const
BigIdeal
* a,
const
90
BigIdeal
* b)
const
{
91
return
IdealComparatorHelpers::idealLessThan(*a, *b);
92
}
93
94
#endif
BigIdealComparator
Definition
IdealComparator.h:53
BigIdeal
Definition
BigIdeal.h:27
IdealComparator
Definition
IdealComparator.h:35
Ideal
Represents a monomial ideal with int exponents.
Definition
Ideal.h:27
TermTranslator
Definition
TermTranslator.h:41
Generated by
1.17.0