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) {
62 if (
_tmp.getVarCount() == 0)
66 for (
size_t var = 1; var <
_tmp.getVarCount(); ++var)
95 unique_ptr<IdealOrderer> enumerationOrder,
96 unique_ptr<IdealOrderer> deformationOrder):
116 Ideal deformed(ideal);
123 _params.getDeformToStronglyGeneric());
132 if (
_params.getPrintStatistics()) {
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)
A sparse multivariate polynomial represented by a hash table mapping terms to coefficients.
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 unique_ptr< IdealOrderer > _deformationOrder
void initializeEnumeration(const Ideal &ideal, size_t &activeStateCount)
ScarfHilbertAlgorithm(const TermTranslator &translator, const ScarfParams ¶ms, unique_ptr< IdealOrderer > enumerationOrder, unique_ptr< IdealOrderer > deformationOrder)
const unique_ptr< IdealOrderer > _enumerationOrder
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
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.
Defines the variables of a polynomial ring and facilities IO involving them.
This header file includes common definitions and is included as the first line of code in every imple...
vector< Exponent * > face
Ideal::const_iterator pos