30 const Ideal& subtract,
33 Slice(strategy, ideal, subtract, multiply),
64 if (
getLcm().isSquareFree()) {
178 bool seenMatch =
false;
180 if (term[var] ==
_lcm[var]) {
199 bool removedAny =
false;
225 for (
size_t var2 = 0; var2 <
_varCount; ++var2)
226 if (term[var2] ==
lcm[var2] && var2 != var)
229 bound.
gcd(bound, *it);
234 if (bound[0] ==
lcm[0] && bound[1] ==
lcm[1]) {
261 _lcm[1] = (*it)[1] - 1;
267 _lcm[0] = (*it)[0] - 1;
295 for (
size_t var = 0; var <
_varCount; ++var) {
298 msm[var] =
getLcm()[var] - 1;
302 for (
size_t var = 0; var <
_varCount; ++var) {
303 if ((*it)[var] == 1) {
310 msm[var] =
getLcm()[var] - 1;
322 for (; it != end; ++it) {
324 for (
size_t var = 0; var <
lcm.getVarCount(); ++var) {
325 if ((*it)[var] ==
lcm[var]) {
353 for (
size_t var = 0; var <
_varCount; ++var)
357 for (
size_t var1 = 0; var1 <
_varCount; ++var1) {
358 if (nonMax1[var1] == 0)
360 if (nonMax1[var1] <= nonMax2[var1])
363 for (
size_t var2 = 0; var2 <
_varCount; ++var2) {
364 if (var1 == var2 || nonMax2[var2] == 0)
366 if (nonMax2[var2] <= nonMax1[var2])
376 if ((*it)[var1] >= nonMax1[var1] ||
377 (*it)[var2] >= nonMax2[var2])
380 for (
size_t var = 0; var <
lcm.getVarCount(); ++var) {
381 if ((*it)[var] ==
lcm[var]) {
391 msm[var1] = nonMax1[var1] - 1;
392 msm[var2] = nonMax2[var2] - 1;
397 msm[var2] =
lcm[var2] - 1;
398 msm[var1] =
lcm[var1] - 1;
402 for (
size_t var = 0; var <
_varCount; ++var) {
404 if (nonMax1[var] < nonMax2[var])
416 msm[var] =
lcm[var] - 1;
bool getTheOnlyTwoNonMax(Ideal::const_iterator it, const Exponent *&first, const Exponent *&second, Ideal::const_iterator end, const Term &lcm)
void operator=(const DoubleLcmPredicate &)
bool operator()(const Exponent *term)
DoubleLcmPredicate(const Term &lcm)
Represents a monomial ideal with int exponents.
size_t getGeneratorCount() const
Cont::const_iterator const_iterator
bool contains(const Exponent *term) const
const_iterator end() const
bool removeIf(Predicate pred)
Removes those generators m such that pred(m) evaluates to true.
const_iterator begin() const
Invariant: either the slice is a trivial base case, or removeDoubleLcm returns false.
virtual bool getLowerBound(Term &bound, size_t var) const
Calculates a lower bound that depends on var.
MsmSlice(MsmStrategy &strategy)
virtual bool baseCase(bool simplified)
Returns true if this slice is a base case slice, and in that case produces output in a derivative-spe...
void setToProjOf(const MsmSlice &slice, const Projection &projection, TermConsumer *consumer)
virtual Slice & operator=(const Slice &slice)
Performs a deep copy of slice into this object.
virtual void outerSlice(const Term &pivot)
Sets this object to the outer slice according to pivot.
void oneMoreGeneratorBaseCase()
virtual bool simplifyStep()
Like simplify(), except that only one simplification step is performed.
void swap(MsmSlice &slice)
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.
size_t _varCount
The number of variables in the ambient polynomial ring.
Ideal _ideal
The of a slice .
void singleDegreeSortIdeal(size_t var)
Calls Ideal::singleDegreeSort on getIdeal().
virtual bool innerSlice(const Term &pivot)
Sets this object to the inner slice according to pivot.
virtual void outerSlice(const Term &pivot)
Sets this object to the outer slice according to pivot.
virtual Slice & operator=(const Slice &slice)=0
Performs a deep copy of slice into this object.
void setToProjOf(const Slice &slice, const Projection &projection)
Set this object to be the projection of slice according to projection.
Term _multiply
The of a slice .
void swap(Slice &slice)
Simultaneously set the value of this object to that of slice and vice versa.
bool pruneSubtract()
Removes those generators of subtract that do not strictly divide the lcm of getIdeal(),...
Term _lcm
The lcm of getIdeal() if _lcmUpdated is true, and otherwise the value is undefind.
bool applyLowerBound()
Calculates a lower bound on the content of the slice using getLowerBound() and calls innerSlice with ...
const Ideal & getIdeal() const
Returns for a slice .
const Term & getLcm() const
Returns the least common multiple of the generators of getIdeal().
bool _lcmUpdated
Indicates whether _lcm is correct.
Ideal _subtract
The of a slice .
size_t getVarCount() const
Returns the number of variables in the ambient ring.
Ideal & getSubtract()
Returns for a slice .
This class is used to transfer terms one at a time from one part of the program to another,...
virtual void consume(const Term &term)=0
Consume a term.
Term represents a product of variables which does not include a coefficient.
static void decrement(Exponent *a, size_t varCount)
Decrements each positive entry of a by one.
static size_t getSizeOfSupport(const Exponent *a, size_t varCount)
Returns the number of variables such that divides .
static void product(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to the product of a and b.
size_t getVarCount() const
static void gcd(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to the greatest common divisor of a and b.
size_t getSizeOfSupport() const
static void setToIdentity(Exponent *res, size_t varCount)
Set res equal to , i.e. set each entry of res equal to 0.
size_t getSizeOfSupport(const Word *a, size_t varCount)
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)
void swap(hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht1, hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht2)