72 Term(
const string& str);
153 ASSERT(a != 0 || varCount == 0);
154 ASSERT(b != 0 || varCount == 0);
155 for (
size_t var = 0; var < varCount; ++var)
174 ASSERT(a != 0 || varCount == 0);
175 ASSERT(b != 0 || varCount == 0);
176 for (
size_t var = 0; var < varCount; ++var)
198 ASSERT(a != 0 || varCount == 0);
199 ASSERT(b != 0 || varCount == 0);
200 bool bIsIdentity =
true;
201 for (
size_t var = 0; var < varCount; ++var) {
202 if (a[var] >= b[var] && a[var] != 0)
224 ASSERT(res != 0 || varCount == 0);
225 ASSERT(a != 0 || varCount == 0);
226 ASSERT(b != 0 || varCount == 0);
227 for (
size_t var = 0; var < varCount; ++var) {
258 ASSERT(res != 0 || varCount == 0);
259 ASSERT(a != 0 || varCount == 0);
260 ASSERT(b != 0 || varCount == 0);
261 for (
size_t var = 0; var < varCount; ++var) {
283 ASSERT(res != 0 || varCount == 0);
284 ASSERT(a != 0 || varCount == 0);
285 ASSERT(b != 0 || varCount == 0);
286 for (
size_t var = 0; var < varCount; ++var)
287 res[var] = a[var] + b[var];
305 ASSERT(res != 0 || varCount == 0);
306 for (
size_t var = 0; var < varCount; ++var)
317 ASSERT(a != 0 || varCount == 0);
318 for (
size_t var = 0; var < varCount; ++var)
332 ASSERT(a != 0 || varCount == 0);
333 for (
size_t var = 0; var < varCount; ++var)
347 ASSERT(a != 0 || varCount == 0);
348 for (
size_t var = 0; var < varCount; ++var)
362 ASSERT(a != 0 || varCount == 0);
364 for (
size_t var = 0; var < varCount; ++var) {
366 if (nonZeroOffset == 0)
382 ASSERT(a != 0 || varCount == 0);
384 for (
size_t var = 1; var < varCount; ++var)
403 ASSERT(a != 0 || varCount == 0);
405 for (
size_t var = 0; var < varCount; ++var)
418 for (
size_t var = 0; var < varCount; ++var)
419 if (a[var] != 0 && a[var] == b[var])
425 size_t hashCode = varCount;
426 for (
size_t var = 0; var < varCount; ++var)
427 hashCode = 31 * hashCode + a[var];
448 ASSERT(a != 0 || varCount == 0);
449 ASSERT(b != 0 || varCount == 0);
450 for (
size_t var = 0; var < varCount; ++var) {
479 ASSERT(res != 0 || varCount == 0);
480 ASSERT(a != 0 || varCount == 0);
481 ASSERT(b != 0 || varCount == 0);
482 for (
size_t var = 0; var < varCount; ++var) {
484 res[var] = a[var] - b[var];
508 ASSERT(res != 0 || varCount == 0);
509 ASSERT(dualOf != 0 || varCount == 0);
510 ASSERT(point != 0 || varCount == 0);
512 for (
size_t var = 0; var < varCount; ++var) {
513 ASSERT(dualOf[var] <= point[var]);
514 if (dualOf[var] != 0)
515 res[var] = point[var] - dualOf[var] + 1;
533 ASSERT(a != 0 || varCount == 0);
534 for (
size_t var = 0; var < varCount; ++var)
569 static void print(FILE* file,
const Exponent* e,
size_t varCount);
572 static void print(ostream& out,
const Exponent* e,
size_t varCount);
591 copy(exponents, exponents + varCount,
_exponents);
void swap(Term &a, Term &b)
ostream & operator<<(ostream &out, const Term &term)
Term represents a product of variables which does not include a coefficient.
Exponent & operator[](int offset)
void lcm(const Exponent *a, const Exponent *b)
bool divides(const Term &term) const
void product(const Term &a, const Term &b)
Set this object equal to the product of a and b.
static size_t getHashCode(const Exponent *a, size_t varCount)
Term & operator=(const Term &term)
bool dominates(const Term &term) const
const Exponent * end() const
size_t getMiddleNonZeroExponent() const
void reset(size_t newVarCount)
static void decrement(Exponent *a, size_t varCount)
Decrements each positive entry of a by one.
bool strictlyDivides(const Exponent *term) const
Term & operator=(const Exponent *exponents)
bool divides(const Exponent *term) const
static bool hasSameSupport(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether for every variable .
Exponent operator[](unsigned int offset) const
Exponent & operator[](unsigned long offset)
static size_t getSizeOfSupport(const Exponent *a, size_t varCount)
Returns the number of variables such that divides .
Exponent & operator[](unsigned int offset)
bool operator==(const Term &term) const
static Exponent * allocate(size_t size)
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...
static void product(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to the product of a and b.
void print(ostream &out) const
static void deallocate(Exponent *p, size_t size)
size_t getHashCode() const
void product(const Exponent *a, const Exponent *b)
static bool dominates(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether a dominates b, i.e. whether b divides a.
static bool strictlyDivides(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether a strictly divides b.
Exponent operator[](unsigned long offset) const
void colon(const Exponent *a, const Exponent *b)
bool isSquareFree() const
bool sharesNonZeroExponent(const Term &a) const
void gcd(const Term &a, const Term &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.
void encodedDual(const Term &dualOf, const Term &point)
bool strictlyDivides(const Term &term) const
bool dominates(const Exponent *term) const
static void colon(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to .
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.
void lcm(const Term &a, const Term &b, int position)
const Exponent * begin() const
static size_t getFirstNonZeroExponent(const Exponent *a, size_t varCount)
Returns least var such that a[var] is non-zero.
bool hasSameSupport(const Exponent *a) const
static bool isIdentity(const Exponent *a, size_t varCount)
Returns whether a is 1, i.e. whether all entries of a are 0.
bool hasSameSupport(const Term &a) 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.
Term(const Exponent *exponents, size_t varCount)
Exponent operator[](int offset) const
size_t getFirstMaxExponent() const
void initialize(const Exponent *exponents, size_t varCount)
bool sharesNonZeroExponent(const Exponent *a) const
size_t getFirstNonZeroExponent() const
void print(FILE *file) const
size_t getSizeOfSupport() 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)
static bool isSquareFree(const Exponent *a, size_t varCount)
Returns whether a is square free, i.e. for each where .
bool operator!=(const Term &term) const
Exponent operator[](unsigned long long offset) const
void lcm(const Term &a, const Term &b)
bool operator!=(const Exponent *term) const
Term(size_t varCount)
This object is initialized to the identity, i.e. the exponent vector is the zero vector.
static size_t getFirstMaxExponent(const Exponent *a, size_t varCount)
Returns a var such that a[var] >= a[i] for all i.
size_t getMaxExponent() const
void gcd(const Exponent *a, const Exponent *b)
static bool sharesNonZeroExponent(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether there is some such that .
void encodedDual(const Exponent *dualOf, const Exponent *point)
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.
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 long offset)