IdealFactory.cpp
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2009 Bjarke Hammersholt Roune (www.broune.com)
This program 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.
This program 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 this program. If not, see http://www.gnu.org/licenses/.
*/
#include "stdinc.h"
#include "IdealFactory.h"
#include <algorithm>
VarNames IdealFactory::ring_xyzt() {
VarNames names;
names.addVar("x");
names.addVar("y");
names.addVar("z");
names.addVar("t");
return names;
}
BigIdeal IdealFactory::xx_yy_xz_yz() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(2, 0, 0, 0));
ideal.insert(makeTerm(0, 2, 0, 0));
ideal.insert(makeTerm(1, 0, 1, 0));
ideal.insert(makeTerm(0, 1, 1, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::x_y() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(1, 0, 0, 0));
ideal.insert(makeTerm(0, 1, 0, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::x_y_z() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(1, 0, 0, 0));
ideal.insert(makeTerm(0, 1, 0, 0));
ideal.insert(makeTerm(0, 0, 1, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::xyzzz_xxyy() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(1, 1, 3, 0));
ideal.insert(makeTerm(2, 2, 0, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::xyz_xxyy() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(1, 1, 1, 0));
ideal.insert(makeTerm(2, 2, 0, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::xx_yy_z() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(2, 0, 0, 0));
ideal.insert(makeTerm(0, 2, 0, 0));
ideal.insert(makeTerm(0, 0, 1, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::xy_xxyyz() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(1, 1, 0, 0));
ideal.insert(makeTerm(2, 2, 1, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::xx_yy_zz_t_xz_yz() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(2, 0, 0, 0));
ideal.insert(makeTerm(0, 2, 0, 0));
ideal.insert(makeTerm(0, 0, 2, 0));
ideal.insert(makeTerm(0, 0, 0, 1));
ideal.insert(makeTerm(1, 0, 1, 0));
ideal.insert(makeTerm(0, 1, 1, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::xy_z() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(1, 1, 0, 0));
ideal.insert(makeTerm(0, 0, 1, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::xy_xz() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(1, 1, 0, 0));
ideal.insert(makeTerm(1, 0, 1, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::xy() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(1, 1, 0, 0));
ideal.sortGenerators();
return ideal;
}
BigIdeal IdealFactory::z() {
BigIdeal ideal(ring_xyzt());
ideal.insert(makeTerm(0, 0, 1, 0));
ideal.sortGenerators();
return ideal;
}
vector<BigIdeal> IdealFactory::irrdecom_xx_yy_xz_yz() {
vector<BigIdeal> ideals;
ideals.push_back(x_y());
ideals.push_back(xx_yy_z());
sort(ideals.begin(), ideals.end());
return ideals;
}
vector<BigIdeal> IdealFactory::assoprimes_xx_yy_xz_yz() {
vector<BigIdeal> ideals;
ideals.push_back(x_y());
ideals.push_back(x_y_z());
sort(ideals.begin(), ideals.end());
return ideals;
}
BigIdeal IdealFactory::wholeRing(size_t varCount) {
BigIdeal ideal((VarNames(varCount)));
ideal.insert(vector<mpz_class>(varCount));
return ideal;
}
BigIdeal IdealFactory::zeroIdeal(size_t varCount) {
return BigIdeal(VarNames(varCount));
}
vector<mpz_class> IdealFactory::makeTerm(int a, int b, int c, int d) {
vector<mpz_class> t(4);
t[0] = a;
t[1] = b;
t[2] = c;
t[3] = d;
return t;
}
vector<mpz_class> IdealFactory::makeTerm(int a) {
vector<mpz_class> t(1);
t[0] = a;
return t;
}
IdealFactory.h
BigIdeal
Definition BigIdeal.h:27
BigIdeal::sortGenerators
void sortGenerators()
Definition BigIdeal.cpp:280
BigIdeal::insert
void insert(const Ideal &ideal)
Definition BigIdeal.cpp:60
IdealFactory::xy_xxyyz
static BigIdeal xy_xxyyz()
Returns .
Definition IdealFactory.cpp:83
IdealFactory::xyz_xxyy
static BigIdeal xyz_xxyy()
Returns .
Definition IdealFactory.cpp:66
IdealFactory::xyzzz_xxyy
static BigIdeal xyzzz_xxyy()
Returns .
Definition IdealFactory.cpp:58
IdealFactory::xy_xz
static BigIdeal xy_xz()
Returns .
Definition IdealFactory.cpp:111
IdealFactory::z
static BigIdeal z()
Returns .
Definition IdealFactory.cpp:126
IdealFactory::xx_yy_xz_yz
static BigIdeal xx_yy_xz_yz()
Returns .
Definition IdealFactory.cpp:31
IdealFactory::ring_xyzt
static VarNames ring_xyzt()
Returns the ring in the four variables , , and .
Definition IdealFactory.cpp:22
IdealFactory::assoprimes_xx_yy_xz_yz
static vector< BigIdeal > assoprimes_xx_yy_xz_yz()
Returns the associated primes of .
Definition IdealFactory.cpp:141
IdealFactory::irrdecom_xx_yy_xz_yz
static vector< BigIdeal > irrdecom_xx_yy_xz_yz()
Returns the irreducible decomposition of .
Definition IdealFactory.cpp:133
IdealFactory::xy
static BigIdeal xy()
Returns .
Definition IdealFactory.cpp:119
IdealFactory::xy_z
static BigIdeal xy_z()
Returns .
Definition IdealFactory.cpp:103
IdealFactory::xx_yy_z
static BigIdeal xx_yy_z()
Returns .
Definition IdealFactory.cpp:74
IdealFactory::xx_yy_zz_t_xz_yz
static BigIdeal xx_yy_zz_t_xz_yz()
Returns .
Definition IdealFactory.cpp:91
IdealFactory::x_y_z
static BigIdeal x_y_z()
Returns .
Definition IdealFactory.cpp:49
IdealFactory::x_y
static BigIdeal x_y()
Returns .
Definition IdealFactory.cpp:41
IdealFactory::zeroIdeal
static BigIdeal zeroIdeal(size_t varCount)
Returns the ideal in the ring VarNames(varCount).
Definition IdealFactory.cpp:155
IdealFactory::wholeRing
static BigIdeal wholeRing(size_t varCount)
Returns in the ring VarNames(varCount).
Definition IdealFactory.cpp:149
IdealFactory::makeTerm
static vector< mpz_class > makeTerm(int a, int b, int c, int d)
Returns a vector representing .
Definition IdealFactory.cpp:159
VarNames
Defines the variables of a polynomial ring and facilities IO involving them.
Definition VarNames.h:40
VarNames::addVar
bool addVar(const string &name)
Adds the variable and returns true if name is not already a variable.
Definition VarNames.cpp:44
stdinc.h
This header file includes common definitions and is included as the first line of code in every imple...