Frobby
0.10.0
Toggle main menu visibility
Loading...
Searching...
No Matches
src
BigIdeal.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 BIG_IDEAL_GUARD
18
#define BIG_IDEAL_GUARD
19
20
#include "VarNames.h"
21
#include <vector>
22
23
class
TermTranslator
;
24
class
Ideal
;
25
class
SquareFreeIdeal
;
26
27
class
BigIdeal {
28
public
:
29
BigIdeal();
30
BigIdeal(
const
VarNames
& names);
31
32
void
insert(
const
Ideal
& ideal);
33
void
insert(
const
Ideal
& ideal,
const
TermTranslator
& translator);
34
void
insert(
const
SquareFreeIdeal
& ideal);
35
void
insert(
const
vector<mpz_class>& term);
36
37
void
renameVars(
const
VarNames
& names);
38
39
void
newLastTerm();
40
void
reserve(
size_t
capacity);
41
42
mpz_class& getLastTermExponentRef(
size_t
var);
43
vector<mpz_class>& getLastTermRef();
44
const
vector<mpz_class>& getTerm(
size_t
term)
const
;
45
46
void
getLcm(vector<mpz_class>& lcm)
const
;
47
48
const
mpz_class& getExponent(
size_t
term,
size_t
var)
const
;
49
mpz_class& getExponent(
size_t
term,
size_t
var);
50
void
setExponent(
size_t
term,
size_t
var,
const
mpz_class& exp);
51
52
bool
operator==(
const
BigIdeal& b)
const
;
53
54
vector<mpz_class>& operator[](
size_t
index);
55
const
vector<mpz_class>& operator[](
size_t
index)
const
;
56
57
void
projectVar(
size_t
var);
58
59
// This also depends on the order of the variables.
60
bool
operator<(
const
BigIdeal& ideal)
const
;
61
62
bool
empty()
const
;
63
bool
containsIdentity()
const
;
64
bool
contains(
const
vector<mpz_class>& term)
const
;
65
66
void
clear();
67
68
inline
size_t
getGeneratorCount()
const
;
69
size_t
getVarCount()
const
;
70
71
void
clearAndSetNames(
const
VarNames
& names);
72
73
// Adds a variable to the VarNames associated to the ideal. It is an
74
// error to call this method when the ideal has any generators. If
75
// var is already a known variable, nothing is changed, and the
76
// return value is false. Otherwise, the return value is true.
77
bool
addVarToClearedIdeal(
const
char
* var);
78
79
// Remove variable from each generator and from the ring.
80
void
eraseVar(
size_t
var);
81
82
const
VarNames
& getNames()
const
;
83
84
// Applies a generic deformation.
85
void
deform();
86
87
// Takes the radical of every generator.
88
void
takeRadical();
89
90
// Sorts the generators and removes duplicates.
91
void
sortGeneratorsUnique();
92
93
// Sorts the generators.
94
void
sortGenerators();
95
96
// Sorts the variables.
97
void
sortVariables();
98
99
void
swap(BigIdeal& ideal);
100
101
void
print(FILE* file)
const
;
102
void
print(ostream& out)
const
;
103
104
static
bool
bigTermCompare(
const
vector<mpz_class>& a,
105
const
vector<mpz_class>& b);
106
private
:
107
vector<vector<mpz_class> > _terms;
108
VarNames
_names;
109
};
110
111
ostream& operator<<(ostream& out,
const
BigIdeal
& ideal);
112
ostream& operator<<(ostream& out,
const
vector<BigIdeal>& ideals);
113
114
115
116
inline
vector<mpz_class>& BigIdeal::operator[](
size_t
index) {
117
ASSERT(index < _terms.size());
118
return
_terms[index];
119
}
120
121
inline
const
vector<mpz_class>& BigIdeal::operator[](
size_t
index)
const
{
122
ASSERT(index < _terms.size());
123
return
_terms[index];
124
}
125
126
inline
mpz_class& BigIdeal::getLastTermExponentRef(
size_t
var) {
127
ASSERT(!empty());
128
ASSERT(var < _names.getVarCount());
129
130
return
_terms.back()[var];
131
}
132
133
inline
vector<mpz_class>& BigIdeal::getLastTermRef() {
134
ASSERT(!empty());
135
136
return
_terms.back();
137
}
138
139
inline
const
vector<mpz_class>& BigIdeal::getTerm(
size_t
term)
const
{
140
ASSERT(term < getGeneratorCount());
141
return
_terms[term];
142
}
143
144
inline
size_t
BigIdeal::getGeneratorCount()
const
{
145
return
_terms.size();
146
}
147
148
inline
size_t
BigIdeal::getVarCount()
const
{
149
return
_names.getVarCount();
150
}
151
152
#endif
BigIdeal
Definition
BigIdeal.h:27
Ideal
Represents a monomial ideal with int exponents.
Definition
Ideal.h:27
SquareFreeIdeal
Definition
SquareFreeIdeal.h:24
TermTranslator
Definition
TermTranslator.h:41
VarNames
Definition
VarNames.h:38
Generated by
1.17.0