Frobby  0.9.5
IdealFactory.cpp
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2009 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 #include "stdinc.h"
18 #include "IdealFactory.h"
19 
20 #include <algorithm>
21 
23  VarNames names;
24  names.addVar("x");
25  names.addVar("y");
26  names.addVar("z");
27  names.addVar("t");
28  return names;
29 }
30 
32  BigIdeal ideal(ring_xyzt());
33  ideal.insert(makeTerm(2, 0, 0, 0));
34  ideal.insert(makeTerm(0, 2, 0, 0));
35  ideal.insert(makeTerm(1, 0, 1, 0));
36  ideal.insert(makeTerm(0, 1, 1, 0));
37  ideal.sortGenerators();
38  return ideal;
39 }
40 
42  BigIdeal ideal(ring_xyzt());
43  ideal.insert(makeTerm(1, 0, 0, 0));
44  ideal.insert(makeTerm(0, 1, 0, 0));
45  ideal.sortGenerators();
46  return ideal;
47 }
48 
50  BigIdeal ideal(ring_xyzt());
51  ideal.insert(makeTerm(1, 0, 0, 0));
52  ideal.insert(makeTerm(0, 1, 0, 0));
53  ideal.insert(makeTerm(0, 0, 1, 0));
54  ideal.sortGenerators();
55  return ideal;
56 }
57 
59  BigIdeal ideal(ring_xyzt());
60  ideal.insert(makeTerm(1, 1, 3, 0));
61  ideal.insert(makeTerm(2, 2, 0, 0));
62  ideal.sortGenerators();
63  return ideal;
64 }
65 
67  BigIdeal ideal(ring_xyzt());
68  ideal.insert(makeTerm(1, 1, 1, 0));
69  ideal.insert(makeTerm(2, 2, 0, 0));
70  ideal.sortGenerators();
71  return ideal;
72 }
73 
75  BigIdeal ideal(ring_xyzt());
76  ideal.insert(makeTerm(2, 0, 0, 0));
77  ideal.insert(makeTerm(0, 2, 0, 0));
78  ideal.insert(makeTerm(0, 0, 1, 0));
79  ideal.sortGenerators();
80  return ideal;
81 }
82 
84  BigIdeal ideal(ring_xyzt());
85  ideal.insert(makeTerm(1, 1, 0, 0));
86  ideal.insert(makeTerm(2, 2, 1, 0));
87  ideal.sortGenerators();
88  return ideal;
89 }
90 
92  BigIdeal ideal(ring_xyzt());
93  ideal.insert(makeTerm(2, 0, 0, 0));
94  ideal.insert(makeTerm(0, 2, 0, 0));
95  ideal.insert(makeTerm(0, 0, 2, 0));
96  ideal.insert(makeTerm(0, 0, 0, 1));
97  ideal.insert(makeTerm(1, 0, 1, 0));
98  ideal.insert(makeTerm(0, 1, 1, 0));
99  ideal.sortGenerators();
100  return ideal;
101 }
102 
104  BigIdeal ideal(ring_xyzt());
105  ideal.insert(makeTerm(1, 1, 0, 0));
106  ideal.insert(makeTerm(0, 0, 1, 0));
107  ideal.sortGenerators();
108  return ideal;
109 }
110 
112  BigIdeal ideal(ring_xyzt());
113  ideal.insert(makeTerm(1, 1, 0, 0));
114  ideal.insert(makeTerm(1, 0, 1, 0));
115  ideal.sortGenerators();
116  return ideal;
117 }
118 
120  BigIdeal ideal(ring_xyzt());
121  ideal.insert(makeTerm(1, 1, 0, 0));
122  ideal.sortGenerators();
123  return ideal;
124 }
125 
127  BigIdeal ideal(ring_xyzt());
128  ideal.insert(makeTerm(0, 0, 1, 0));
129  ideal.sortGenerators();
130  return ideal;
131 }
132 
134  vector<BigIdeal> ideals;
135  ideals.push_back(x_y());
136  ideals.push_back(xx_yy_z());
137  sort(ideals.begin(), ideals.end());
138  return ideals;
139 }
140 
142  vector<BigIdeal> ideals;
143  ideals.push_back(x_y());
144  ideals.push_back(x_y_z());
145  sort(ideals.begin(), ideals.end());
146  return ideals;
147 }
148 
150  BigIdeal ideal((VarNames(varCount)));
151  ideal.insert(vector<mpz_class>(varCount));
152  return ideal;
153 }
154 
156  return BigIdeal(VarNames(varCount));
157 }
158 
159 vector<mpz_class> IdealFactory::makeTerm(int a, int b, int c, int d) {
160  vector<mpz_class> t(4);
161  t[0] = a;
162  t[1] = b;
163  t[2] = c;
164  t[3] = d;
165  return t;
166 }
167 
168 vector<mpz_class> IdealFactory::makeTerm(int a) {
169  vector<mpz_class> t(1);
170  t[0] = a;
171  return t;
172 }
void sortGenerators()
Definition: BigIdeal.cpp:280
void insert(const Ideal &ideal)
Definition: BigIdeal.cpp:60
static BigIdeal xy_xxyyz()
Returns .
static BigIdeal xyz_xxyy()
Returns .
static BigIdeal xyzzz_xxyy()
Returns .
static BigIdeal xy_xz()
Returns .
static BigIdeal z()
Returns .
static BigIdeal xx_yy_xz_yz()
Returns .
static VarNames ring_xyzt()
Returns the ring in the four variables , , and .
static vector< BigIdeal > assoprimes_xx_yy_xz_yz()
Returns the associated primes of .
static vector< BigIdeal > irrdecom_xx_yy_xz_yz()
Returns the irreducible decomposition of .
static BigIdeal xy()
Returns .
static BigIdeal xy_z()
Returns .
static BigIdeal xx_yy_z()
Returns .
static BigIdeal xx_yy_zz_t_xz_yz()
Returns .
static BigIdeal x_y_z()
Returns .
static BigIdeal x_y()
Returns .
static BigIdeal zeroIdeal(size_t varCount)
Returns the ideal in the ring VarNames(varCount).
static BigIdeal wholeRing(size_t varCount)
Returns in the ring VarNames(varCount).
static vector< mpz_class > makeTerm(int a, int b, int c, int d)
Returns a vector representing .
Defines the variables of a polynomial ring and facilities IO involving them.
Definition: VarNames.h:40
bool addVar(const string &name)
Adds the variable and returns true if name is not already a variable.
Definition: VarNames.cpp:44