38 _varCount(multiply.getVarCount()),
39 _lcm(multiply.getVarCount()),
69 fputs(
"Slice (multiply: ", file);
71 fputs(
"\n ideal: ", file);
73 fputs(
" subtract: ", file);
118 bool changed = idealChanged || subtractChanged;
137 if (
getIdeal().getGeneratorCount() != count)
163 bool changed =
false;
169 for (
size_t var = 0; var <
_varCount; ++var) {
172 if (lowerBound[var] == 0 || lowerBound[var] > (*it)[var])
173 lowerBound[var] = (*it)[var];
190 bool removedAny =
false;
214 return lowerBoundChange || pruneSubtractChange;
240 getSubtract().insert(_lcm);
264 class PruneSubtractPredicate {
266 PruneSubtractPredicate(
const Ideal& ideal,
const Term&
lcm):
267 _ideal(ideal), _lcm(lcm) {}
269 bool operator()(
const Exponent* term) {
272 _ideal.contains(term);
295 bool changed =
false;
296 size_t stepsWithNoChange = 0;
309 stepsWithNoChange = 0;
void clearIdealAndSubtract()
Clears getIdeal() and getSubtract() and does not change getMultiply().
Cont::const_iterator const_iterator
bool normalize()
Removes those generators of getIdeal() that are strictly divisible by some generator of getSubtract()...
virtual bool simplify()
Simplifies this object such that it may become simpler without changing the content.
static bool isIdentity(const Exponent *a, size_t varCount)
Returns whether a is 1, i.e. whether all entries of a are 0.
void print(FILE *file) const
Write a text representation of this object to file in a format appropriate for debugging.
virtual Slice & operator=(const Slice &slice)=0
Performs a deep copy of slice into this object.
bool pruneSubtract()
Removes those generators of subtract that do not strictly divide the lcm of getIdeal(), or that belong to getIdeal().
virtual bool getLowerBound(Term &bound, size_t var) const =0
Calculates a lower bound that depends on var.
bool removeIf(Predicate pred)
Removes those generators m such that pred(m) evaluates to true.
void resetAndSetVarCount(size_t varCount)
Resets this slice to in an ambient polynomial ring of varCount variables.
virtual void outerSlice(const Term &pivot)
Sets this object to the outer slice according to pivot.
virtual bool innerSlice(const Term &pivot)
Sets this object to the inner slice according to pivot.
This class represents a slice, which is the central data structure of the Slice Algorithm.
void print(FILE *file) const
Term _lcm
The lcm of getIdeal() if _lcmUpdated is true, and otherwise the value is undefind.
const Term & getLcm() const
Returns the least common multiple of the generators of getIdeal().
StrictMultiplePredicate(const Exponent *term, size_t varCount)
void reset(size_t newVarCount)
void project(Exponent *to, const Exponent *from) const
Term _multiply
The of a slice .
Represents a monomial ideal with int exponents.
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)
bool applyLowerBound()
Calculates a lower bound on the content of the slice using getLowerBound() and calls innerSlice with ...
static size_t getFirstNonZeroExponent(const Exponent *a, size_t varCount)
Returns least var such that a[var] is non-zero.
virtual void run(TaskEngine &tasks)
Does whatever work this task represents.
static void decrement(Exponent *a, size_t varCount)
Decrements each positive entry of a by one.
static bool strictlyDivides(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether a strictly divides b.
virtual bool processSlice(TaskEngine &tasks, auto_ptr< Slice > slice)=0
Process the parameter slice.
size_t _lowerBoundHint
A hint that starting simplification through a lower bound at the variable indicated by _lowerBoundHin...
virtual void dispose()
Called when the task is no longer used but run has not and will not be called.
size_t getVarCount() const
bool operator()(const Exponent *term)
static void product(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to the product of a and b.
Term & getMultiply()
Returns for a slice .
Ideal _ideal
The of a slice .
void singleDegreeSort(size_t var)
size_t getVarCount() const
size_t _varCount
The number of variables in the ambient polynomial ring.
bool colonReminimize(const Exponent *colon)
void removeStrictMultiples(const Exponent *term)
bool domainVarHasProjection(size_t var) const
const_iterator end() const
static size_t getSizeOfSupport(const Exponent *a, size_t varCount)
Returns the number of variables such that divides .
void swap(Slice &slice)
Simultaneously set the value of this object to that of slice and vice versa.
TaskEngine handles a list of tasks that are to be carried out.
void setToProjOf(const Slice &slice, const Projection &projection)
Set this object to be the projection of slice according to projection.
virtual void freeSlice(auto_ptr< Slice > slice)=0
It is allowed to delete returned slices directly, but it is better to use freeSlice.
void insertReminimize(const Exponent *term)
size_t getVarCount() const
Returns the number of variables in the ambient ring.
static void print(FILE *file, const Exponent *e, size_t varCount)
Writes e to file in a format suitable for debug output.
This class describes the interface of a strategy object for the Slice Algorithm.
SliceStrategy & _strategy
void singleDegreeSortIdeal(size_t var)
Calls Ideal::singleDegreeSort on getIdeal().
size_t getFirstNonZeroExponent() const
void getLcm(Exponent *lcm) const
Sets lcm to the least common multiple of all generators.
Ideal & getSubtract()
Returns for a slice .
const_iterator begin() const
bool _lcmUpdated
Indicates whether _lcm is correct.
static void colon(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to .
bool adjustMultiply()
Ensure that for each var, var appears to the first power in some generator of getIdeal().
Ideal _subtract
The of a slice .
Term represents a product of variables which does not include a coefficient.
const Ideal & getIdeal() const
Returns for a slice .
size_t getRangeVarCount() const
void swap(hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht1, hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht2)
void clearAndSetVarCount(size_t varCount)
Slice(SliceStrategy &strategy)
Construct the slice in a ring of zero variables.
size_t getGeneratorCount() const