39 bool doStrongDeformation):
41 _tmp(toDeform.getVarCount()),
42 _deformer(toDeform, order, doStrongDeformation),
46 _poly(toDeform.getVarCount()) {
56 virtual void consume(
const mpz_class& coef,
const Term& term) {
95 auto_ptr<IdealOrderer> enumerationOrder,
96 auto_ptr<IdealOrderer> deformationOrder):
97 _translator(translator),
99 _enumerationOrder(enumerationOrder),
100 _deformationOrder(deformationOrder),
116 Ideal deformed(ideal);
133 fputs(
"*** Statistics ***\n", stderr);
134 fprintf(stderr,
"Total states considered: %u\n",
136 fprintf(stderr,
"Total faces accepted: %u\n",
142 size_t& activeStateCount) {
146 fputs(
"Enumerating faces of Scarf complex of:\n", stderr);
155 if (
_states.size() < statesNeeded) {
157 for (
size_t i = 0; i <
_states.size(); ++i) {
164 activeStateCount = 0;
179 fputs(
"DEBUG:*Looking at element ", stderr);
180 if (state.
pos == ideal.
end())
181 fputs(
"end", stderr);
184 fputs(
" with lcm(face)=", stderr);
186 fputs(
" and face=", stderr);
187 if (state.
face.empty())
188 fputs(
"empty", stderr);
189 for (
size_t i = 0; i < state.
face.size(); ++i) {
190 fputs(
"\nDEBUG: ", stderr);
203 termToAdd = *state.
pos;
215 for (
size_t i = 0; i < state.
face.size(); ++i) {
231 nextState.
pos = state.
pos;
233 nextState.
face.push_back(termToAdd);
241 fputs(
"DEBUG: Found base case with lcm(face)=", stderr);
260 size_t activeStateCount = 0;
262 while (activeStateCount > 0) {
virtual void consume(const Polynomial &poly)
bool getPrintStatistics() const
Returns whether to print statistics on what the algorithm did to standard error after it has run.
bool getPrintDebug() const
Returns whether to print information about what the algorithm is doing to standard error as it runs.
A sparse multivariate polynomial represented by a hash table mapping terms to coefficients.
void add(const mpz_class &coef, const Term &term)
Add coef*term to the polynomial.
void feedTo(const TermTranslator &translator, CoefBigTermConsumer &consumer, bool inCanonicalOrder) const
Objects of this class represents a monomial ideal.
bool strictlyContains(const Exponent *term) const
Represents a monomial ideal with int exponents.
size_t getGeneratorCount() const
bool containsIdentity() const
bool strictlyContains(const Exponent *term) const
const_iterator end() const
void print(FILE *file) const
const_iterator begin() const
size_t getVarCount() const
void enumerateScarfComplex(const Ideal &ideal, CoefTermConsumer &consumer)
void doEnumerationBaseCase(const State &state, CoefTermConsumer &consumer)
const ScarfParams & _params
bool doEnumerationStep(const Ideal &ideal, const IdealTree &tree, State &state, State &nextState)
void runGeneric(const Ideal &ideal, CoefBigTermConsumer &consumer, bool univariate, bool canonical)
const TermTranslator & _translator
const auto_ptr< IdealOrderer > _deformationOrder
void initializeEnumeration(const Ideal &ideal, size_t &activeStateCount)
ScarfHilbertAlgorithm(const TermTranslator &translator, const ScarfParams ¶ms, auto_ptr< IdealOrderer > enumerationOrder, auto_ptr< IdealOrderer > deformationOrder)
const auto_ptr< IdealOrderer > _enumerationOrder
bool getDeformToStronglyGeneric() const
Returns true if deforming to a strongly generic ideal.
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
const mpz_class & getExponent(size_t variable, Exponent exponent) const
This method translates from IDs to arbitrary precision integers.
size_t getVarCount() const
const VarNames & getNames() const
Term represents a product of variables which does not include a coefficient.
static bool strictlyDivides(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether a strictly divides b.
size_t getVarCount() const
static void print(FILE *file, const Exponent *e, size_t varCount)
Writes e to file in a format suitable for debug output.
static void lcm(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to the least commom multiple of a and b.
A sparse univariate polynomial represented by a hash table mapping terms to coefficients.
void feedTo(CoefBigTermConsumer &consumer, bool inCanonicalOrder=false) const
void add(bool plus, const mpz_class &exponent)
Add +t^exponent or -t^exponent to the polynomial depending on whether plus is true or false,...
Defines the variables of a polynomial ring and facilities IO involving them.
vector< Exponent * > face
Ideal::const_iterator pos