-
Notifications
You must be signed in to change notification settings - Fork 0
/
monomial_ideal.cpp
74 lines (67 loc) · 2.52 KB
/
monomial_ideal.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef __MONOMIAL_IDEAL_CPP_
#define __MONOMIAL_IDEAL_CPP_
/*****************************************************************************\
* This file is part of DynGB. *
* *
* DynGB is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* DynGB is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with DynGB. If not, see <http://www.gnu.org/licenses/>. *
\*****************************************************************************/
#include "monomial_ideal.hpp"
ostream & operator << (ostream & os, const Monomial_Ideal & I) {
os << "[ ";
/*for (
list<Monomial>::const_iterator ti = I.gens.begin();
ti != I.gens.end();
++ti
) {
os << *ti << ',';
} */
os << " ] (";
/*if (I.hNum == nullptr) os << I.hNum << ", ";
else os << *(I.hNum) << ", ";
if (I.hRedNum == nullptr) os << I.hRedNum << ", ";
else os << *(I.hRedNum) << ", ";
if (I.hPol == nullptr) os << I.hPol << ")";
else os << *(I.hPol) << ")";*/
return os;
}
bool first_smaller(const Monomial & t, const Monomial & u) {
return t < u;
}
bool standard_degree(const Monomial & t, const Monomial & u) {
return t.total_degree() < u.total_degree();
}
list<Monomial> colon_ideal_without_ideals(
const list<Monomial> & U, const Monomial & t
) {
list<Monomial> V;
for (const Monomial & u : U) {
Monomial tnew = u.colon(t);
V.push_back(tnew);
}
V.sort(standard_degree);
for (auto vi = V.begin(); vi != V.end(); ++vi) {
auto ui { vi };
for (++ui; ui != V.end(); /* */) {
if (ui->divisible_by(*vi)) {
auto wi { ui };
++wi;
V.erase(ui);
ui = wi;
} else
++ui;
}
}
return V;
}
#endif