30 const Ideal& subtract,
33 Slice(strategy, ideal, subtract, multiply),
64 if (
getLcm().isSquareFree()) {
115 ASSERT(dynamic_cast<const MsmSlice*>(&slice) != 0);
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;
Cont::const_iterator const_iterator
virtual Slice & operator=(const Slice &slice)=0
Performs a deep copy of slice into this object.
MsmSlice(MsmStrategy &strategy)
bool operator()(const Exponent *term)
bool pruneSubtract()
Removes those generators of subtract that do not strictly divide the lcm of getIdeal(), or that belong to getIdeal().
size_t getVarCount() const
size_t getVarCount() const
Returns the number of variables in the ambient ring.
virtual bool simplifyStep()
Like simplify(), except that only one simplification step is performed.
bool removeIf(Predicate pred)
Removes those generators m such that pred(m) evaluates to true.
const Term & getLcm() const
Returns the least common multiple of the generators of getIdeal().
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.
Term _lcm
The lcm of getIdeal() if _lcmUpdated is true, and otherwise the value is undefind.
const_iterator begin() const
bool getTheOnlyTwoNonMax(Ideal::const_iterator it, const Exponent *&first, const Exponent *&second, Ideal::const_iterator end, const Term &lcm)
Term _multiply
The of a slice .
Represents a monomial ideal with int exponents.
const_iterator end() const
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 void decrement(Exponent *a, size_t varCount)
Decrements each positive entry of a by one.
bool contains(const Exponent *term) const
virtual bool innerSlice(const Term &pivot)
Sets this object to the inner slice according to pivot.
This class is used to transfer terms one at a time from one part of the program to another...
void oneMoreGeneratorBaseCase()
static void product(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to the product of a and b.
Ideal _ideal
The of a slice .
size_t _varCount
The number of variables in the ambient polynomial ring.
size_t getSizeOfSupport() const
virtual bool getLowerBound(Term &bound, size_t var) const
Calculates a lower bound that depends on var.
size_t getGeneratorCount() 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.
void setToProjOf(const Slice &slice, const Projection &projection)
Set this object to be the projection of slice according to projection.
virtual void consume(const Term &term)=0
Consume a term.
DoubleLcmPredicate(const Term &lcm)
const Ideal & getIdeal() const
Returns for a slice .
void singleDegreeSortIdeal(size_t var)
Calls Ideal::singleDegreeSort on getIdeal().
size_t getSizeOfSupport(const Word *a, size_t varCount)
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.
static void setToIdentity(Exponent *res, size_t varCount)
Set res equal to , i.e. set each entry of res equal to 0.
Ideal & getSubtract()
Returns for a slice .
virtual void outerSlice(const Term &pivot)
Sets this object to the outer slice according to pivot.
virtual Slice & operator=(const Slice &slice)
Performs a deep copy of slice into this object.
void setToProjOf(const MsmSlice &slice, const Projection &projection, TermConsumer *consumer)
bool _lcmUpdated
Indicates whether _lcm is correct.
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...
Ideal _subtract
The of a slice .
void swap(MsmSlice &slice)
Invariant: either the slice is a trivial base case, or removeDoubleLcm returns false.
Term represents a product of variables which does not include a coefficient.
void swap(hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht1, hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht2)