37 _varCount(term.getVarCount()),
38 _allocator(term.getVarCount()) {
43 _varCount(ideal.getVarCount()),
44 _allocator(ideal.getVarCount()) {
107 for (
size_t var = 0; var <
_varCount; ++var) {
146 if ((*
it)[var] > 0) {
222 for (
size_t var = 0; var <
_varCount; ++var)
223 if (
least[var] == 0 || ((*
it)[var] <
least[var] && (*
it)[var] > 0))
231 for (
size_t var = 0; var <
_varCount; ++var)
242 for (
size_t var = 0; var <
_varCount; ++var) {
279 for (
size_t var = 0; var <
_varCount; ++var) {
333 for (
size_t var = 0; var <
_varCount; ++var) {
385 for (
size_t var = 0; var <
_varCount; ++var) {
447 out <<
"//------------ Ideal:\n";
452 out <<
"------------\\\\\n";
600 if ((*
it)[var] <
e) {
655 for (
size_t var = 0; var <
_varCount; ++var)
663 for (
size_t var = 0; var <
_varCount; ++var)
751 if (_chunkIterator +
_varCount > _chunkEnd) {
752 if (useSingleChunking()) {
755 _chunks.push_back(term);
767 _chunks.push_back(_chunkIterator);
776 ASSERT(_chunkIterator <= _chunkEnd);
784 if (useSingleChunking()) {
785 for (
size_t i = 0;
i < _chunks.size(); ++
i)
792 for (
size_t i = 0;
i < _chunks.size(); ++
i)
800 std::swap(_chunkIterator,
allocator._chunkIterator);
801 std::swap(_chunkEnd,
allocator._chunkEnd);
const int ExponentsPerChunk
class ChunkPool globalChunkPool
const int MinTermsPerChunk
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
bool equals(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether the entries of a are equal to the entries of b.
void deallocate(Exponent *chunk)
vector< Exponent * > _chunks
A predicate that compares for equality.
void reset(size_t newVarCount)
void swap(ExponentAllocator &allocator)
bool useSingleChunking() const
ExponentAllocator(size_t varCount)
Represents a monomial ideal with int exponents.
void getGcdOfMultiplesOf(Exponent *gcd, const Exponent *divisor)
Sets gcd to the greatest common divisor of those generators that are divisible by divisor.
void removeStrictMultiples(const Exponent *term)
void singleDegreeSort(size_t var)
bool isSquareFree() const
void product(const Exponent *term)
void remove(const_iterator it)
void getGcd(Exponent *gcd) const
Sets gcd to the greatest common divisor of all generators.
void insertNonMultiples(const Exponent *term, const Ideal &ideal)
size_t getGeneratorCount() const
ExponentAllocator _allocator
size_t getMostNonGenericExponent(size_t &var, Exponent &exp)
Sets var and exp such that var^exp is the most non-generic degree.
const_iterator getMultiple(size_t var) const
bool containsIdentity() const
void colon(const Exponent *by)
void clearAndSetVarCount(size_t varCount)
void getLcm(Exponent *lcm) const
Sets lcm to the least common multiple of all generators.
void takeRadicalNoMinimize()
Replaces all generators with their support and does not remove any non-minimal generators this may pr...
bool getNonGenericExponent(size_t &var, Exponent &exp)
Sets var and exp such that var^exp is some non-generic degree.
bool isIncomparable(const Exponent *term) const
Cont::const_iterator const_iterator
static void clearStaticCache()
Ideal caches memory allocated with new internally and reuses it to avoid calling new all the time.
vector< Exponent * > _terms
void mapExponentsToZeroNoMinimize(const Term &zeroExponents)
Replaces the exponents from zeroExponents with zero and does not remove any non-minimal generators th...
bool contains(const Exponent *term) const
size_t getTypicalExponent(size_t &var, Exponent &exp)
Sets var and exp such that var^exp is the typical non-zero exponent.
void insert(const Exponent *term)
bool strictlyContains(const Exponent *term) const
void insertReminimize(const Exponent *term)
void getLeastExponents(Exponent *least) const
bool disjointSupport() const
Returns true if all pairs of generators have disjoint support.
const_iterator end() const
Ideal & operator=(const Ideal &ideal)
void print(FILE *file) const
const_iterator begin() const
void getSupportCounts(Exponent *counts) const
counts[var] will be the number of generators divisible by var.
Ideal(size_t varCount=0)
Initialize this object to the zero ideal in varCount variables.
bool isIrreducible() const
void removeMultiples(const Exponent *term)
bool isWeaklyGeneric() const
size_t getTypicalNonGenericExponent(size_t &var, Exponent &exp)
Sets var and exp such that var^exp is the typical non-generic degree.
bool colonReminimize(const Exponent *colon)
bool isMinimallyGenerated() const
void getGcdAtExponent(Exponent *gcd, size_t var, Exponent exp)
Sets gcd to the greatest common divisor of those generators that raise the variable var to the power ...
bool operator==(const Ideal &ideal) const
Rereturns true if *this equals ideal.
size_t getVarCount() const
A predicate that sorts terms according to lexicographic order.
A predicate that sorts according to reverse lexicographic order.
A predicate that sorts terms in weakly ascending order according to degree of the specified variable.
Term represents a product of variables which does not include a coefficient.
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 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.
bool isSquareFree() const
static void print(FILE *file, const Exponent *e, size_t varCount)
Writes e to file in a format suitable for debug output.
static void colon(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to .
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 bool divides(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether a divides b.
static bool sharesNonZeroExponent(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether there is some such that .
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.