72 Term(
const string& str);
145 ASSERT(a != 0 || varCount == 0);
146 ASSERT(b != 0 || varCount == 0);
147 for (
size_t var = 0; var < varCount; ++var)
166 ASSERT(a != 0 || varCount == 0);
167 ASSERT(b != 0 || varCount == 0);
168 for (
size_t var = 0; var < varCount; ++var)
190 ASSERT(a != 0 || varCount == 0);
191 ASSERT(b != 0 || varCount == 0);
192 bool bIsIdentity =
true;
193 for (
size_t var = 0; var < varCount; ++var) {
194 if (a[var] >= b[var] && a[var] != 0)
216 ASSERT(res != 0 || varCount == 0);
217 ASSERT(a != 0 || varCount == 0);
218 ASSERT(b != 0 || varCount == 0);
219 for (
size_t var = 0; var < varCount; ++var) {
250 ASSERT(res != 0 || varCount == 0);
251 ASSERT(a != 0 || varCount == 0);
252 ASSERT(b != 0 || varCount == 0);
253 for (
size_t var = 0; var < varCount; ++var) {
275 ASSERT(res != 0 || varCount == 0);
276 ASSERT(a != 0 || varCount == 0);
277 ASSERT(b != 0 || varCount == 0);
278 for (
size_t var = 0; var < varCount; ++var)
279 res[var] = a[var] + b[var];
297 ASSERT(res != 0 || varCount == 0);
298 for (
size_t var = 0; var < varCount; ++var)
309 ASSERT(a != 0 || varCount == 0);
310 for (
size_t var = 0; var < varCount; ++var)
324 ASSERT(a != 0 || varCount == 0);
325 for (
size_t var = 0; var < varCount; ++var)
339 ASSERT(a != 0 || varCount == 0);
340 for (
size_t var = 0; var < varCount; ++var)
354 ASSERT(a != 0 || varCount == 0);
356 for (
size_t var = 0; var < varCount; ++var) {
358 if (nonZeroOffset == 0)
374 ASSERT(a != 0 || varCount == 0);
376 for (
size_t var = 1; var < varCount; ++var)
395 ASSERT(a != 0 || varCount == 0);
397 for (
size_t var = 0; var < varCount; ++var)
410 for (
size_t var = 0; var < varCount; ++var)
411 if (a[var] != 0 && a[var] == b[var])
417 size_t hashCode = varCount;
418 for (
size_t var = 0; var < varCount; ++var)
419 hashCode = 31 * hashCode + a[var];
440 ASSERT(a != 0 || varCount == 0);
441 ASSERT(b != 0 || varCount == 0);
442 for (
size_t var = 0; var < varCount; ++var) {
471 ASSERT(res != 0 || varCount == 0);
472 ASSERT(a != 0 || varCount == 0);
473 ASSERT(b != 0 || varCount == 0);
474 for (
size_t var = 0; var < varCount; ++var) {
476 res[var] = a[var] - b[var];
500 ASSERT(res != 0 || varCount == 0);
501 ASSERT(dualOf != 0 || varCount == 0);
502 ASSERT(point != 0 || varCount == 0);
504 for (
size_t var = 0; var < varCount; ++var) {
505 ASSERT(dualOf[var] <= point[var]);
506 if (dualOf[var] != 0)
507 res[var] = point[var] - dualOf[var] + 1;
525 ASSERT(a != 0 || varCount == 0);
526 for (
size_t var = 0; var < varCount; ++var)
561 static void print(FILE* file,
const Exponent* e,
size_t varCount);
564 static void print(ostream& out,
const Exponent* e,
size_t varCount);
583 copy(exponents, exponents + varCount,
_exponents);
size_t getMiddleNonZeroExponent() const
static Exponent * allocate(size_t size)
bool isSquareFree() const
void swap< Term >(Term &a, Term &b)
ostream & operator<<(ostream &out, const Term &term)
static bool isIdentity(const Exponent *a, size_t varCount)
Returns whether a is 1, i.e. whether all entries of a are 0.
Exponent operator[](int offset) const
void print(ostream &out) const
static void encodedDual(Exponent *res, const Exponent *dualOf, const Exponent *point, size_t varCount)
The parameter dualOf is interpreted to encode an irreducible ideal, and the dual of that reflected in...
bool sharesNonZeroExponent(const Term &a) const
const Exponent * end() const
void encodedDual(const Term &dualOf, const Term &point)
bool operator!=(const Term &term) const
void gcd(const Term &a, const Term &b)
bool hasSameSupport(const Exponent *a) const
size_t getFirstMaxExponent() const
bool operator!=(const Exponent *term) const
void reset(size_t newVarCount)
Term & operator=(const Exponent *exponents)
bool sharesNonZeroExponent(const Exponent *a) const
void encodedDual(const Exponent *dualOf, const Exponent *point)
static size_t getFirstNonZeroExponent(const Exponent *a, size_t varCount)
Returns least var such that a[var] is non-zero.
Exponent & operator[](unsigned int offset)
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.
Term(size_t varCount)
This object is initialized to the identity, i.e. the exponent vector is the zero vector.
bool strictlyDivides(const Exponent *term) const
size_t getVarCount() const
void initialize(const Exponent *exponents, size_t varCount)
void lcm(const Exponent *a, const Exponent *b)
bool operator==(const Term &term) const
bool dominates(const Term &term) const
void product(const Term &a, const Term &b)
Set this object equal to the product of a and b.
Term & operator=(const Term &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.
static size_t getHashCode(const Exponent *a, size_t varCount)
bool hasSameSupport(const Term &a) const
void gcd(const Exponent *a, const Exponent *b)
const Exponent * begin() const
void lcm(const Term &a, const Term &b, int position)
static void deallocate(Exponent *p, size_t size)
void print(FILE *file) const
bool divides(const Exponent *term) const
size_t getSizeOfSupport() const
static size_t getSizeOfSupport(const Exponent *a, size_t varCount)
Returns the number of variables such that divides .
Term(const Exponent *exponents, size_t varCount)
void colon(const Exponent *a, const Exponent *b)
bool dominates(const Exponent *term) const
static bool divides(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether a divides b.
void colon(const Term &a, const Term &b)
bool divides(const Term &term) const
void lcm(const Term &a, const Term &b)
size_t getHashCode() const
static size_t getFirstMaxExponent(const Exponent *a, size_t varCount)
Returns a var such that a[var] >= a[i] for all i.
static void print(FILE *file, const Exponent *e, size_t varCount)
Writes e to file in a format suitable for debug output.
static size_t getMiddleNonZeroExponent(const Exponent *a, size_t varCount)
Returns a median element of the set of var's such that a[var] is non-zero.
static bool dominates(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether a dominates b, i.e. whether b divides a.
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.
Exponent & operator[](unsigned long offset)
size_t getFirstNonZeroExponent() const
Exponent & operator[](int offset)
static void colon(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to .
static bool sharesNonZeroExponent(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether there is some such that .
Exponent operator[](unsigned int offset) 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.
size_t getMaxExponent() const
static bool hasSameSupport(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether for every variable .
bool strictlyDivides(const Term &term) const
Term represents a product of variables which does not include a coefficient.
void product(const Exponent *a, const Exponent *b)
static bool isSquareFree(const Exponent *a, size_t varCount)
Returns whether a is square free, i.e. for each where .
void swap(hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht1, hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht2)
Exponent operator[](unsigned long offset) const