Go to the documentation of this file.
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),
103 ASSERT(_enumerationOrder.get() != 0);
104 ASSERT(_deformationOrder.get() != 0);
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) {
const auto_ptr< IdealOrderer > _deformationOrder
bool strictlyContains(const Exponent *term) const
A sparse multivariate polynomial represented by a hash table mapping terms to coefficients.
bool strictlyContains(const Exponent *term) const
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.
const_iterator begin() const
void print(FILE *file) const
const ScarfParams & _params
Objects of this class represents a monomial ideal.
size_t getVarCount() const
const TermTranslator & _translator
const auto_ptr< IdealOrderer > _enumerationOrder
void doEnumerationBaseCase(const State &state, CoefTermConsumer &consumer)
void runGeneric(const Ideal &ideal, CoefBigTermConsumer &consumer, bool univariate, bool canonical)
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
const VarNames & getNames() const
const mpz_class & getExponent(size_t variable, Exponent exponent) const
This method translates from IDs to arbitrary precision integers.
static bool strictlyDivides(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether a strictly divides b.
static void print(FILE *file, const Exponent *e, size_t varCount)
Writes e to file in a format suitable for debug output.
size_t getVarCount() const
size_t getGeneratorCount() const
const_iterator end() const
A sparse univariate polynomial represented by a hash table mapping terms to coefficients.
Term represents a product of variables which does not include a coefficient.
Ideal::const_iterator pos
virtual void consume(const Polynomial &poly)
void feedTo(const TermTranslator &translator, CoefBigTermConsumer &consumer, bool inCanonicalOrder) const
bool getPrintDebug() const
Returns whether to print information about what the algorithm is doing to standard error as it runs.
size_t getVarCount() const
ScarfHilbertAlgorithm(const TermTranslator &translator, const ScarfParams ¶ms, auto_ptr< IdealOrderer > enumerationOrder, auto_ptr< IdealOrderer > deformationOrder)
void initializeEnumeration(const Ideal &ideal, size_t &activeStateCount)
void feedTo(CoefBigTermConsumer &consumer, bool inCanonicalOrder=false) const
bool doEnumerationStep(const Ideal &ideal, const IdealTree &tree, State &state, State &nextState)
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,...
Represents a monomial ideal with int exponents.
bool getPrintStatistics() const
Returns whether to print statistics on what the algorithm did to standard error after it has run.
Defines the variables of a polynomial ring and facilities IO involving them.
bool getDeformToStronglyGeneric() const
Returns true if deforming to a strongly generic ideal.
bool containsIdentity() const
void add(const mpz_class &coef, const Term &term)
Add coef*term to the polynomial.
void enumerateScarfComplex(const Ideal &ideal, CoefTermConsumer &consumer)
vector< Exponent * > face