Frobby 0.10.0
Loading...
Searching...
No Matches
Term Class Reference

#include <Term.h>

Public Member Functions

 Term (const Term &term)
 Term (const Exponent *exponents, size_t varCount)
 Term (size_t varCount)
 Term (const string &str)
 operator Exponent * ()
 operator const Exponent * () const
Exponent * begin ()
const Exponent * begin () const
Exponent * end ()
const Exponent * end () const
size_t getVarCount () const
Exponent operator[] (int offset) const
Exponent operator[] (unsigned int offset) const
Exponent operator[] (unsigned long offset) const
Exponent operator[] (unsigned long long offset) const
Exponent & operator[] (int offset)
Exponent & operator[] (unsigned int offset)
Exponent & operator[] (unsigned long offset)
Exponent & operator[] (unsigned long long offset)
bool operator== (const Term &term) const
bool operator== (const Exponent *term) const
bool operator!= (const Term &term) const
bool operator!= (const Exponent *term) const
Term & operator= (const Term &term)
Term & operator= (const Exponent *exponents)
bool divides (const Term &term) const
bool divides (const Exponent *term) const
bool dominates (const Term &term) const
bool dominates (const Exponent *term) const
bool strictlyDivides (const Term &term) const
bool strictlyDivides (const Exponent *term) const
void lcm (const Term &a, const Term &b, int position)
void lcm (const Term &a, const Term &b)
void lcm (const Exponent *a, const Exponent *b)
void gcd (const Term &a, const Term &b)
void gcd (const Exponent *a, const Exponent *b)
void product (const Term &a, const Term &b)
void product (const Exponent *a, const Exponent *b)
void setToIdentity ()
bool isIdentity () const
bool isSquareFree () const
size_t getFirstNonZeroExponent () const
size_t getMiddleNonZeroExponent () const
size_t getFirstMaxExponent () const
size_t getMaxExponent () const
size_t getSizeOfSupport () const
size_t getHashCode () const
bool sharesNonZeroExponent (const Exponent *a) const
bool sharesNonZeroExponent (const Term &a) const
bool hasSameSupport (const Term &a) const
bool hasSameSupport (const Exponent *a) const
void colon (const Term &a, const Term &b)
void colon (const Exponent *a, const Exponent *b)
void encodedDual (const Term &dualOf, const Term &point)
void encodedDual (const Exponent *dualOf, const Exponent *point)
void decrement ()
void swap (Term &term)
void reset (size_t newVarCount)
void clear ()
void print (FILE *file) const
void print (ostream &out) const

Static Public Member Functions

static bool divides (const Exponent *a, const Exponent *b, size_t varCount)
static bool dominates (const Exponent *a, const Exponent *b, size_t varCount)
static bool strictlyDivides (const Exponent *a, const Exponent *b, size_t varCount)
static void lcm (Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
static void gcd (Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
static void product (Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
static void setToIdentity (Exponent *res, size_t varCount)
static bool isIdentity (const Exponent *a, size_t varCount)
static bool isSquareFree (const Exponent *a, size_t varCount)
static size_t getFirstNonZeroExponent (const Exponent *a, size_t varCount)
static size_t getMiddleNonZeroExponent (const Exponent *a, size_t varCount)
static size_t getFirstMaxExponent (const Exponent *a, size_t varCount)
static size_t getSizeOfSupport (const Exponent *a, size_t varCount)
static bool sharesNonZeroExponent (const Exponent *a, const Exponent *b, size_t varCount)
static size_t getHashCode (const Exponent *a, size_t varCount)
static bool hasSameSupport (const Exponent *a, const Exponent *b, size_t varCount)
static void colon (Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
static void encodedDual (Exponent *res, const Exponent *dualOf, const Exponent *point, size_t varCount)
static void decrement (Exponent *a, size_t varCount)
static void print (FILE *file, const Exponent *e, size_t varCount)
static void print (ostream &out, const Exponent *e, size_t varCount)

Detailed Description

Term represents a product of variables which does not include a coefficient. This concept is also sometimes called a monomial or power product.

A term is represented as an array of Exponent and an integer indicating the length of the array, i.e. the number of variables. It is sometimes desirable to separate the length from the array, e.g. when representing an array of terms all of the same length, such as in representing the generators of a monomial ideal, in which case representing the length once for each generator would be wasteful. Thus Term has static versions of most methods where the number of variables is a separate parameter. In these cases it is allowed for the exponent array pointer to be null (i.e. equal to 0) if the length is zero.

Most methods on Term are inline to avoid function call overhead. This is significant because these methods tend to be called in the innermost loops of monomial ideal algorithms.

Todo
Move the inline code out of the class declaration and add them as inline below the class declaration.
Todo
Duplicate the comments for overloads using the copydoc Doxygen command.
Todo
Rename term.h to Term.h.

Constructor & Destructor Documentation

◆ Term() [1/2]

Term::Term ( size_t varCount)
inline

This object is initialized to the identity, i.e. the exponent vector is the zero vector.

◆ Term() [2/2]

Term::Term ( const string & str)

Accepts a whitespace-separated list of integers as exponent vector.

Member Function Documentation

◆ colon()

void Term::colon ( Exponent * res,
const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Sets res equal to $a : b$. $a : b$ is read as "a colon b", and it is defined as $lcm(a, b)
/ b$.

◆ decrement()

void Term::decrement ( Exponent * a,
size_t varCount )
inlinestatic

Decrements each positive entry of a by one.

◆ divides()

bool Term::divides ( const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Returns whether a divides b.

◆ dominates()

bool Term::dominates ( const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Returns whether a dominates b, i.e. whether b divides a.

◆ encodedDual()

void Term::encodedDual ( Exponent * res,
const Exponent * dualOf,
const Exponent * point,
size_t varCount )
inlinestatic

The parameter dualOf is interpreted to encode an irreducible ideal, and the dual of that reflected in point is a principal ideal. The generated of this ideal is written to res. This requires that dualOf divides point, as otherwise that dual is not defined.

◆ gcd()

void Term::gcd ( Exponent * res,
const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Sets res equal to the greatest common divisor of a and b.

◆ getFirstMaxExponent()

size_t Term::getFirstMaxExponent ( const Exponent * a,
size_t varCount )
inlinestatic

Returns a var such that a[var] >= a[i] for all i.

◆ getFirstNonZeroExponent()

size_t Term::getFirstNonZeroExponent ( const Exponent * a,
size_t varCount )
inlinestatic

Returns least var such that a[var] is non-zero. Returns varCount if the entries of a are all zero.

◆ getMiddleNonZeroExponent()

size_t Term::getMiddleNonZeroExponent ( const Exponent * a,
size_t varCount )
inlinestatic

Returns a median element of the set of var's such that a[var] is non-zero. Returns varCount is the entries of a are all zero.

◆ getSizeOfSupport()

size_t Term::getSizeOfSupport ( const Exponent * a,
size_t varCount )
inlinestatic

Returns the number of variables $x_i$ such that $x_i$ divides $a$.

◆ hasSameSupport()

bool Term::hasSameSupport ( const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Returns whether $x_i|a\Leftrightarrow x_i|b$ for every variable $x_i$.

◆ isIdentity()

bool Term::isIdentity ( const Exponent * a,
size_t varCount )
inlinestatic

Returns whether a is 1, i.e. whether all entries of a are 0.

◆ isSquareFree()

bool Term::isSquareFree ( const Exponent * a,
size_t varCount )
inlinestatic

Returns whether a is square free, i.e. $v_i\leq 1$ for each $i$ where $a=x^v$.

◆ lcm()

void Term::lcm ( Exponent * res,
const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Sets res equal to the least commom multiple of a and b.

◆ print() [1/2]

void Term::print ( FILE * file,
const Exponent * e,
size_t varCount )
static

Writes e to file in a format suitable for debug output.

◆ print() [2/2]

void Term::print ( ostream & out,
const Exponent * e,
size_t varCount )
static

Writes e to out in a format suitable for debug output.

◆ product() [1/2]

void Term::product ( const Term & a,
const Term & b )
inline

Set this object equal to the product of a and b.

◆ product() [2/2]

void Term::product ( Exponent * res,
const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Sets res equal to the product of a and b.

◆ setToIdentity()

void Term::setToIdentity ( Exponent * res,
size_t varCount )
inlinestatic

Set res equal to $1=x^{(0,\ldots,0)}$, i.e. set each entry of res equal to 0.

◆ sharesNonZeroExponent()

bool Term::sharesNonZeroExponent ( const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Returns whether there is some $i$ such that $a_i=b_i>0$.

◆ strictlyDivides()

bool Term::strictlyDivides ( const Exponent * a,
const Exponent * b,
size_t varCount )
inlinestatic

Returns whether a strictly divides b. $a$ strictly divides $b$ if $a * gcd(a, x_1...x_n)$ divides $b$ and $b\neq 1$, i.e. if, for each $i$, $u_i<b_i$ or $v_i=0$ where $a=x^u$, $b=x^v\neq x^0$.


The documentation for this class was generated from the following files: