38 beginAction(
"Applying generic deformation to ideal.");
60 bigIdeal.
insert(ideal, translator);
70 for (
size_t gen = 0; gen < genCount; ++gen) {
71 for (
size_t var = 0; var < varCount; ++var) {
72 if (bigIdeal[gen][var] == 1)
73 bigIdeal[gen][var] = 0;
74 else if (bigIdeal[gen][var] == 0)
75 bigIdeal[gen][var] = 1;
84 bool squareFreeAndMinimal) {
90 Ideal radical(varCount);
92 for (
size_t term = 0; term < genCount; ++term) {
93 for (
size_t var = 0; var < varCount; ++var) {
94 ASSERT(!squareFreeAndMinimal || bigIdeal[term][var] <= 1);
96 if (bigIdeal[term][var] == 0)
105 if (!squareFreeAndMinimal)
115 return varCount - result;
124 size_t idealCount = ideals.size();
125 for (
size_t i = 0; i < idealCount; ++i) {
128 if (!(ideal.
getNames() == ideals[i]->getNames())) {
131 "Taking products of ideals in rings with different variable lists.\n";
135 errorMsg <<
"One ring has variables\n " << list <<
",\n";
137 ideals[i]->getNames().toString(list);
138 errorMsg <<
"while another has variables\n " << list <<
139 ".\nContact the Frobby developers if you need this functionality.";
144 size_t genCount = ideals[i]->getGeneratorCount();
145 size_t varCount = ideals[i]->getVarCount();
148 for (
size_t t = 0; t < genCount; ++t)
149 for (
size_t var = 0; var < varCount; ++var)
166 bigIdeal.
insert(ideal, translator);
186 for (
size_t i = 0; i < ideals.size(); ++i) {
190 for (
size_t var = 0; var < ideal.
getVarCount(); ++var)
191 if (ideal[gen][var] != 0)
201 for (
size_t i = 0; i < ideals.size(); ++i)
212 vector<mpz_class>
lcm;
215 vector<mpz_class> purePower(bigIdeal.
getVarCount());
216 for (
size_t var = 0; var < bigIdeal.
getVarCount(); ++var) {
217 purePower[var] =
lcm[var] + 1;
219 bigIdeal.
insert(purePower);
230 beginAction(
"Sorting generators and removing duplicates.");
259 fprintf(stdout,
"generators: %lu\n",
261 fprintf(stdout,
"variables: %lu\n",
266 fprintf(stdout,
"minimally generated: %s\n",
269 fprintf(out,
"strongly generic: %s\n",
271 fprintf(out,
"weakly generic: %s\n",
282 vector<mpz_class>
lcm;
void sortGeneratorsUnique()
mpz_class & getLastTermExponentRef(size_t var)
void getLcm(vector< mpz_class > &lcm) const
bool contains(const vector< mpz_class > &term) const
size_t getVarCount() const
void insert(const Ideal &ideal)
const VarNames & getNames() const
size_t getGeneratorCount() const
void projectVar(size_t var)
This is the super class of all facades.
void beginAction(const char *message)
Prints message to standard error if printing is turned on, and records the time when the action start...
void endAction()
Prints to standard error the time since the last call to beginAction.
bool isPrintingActions() const
Returns true if printing actions.
A replacement for stringstream.
A facade for input and output of mathematical objects.
void writeTerm(const vector< mpz_class > &term, const VarNames &names, IOHandler *handler, FILE *out)
An IOHandler implements input and output for some format in such a way that client code does not need...
void sortAllAndMinimize(BigIdeal &bigIdeal)
Remove redundant generators from ideal.
void trimVariables(const vector< BigIdeal * > &ideals, VarNames &names)
Remove those variables that do not appear in any generator.
void addPurePowers(BigIdeal &bigIdeal)
Adds x_i^(l_i+1) to the ideal for each i where that will be a minimal generator, where x^l is the lcm...
void swap01(BigIdeal &ideal)
Change all 0 exponents to 1 and vice versa.
void sortGenerators(BigIdeal &ideal)
Sorts the generators of ideal.
mpz_class computeDimension(const BigIdeal &ideal, bool codimension=false, bool squareFreeAndMinimal=false)
Compute the Krull dimension of ideal.
void deform(BigIdeal &ideal)
Applies some generic deformation to the ideal.
void takeRadical(BigIdeal &ideal)
Takes the radical of the generators of ideal.
void printAnalysis(FILE *out, BigIdeal &ideal)
IdealFacade(bool printActions)
void sortVariables(BigIdeal &ideal)
Sorts the variables of ideal.
void projectVar(BigIdeal &bigIdeal, size_t var)
Remove the variable var from the ideal and ring by substituting it by 1.
void sortGeneratorsUnique(BigIdeal &ideal)
Sorts the generators of ideal and removes duplicates.
void takeProducts(const vector< BigIdeal * > &ideals, BigIdeal &ideal)
Take the product of the minimal generators of each ideal, and add the resulting monomials as generato...
void printLcm(BigIdeal &ideal, IOHandler *handler, FILE *out)
Represents a monomial ideal with int exponents.
size_t getGeneratorCount() const
void insert(const Exponent *term)
bool isWeaklyGeneric() const
bool isMinimallyGenerated() const
size_t getVarCount() const
Encapsulates an algorithm for computing size-maximal independent sets of a hypergraph.
void run(Ideal &ideal)
Run the algorithm on ideal.
mpz_class getMaxIndepSetSize()
Returns the largest size over all independent sets of the hypergraph passed to run.
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
Term represents a product of variables which does not include a coefficient.
Defines the variables of a polynomial ring and facilities IO involving them.
size_t getVarCount() const
Returns the current number of variables.
void projectVar(size_t index)
void toString(string &str) const
void reportError(const string &errorMsg)
void codimension(const Ideal &ideal, mpz_t codim)
Compute the codimension of a monomial ideal.
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)