Frobby  0.9.5
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Types | List of all members
Ideal Class Reference

Represents a monomial ideal with int exponents. More...

#include <Ideal.h>

Classes

class  ExponentAllocator
 

Public Types

typedef Cont::const_iterator const_iterator
 
typedef Cont::iterator iterator
 
typedef Cont::const_reverse_iterator const_reverse_iterator
 
typedef Cont::reverse_iterator reverse_iterator
 

Public Member Functions

 Ideal (size_t varCount=0)
 Initialize this object to the zero ideal in varCount variables. More...
 
 Ideal (const Term &term)
 Initialize this object to the ideal generated by term. More...
 
 Ideal (const Ideal &ideal)
 Initialize this object to be a copy of ideal. More...
 
 ~Ideal ()
 
const_iterator begin () const
 
const_iterator end () const
 
const Exponentoperator[] (size_t index) const
 
iterator begin ()
 
iterator end ()
 
Exponent *& operator[] (size_t index)
 
size_t getVarCount () const
 
size_t getGeneratorCount () const
 
bool isIncomparable (const Exponent *term) const
 
bool contains (const Exponent *term) const
 
bool containsIdentity () const
 
bool strictlyContains (const Exponent *term) const
 
bool isMinimallyGenerated () const
 
bool isZeroIdeal () const
 
bool isIrreducible () const
 
bool isSquareFree () const
 
bool isStronglyGeneric ()
 
bool isWeaklyGeneric () const
 
bool disjointSupport () const
 Returns true if all pairs of generators have disjoint support. More...
 
void getLcm (Exponent *lcm) const
 Sets lcm to the least common multiple of all generators. More...
 
void getGcd (Exponent *gcd) const
 Sets gcd to the greatest common divisor of all generators. More...
 
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 exp. More...
 
void getGcdOfMultiplesOf (Exponent *gcd, const Exponent *divisor)
 Sets gcd to the greatest common divisor of those generators that are divisible by divisor. More...
 
void getLeastExponents (Exponent *least) const
 
void getSupportCounts (Exponent *counts) const
 counts[var] will be the number of generators divisible by var. More...
 
size_t getTypicalExponent (size_t &var, Exponent &exp)
 Sets var and exp such that var^exp is the typical non-zero exponent. More...
 
size_t getMostNonGenericExponent (size_t &var, Exponent &exp)
 Sets var and exp such that var^exp is the most non-generic degree. More...
 
size_t getTypicalNonGenericExponent (size_t &var, Exponent &exp)
 Sets var and exp such that var^exp is the typical non-generic degree. More...
 
bool getNonGenericExponent (size_t &var, Exponent &exp)
 Sets var and exp such that var^exp is some non-generic degree. More...
 
const_iterator getMultiple (size_t var) const
 
bool operator== (const Ideal &ideal) const
 Rereturns true if *this equals ideal. More...
 
void print (FILE *file) const
 
void print (ostream &out) const
 
void insert (const Exponent *term)
 
void insert (const Ideal &ideal)
 
void insert (size_t var, Exponent e)
 
void insertReminimize (const Exponent *term)
 
void insertReminimize (size_t var, Exponent e)
 
void minimize ()
 
void sortReverseLex ()
 
void sortLex ()
 
void singleDegreeSort (size_t var)
 
void product (const Exponent *term)
 
void colon (const Exponent *by)
 
void colon (size_t var, Exponent e)
 
bool colonReminimize (const Exponent *colon)
 
bool colonReminimize (size_t var, Exponent e)
 
void remove (const_iterator it)
 
void removeMultiples (const Exponent *term)
 
void removeMultiples (size_t var, Exponent e)
 
void insertNonMultiples (const Exponent *term, const Ideal &ideal)
 
void insertNonMultiples (size_t var, Exponent e, const Ideal &ideal)
 
void removeStrictMultiples (const Exponent *term)
 
void removeDuplicates ()
 
void clear ()
 
void clearAndSetVarCount (size_t varCount)
 
void mapExponentsToZeroNoMinimize (const Term &zeroExponents)
 Replaces the exponents from zeroExponents with zero and does not remove any non-minimal generators this may produce. More...
 
void takeRadicalNoMinimize ()
 Replaces all generators with their support and does not remove any non-minimal generators this may produce. More...
 
Idealoperator= (const Ideal &ideal)
 
void swap (Ideal &ideal)
 
template<class Predicate >
bool removeIf (Predicate pred)
 Removes those generators m such that pred(m) evaluates to true. More...
 

Static Public Member Functions

static void clearStaticCache ()
 Ideal caches memory allocated with new internally and reuses it to avoid calling new all the time. More...
 

Protected Attributes

size_t _varCount
 
vector< Exponent * > _terms
 
ExponentAllocator _allocator
 

Private Types

typedef vector< Exponent * > Cont
 

Detailed Description

Represents a monomial ideal with int exponents.

Definition at line 27 of file Ideal.h.

Member Typedef Documentation

◆ const_iterator

typedef Cont::const_iterator Ideal::const_iterator

Definition at line 43 of file Ideal.h.

◆ const_reverse_iterator

typedef Cont::const_reverse_iterator Ideal::const_reverse_iterator

Definition at line 45 of file Ideal.h.

◆ Cont

typedef vector<Exponent*> Ideal::Cont
private

Definition at line 28 of file Ideal.h.

◆ iterator

typedef Cont::iterator Ideal::iterator

Definition at line 44 of file Ideal.h.

◆ reverse_iterator

typedef Cont::reverse_iterator Ideal::reverse_iterator

Definition at line 46 of file Ideal.h.

Constructor & Destructor Documentation

◆ Ideal() [1/3]

Ideal::Ideal ( size_t  varCount = 0)

Initialize this object to the zero ideal in varCount variables.

Definition at line 31 of file Ideal.cpp.

◆ Ideal() [2/3]

Ideal::Ideal ( const Term term)
explicit

Initialize this object to the ideal generated by term.

Definition at line 36 of file Ideal.cpp.

◆ Ideal() [3/3]

Ideal::Ideal ( const Ideal ideal)

Initialize this object to be a copy of ideal.

Definition at line 42 of file Ideal.cpp.

◆ ~Ideal()

Ideal::~Ideal ( )

Definition at line 28 of file Ideal.cpp.

Member Function Documentation

◆ begin() [1/2]

iterator Ideal::begin ( )
inline

Definition at line 52 of file Ideal.h.

◆ begin() [2/2]

const_iterator Ideal::begin ( ) const
inline

Definition at line 48 of file Ideal.h.

◆ clear()

void Ideal::clear ( )

Definition at line 641 of file Ideal.cpp.

◆ clearAndSetVarCount()

void Ideal::clearAndSetVarCount ( size_t  varCount)

Definition at line 646 of file Ideal.cpp.

◆ clearStaticCache()

void Ideal::clearStaticCache ( )
static

Ideal caches memory allocated with new internally and reuses it to avoid calling new all the time.

Call this method to release the cache.

Definition at line 810 of file Ideal.cpp.

◆ colon() [1/2]

void Ideal::colon ( const Exponent by)

Definition at line 531 of file Ideal.cpp.

◆ colon() [2/2]

void Ideal::colon ( size_t  var,
Exponent  e 
)

Definition at line 537 of file Ideal.cpp.

◆ colonReminimize() [1/2]

bool Ideal::colonReminimize ( const Exponent colon)

Definition at line 550 of file Ideal.cpp.

◆ colonReminimize() [2/2]

bool Ideal::colonReminimize ( size_t  var,
Exponent  e 
)

Definition at line 563 of file Ideal.cpp.

◆ contains()

bool Ideal::contains ( const Exponent term) const

Definition at line 57 of file Ideal.cpp.

◆ containsIdentity()

bool Ideal::containsIdentity ( ) const

Definition at line 65 of file Ideal.cpp.

◆ disjointSupport()

bool Ideal::disjointSupport ( ) const

Returns true if all pairs of generators have disjoint support.

I.e. if each var divides at most one generator.

Definition at line 142 of file Ideal.cpp.

◆ end() [1/2]

iterator Ideal::end ( )
inline

Definition at line 53 of file Ideal.h.

◆ end() [2/2]

const_iterator Ideal::end ( ) const
inline

Definition at line 49 of file Ideal.h.

◆ getGcd()

void Ideal::getGcd ( Exponent gcd) const

Sets gcd to the greatest common divisor of all generators.

If there are no generators then we define the gcd as the identity.

Definition at line 164 of file Ideal.cpp.

◆ getGcdAtExponent()

void Ideal::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 exp.

If there are no such generators then we define the gcd as the identity.

Definition at line 177 of file Ideal.cpp.

◆ getGcdOfMultiplesOf()

void Ideal::getGcdOfMultiplesOf ( Exponent gcd,
const Exponent divisor 
)

Sets gcd to the greatest common divisor of those generators that are divisible by divisor.

If there are no such generators then we define the gcd as the identity.

Definition at line 197 of file Ideal.cpp.

◆ getGeneratorCount()

size_t Ideal::getGeneratorCount ( ) const
inline

Definition at line 57 of file Ideal.h.

◆ getLcm()

void Ideal::getLcm ( Exponent lcm) const

Sets lcm to the least common multiple of all generators.

If there are no generators then we define the lcm as the identity.

Definition at line 157 of file Ideal.cpp.

◆ getLeastExponents()

void Ideal::getLeastExponents ( Exponent least) const

Definition at line 217 of file Ideal.cpp.

◆ getMostNonGenericExponent()

size_t Ideal::getMostNonGenericExponent ( size_t &  var,
Exponent exp 
)

Sets var and exp such that var^exp is the most non-generic degree.

A unordered pair of generators a and b is non-generic if a and b raise some var to the same non-zero exponent and lcm(a,b) is not strictly divisible by any generator. The most non-generic degree is the exponent that occurs most often as the shared degree for non-generic pairs. In case of ties some deterministic choice is made.

The return value is the number of non-generic pairs that concern the most non-generic degree. If there are no non-generic pairs (i.e. the ideal is generic) then the return value is zero and var=exp=0.

This method is not const since it may re-arrange the generators for efficiency.

Definition at line 271 of file Ideal.cpp.

◆ getMultiple()

Ideal::const_iterator Ideal::getMultiple ( size_t  var) const

Definition at line 668 of file Ideal.cpp.

◆ getNonGenericExponent()

bool Ideal::getNonGenericExponent ( size_t &  var,
Exponent exp 
)

Sets var and exp such that var^exp is some non-generic degree.

Returns true if there are any non-generic degrees and otherwise returns false.

This method is not const since it may re-arrange the generators for efficiency.

Definition at line 378 of file Ideal.cpp.

◆ getSupportCounts()

void Ideal::getSupportCounts ( Exponent counts) const

counts[var] will be the number of generators divisible by var.

Todo:
Make counts a vector<size_t>.

Definition at line 227 of file Ideal.cpp.

◆ getTypicalExponent()

size_t Ideal::getTypicalExponent ( size_t &  var,
Exponent exp 
)

Sets var and exp such that var^exp is the typical non-zero exponent.

The typical exponent is the exponent of a specific variable that occurs most often among the generators. In case of ties some deterministic choice is made. If there are no non-zero generators then var=exp=0 is chosen and the return value is zero. The returned value is the number of times the typical non-zero exponent occurs.

This method is not const since it may re-arrange the generators for efficiency.

Definition at line 236 of file Ideal.cpp.

◆ getTypicalNonGenericExponent()

size_t Ideal::getTypicalNonGenericExponent ( size_t &  var,
Exponent exp 
)

Sets var and exp such that var^exp is the typical non-generic degree.

A unordered pair of generators a and b is non-generic if a and b raise some var to the same non-zero exponent and lcm(a,b) is not strictly divisible by any generator. A degree var^exp is non-generic if it occurs as the shared degree for some non-generic pair. The typical non-generic degree is the non-generic degree that occurs most often among all generators. So it does not matter how non-generic the degree is, just that it is non-generic at all.

The return value is the number of generators that raise var to exp. If there are no non-generic pairs (i.e. the ideal is generic) then the return value is zero and var=exp=0.

This method is not const since it may re-arrange the generators for efficiency.

Definition at line 325 of file Ideal.cpp.

◆ getVarCount()

size_t Ideal::getVarCount ( ) const
inline

Definition at line 56 of file Ideal.h.

◆ insert() [1/3]

void Ideal::insert ( const Exponent term)

Definition at line 455 of file Ideal.cpp.

◆ insert() [2/3]

void Ideal::insert ( const Ideal ideal)

Definition at line 466 of file Ideal.cpp.

◆ insert() [3/3]

void Ideal::insert ( size_t  var,
Exponent  e 
)

Definition at line 473 of file Ideal.cpp.

◆ insertNonMultiples() [1/2]

void Ideal::insertNonMultiples ( const Exponent term,
const Ideal ideal 
)

Definition at line 608 of file Ideal.cpp.

◆ insertNonMultiples() [2/2]

void Ideal::insertNonMultiples ( size_t  var,
Exponent  e,
const Ideal ideal 
)

Definition at line 615 of file Ideal.cpp.

◆ insertReminimize() [1/2]

void Ideal::insertReminimize ( const Exponent term)

Definition at line 484 of file Ideal.cpp.

◆ insertReminimize() [2/2]

void Ideal::insertReminimize ( size_t  var,
Exponent  e 
)

Definition at line 494 of file Ideal.cpp.

◆ isIncomparable()

bool Ideal::isIncomparable ( const Exponent term) const

Definition at line 48 of file Ideal.cpp.

◆ isIrreducible()

bool Ideal::isIrreducible ( ) const

Definition at line 90 of file Ideal.cpp.

◆ isMinimallyGenerated()

bool Ideal::isMinimallyGenerated ( ) const

Definition at line 81 of file Ideal.cpp.

◆ isSquareFree()

bool Ideal::isSquareFree ( ) const

Definition at line 98 of file Ideal.cpp.

◆ isStronglyGeneric()

bool Ideal::isStronglyGeneric ( )

Definition at line 106 of file Ideal.cpp.

◆ isWeaklyGeneric()

bool Ideal::isWeaklyGeneric ( ) const

Definition at line 121 of file Ideal.cpp.

◆ isZeroIdeal()

bool Ideal::isZeroIdeal ( ) const

Definition at line 86 of file Ideal.cpp.

◆ mapExponentsToZeroNoMinimize()

void Ideal::mapExponentsToZeroNoMinimize ( const Term zeroExponents)

Replaces the exponents from zeroExponents with zero and does not remove any non-minimal generators this may produce.

If a generator raises var to precisely the power t, and zeroExponents also raises var to precisely the power t, then that generator is changed to instead raise var to the power zero.

Definition at line 652 of file Ideal.cpp.

◆ minimize()

void Ideal::minimize ( )

Definition at line 501 of file Ideal.cpp.

◆ operator=()

Ideal & Ideal::operator= ( const Ideal ideal)

Definition at line 676 of file Ideal.cpp.

◆ operator==()

bool Ideal::operator== ( const Ideal ideal) const

Rereturns true if *this equals ideal.

This comparison takes non-minimal generators and the order of the generators into account.

Definition at line 424 of file Ideal.cpp.

◆ operator[]() [1/2]

Exponent*& Ideal::operator[] ( size_t  index)
inline

Definition at line 54 of file Ideal.h.

◆ operator[]() [2/2]

const Exponent* Ideal::operator[] ( size_t  index) const
inline

Definition at line 50 of file Ideal.h.

◆ print() [1/2]

void Ideal::print ( FILE *  file) const

Definition at line 440 of file Ideal.cpp.

◆ print() [2/2]

void Ideal::print ( ostream &  out) const

Definition at line 446 of file Ideal.cpp.

◆ product()

void Ideal::product ( const Exponent term)

Definition at line 525 of file Ideal.cpp.

◆ remove()

void Ideal::remove ( const_iterator  it)

Definition at line 576 of file Ideal.cpp.

◆ removeDuplicates()

void Ideal::removeDuplicates ( )

Definition at line 634 of file Ideal.cpp.

◆ removeIf()

template<class Predicate >
bool Ideal::removeIf ( Predicate  pred)
inline

Removes those generators m such that pred(m) evaluates to true.

Returns true if any generators were removed.

Definition at line 321 of file Ideal.h.

◆ removeMultiples() [1/2]

void Ideal::removeMultiples ( const Exponent term)

Definition at line 584 of file Ideal.cpp.

◆ removeMultiples() [2/2]

void Ideal::removeMultiples ( size_t  var,
Exponent  e 
)

Definition at line 596 of file Ideal.cpp.

◆ removeStrictMultiples()

void Ideal::removeStrictMultiples ( const Exponent term)

Definition at line 622 of file Ideal.cpp.

◆ singleDegreeSort()

void Ideal::singleDegreeSort ( size_t  var)

Definition at line 518 of file Ideal.cpp.

◆ sortLex()

void Ideal::sortLex ( )

Definition at line 514 of file Ideal.cpp.

◆ sortReverseLex()

void Ideal::sortReverseLex ( )

Definition at line 510 of file Ideal.cpp.

◆ strictlyContains()

bool Ideal::strictlyContains ( const Exponent term) const

Definition at line 73 of file Ideal.cpp.

◆ swap()

void Ideal::swap ( Ideal ideal)

Definition at line 683 of file Ideal.cpp.

◆ takeRadicalNoMinimize()

void Ideal::takeRadicalNoMinimize ( )

Replaces all generators with their support and does not remove any non-minimal generators this may produce.

Definition at line 660 of file Ideal.cpp.

Member Data Documentation

◆ _allocator

ExponentAllocator Ideal::_allocator
protected

Definition at line 317 of file Ideal.h.

◆ _terms

vector<Exponent*> Ideal::_terms
protected

Definition at line 316 of file Ideal.h.

◆ _varCount

size_t Ideal::_varCount
protected

Definition at line 315 of file Ideal.h.


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