Gröbner basis project
Codebase for research into Gröbner basis computation
test_incremental_betti.cpp
1 #include "betti.hpp"
2 #include "monomial.hpp"
3 
4 /*****************************************************************************\
5 * This file is part of DynGB. *
6 * *
7 * DynGB is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * Foobar is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with DynGB. If not, see <http://www.gnu.org/licenses/>. *
19 \*****************************************************************************/
20 
21 int main() {
22  Monomial w { 1, 0, 0, 0 };
23 
24  Monomial x2 { 0, 2, 0, 0 };
25 
26  Monomial x1x22 { 0, 1, 2, 0 };
27  Monomial x1x32 { 0, 1, 0, 2 };
28  Monomial x33 { 0, 0, 0, 3 };
29 
30  Monomial x1x22x3 { 0, 1, 2, 1 };
31 
32  Monomial x1x24 { 0, 1, 4, 0 };
33  Monomial x22x33 { 0, 0, 2, 3 };
34  Monomial x1 { 0, 1, 0, 0 };
35 
36  Monomial x24x32 { 0, 0, 4, 2 };
37 
38  WT_TYPE wts[4] = { 6, 4, 3, 2 };
39  list<Monomial> T { w, x2 };
40  for (auto p : incremental_betti(T, x1x32))
41  cout << p.first << ',' << p.second << "; ";
42  cout << endl;
43  cout << endl;
44 
45  for (auto p : incremental_betti(T, x1x22, wts))
46  cout << p.first << ',' << p.second << "; ";
47  cout << endl;
48  for (auto p : incremental_betti(T, x1x32, wts))
49  cout << p.first << ',' << p.second << "; ";
50  cout << endl;
51  for (auto p : incremental_betti(T, x33, wts))
52  cout << p.first << ',' << p.second << "; ";
53  cout << endl;
54  cout << endl;
55 
56  WT_TYPE wts2[4] = { 4, 3, 1, 2 };
57  list<Monomial> U { w, x2, x1x32, x1x22x3 };
58  for (auto p : incremental_betti(U, x1x24))
59  cout << p.first << ',' << p.second << "; ";
60  cout << endl;
61  for (auto p : incremental_betti(U, x22x33))
62  cout << p.first << ',' << p.second << "; ";
63  cout << endl;
64  for (auto p : incremental_betti(U, x1))
65  cout << p.first << ',' << p.second << "; ";
66  cout << endl;
67  for (auto p : incremental_betti(U, x1x24, wts2))
68  cout << p.first << ',' << p.second << "; ";
69  cout << endl;
70  for (auto p : incremental_betti(U, x22x33, wts2))
71  cout << p.first << ',' << p.second << "; ";
72  cout << endl;
73  for (auto p : incremental_betti(U, x1, wts2))
74  cout << p.first << ',' << p.second << "; ";
75  cout << endl;
76  cout << endl;
77 
78  list<Monomial> V { w, x2, x1x32, x1x22x3, x22x33, x1x24 };
79  for (auto p : incremental_betti(V, x24x32))
80  cout << p.first << ',' << p.second << "; ";
81  cout << endl;
82 }
map< DEG_TYPE, unsigned long > incremental_betti(const list< Monomial > &T, const WT_TYPE *grading)
Incremental Betti numbers for monomial ideals.
Definition: betti.cpp:30
Implementation of monomials.
Definition: monomial.hpp:69