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)
164 ideal.sortReverseLex();
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",
260 (
unsigned long)ideal.getGeneratorCount());
261 fprintf(stdout,
"variables: %lu\n",
262 (
unsigned long)ideal.getVarCount());
264 size_t sizeBeforeMinimize = ideal.getGeneratorCount();
266 fprintf(stdout,
"minimally generated: %s\n",
267 ideal.getGeneratorCount() == sizeBeforeMinimize ?
"yes" :
"no");
269 fprintf(out,
"strongly generic: %s\n",
270 ideal.isStronglyGeneric() ?
"yes" :
"no");
271 fprintf(out,
"weakly generic: %s\n",
272 ideal.isWeaklyGeneric() ?
"yes" :
"no");
282 vector<mpz_class>
lcm;
void sortGeneratorsUnique()
void projectVar(size_t index)
This is the super class of all facades.
mpz_class computeDimension(const BigIdeal &ideal, bool codimension=false, bool squareFreeAndMinimal=false)
Compute the Krull dimension of ideal.
void insert(const Ideal &ideal)
mpz_class & getLastTermExponentRef(size_t var)
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 sortVariables(BigIdeal &ideal)
Sorts the variables of ideal.
Represents a monomial ideal with int exponents.
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)
Defines the variables of a polynomial ring and facilities IO involving them.
void printLcm(BigIdeal &ideal, IOHandler *handler, FILE *out)
void codimension(const Ideal &ideal, mpz_t codim)
Compute the codimension of a monomial ideal.
size_t getVarCount() const
void printAnalysis(FILE *out, BigIdeal &ideal)
void sortGenerators(BigIdeal &ideal)
Sorts the generators of ideal.
void endAction()
Prints to standard error the time since the last call to beginAction.
size_t getGeneratorCount() const
void swap01(BigIdeal &ideal)
Change all 0 exponents to 1 and vice versa.
bool isPrintingActions() const
Returns true if printing actions.
void takeRadical(BigIdeal &ideal)
Takes the radical of the generators of ideal.
Encapsulates an algorithm for computing size-maximal independent sets of a hypergraph.
void projectVar(BigIdeal &bigIdeal, size_t var)
Remove the variable var from the ideal and ring by substituting it by 1.
bool isMinimallyGenerated() const
mpz_class getMaxIndepSetSize()
Returns the largest size over all independent sets of the hypergraph passed to run.
void beginAction(const char *message)
Prints message to standard error if printing is turned on, and records the time when the action start...
void sortGeneratorsUnique(BigIdeal &ideal)
Sorts the generators of ideal and removes duplicates.
An IOHandler implements input and output for some format in such a way that client code does not need...
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
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...
A facade for input and output of mathematical objects.
bool contains(const vector< mpz_class > &term) const
void sortAllAndMinimize(BigIdeal &bigIdeal)
Remove redundant generators from ideal.
void toString(string &str) const
void writeTerm(const vector< mpz_class > &term, const VarNames &names, IOHandler *handler, FILE *out)
void getLcm(vector< mpz_class > &lcm) const
void reportError(const string &errorMsg)
size_t getVarCount() const
Returns the current number of variables.
const VarNames & getNames() const
void insert(const Exponent *term)
void trimVariables(const vector< BigIdeal *> &ideals, VarNames &names)
Remove those variables that do not appear in any generator.
IdealFacade(bool printActions)
void deform(BigIdeal &ideal)
Applies some generic deformation to the ideal.
A replacement for stringstream.
void run(Ideal &ideal)
Run the algorithm on ideal.
Term represents a product of variables which does not include a coefficient.
void projectVar(size_t var)