18 #ifndef RAW_SQUARE_FREE_IDEAL_GUARD
19 #define RAW_SQUARE_FREE_IDEAL_GUARD
85 void print(FILE* file)
const;
88 void print(ostream& out)
const;
105 bool insert(
const std::vector<std::string>& term);
108 void colon(
size_t var);
201 void swap(
size_t a,
size_t b);
208 return !(*
this == ideal);
RawSquareFreeIdeal * newRawSquareFreeIdeal(size_t varCount, size_t capacity)
Allocates object with enough memory for capacity generators in varCount variables.
void deleteRawSquareFreeIdeal(RawSquareFreeIdeal *ideal)
Deallocates memory returned by newRawSquareFreeIdeal().
RawSquareFreeIdeal * newRawSquareFreeIdealParse(const char *str)
Allocates and returns an ideal based on str.
ostream & operator<<(ostream &out, const RawSquareFreeIdeal &ideal)
Represents a monomial ideal with int exponents.
const_iterator doesn't have all it needs to be a proper STL iterator.
const_iterator operator--()
bool operator!=(const const_iterator &it) const
bool operator==(const const_iterator &it) const
ptrdiff_t operator-(const const_iterator &it) const
const Word * operator*() const
const_iterator(const Word *term, size_t wordsPerTerm)
const_iterator operator++()
const size_t _wordsPerTerm
const_iterator operator+(ptrdiff_t i) const
const_iterator & operator=(const const_iterator &it)
iterator doesn't have all it needs to be a proper STL iterator.
iterator(Word *term, size_t wordsPerTerm)
ptrdiff_t operator-(const iterator &it) const
iterator & operator=(const iterator &it)
bool operator!=(const iterator &it) const
iterator operator+(ptrdiff_t i) const
const size_t _wordsPerTerm
bool operator==(const iterator &it) const
A bit packed square free ideal placed in a pre-allocated buffer.
void sortLexAscending()
Sorts the generators in ascending lex order.
static RawSquareFreeIdeal * construct(void *buffer, size_t varCount=0)
size_t getNotRelativelyPrime(const Word *term)
Returns the index of the first generator that is not relatively prime with term.
bool isValid() const
Returns true if the internal invariants of ideal are satisfied.
bool hasFullSupport(const Word *ignore) const
Returns true if for every variable it either divides ignore or it divides some (not necessarily minim...
void getGcdOfMultiples(Word *gcd, size_t var) const
Sets gcd to be the greatest common denominator of those generators that are divisible by var.
RawSquareFreeIdeal & operator=(const RawSquareFreeIdeal &ideal)
Resets this object to be a copy of ideal.
bool operator==(const RawSquareFreeIdeal &ideal) const
Returns true if *this equals ideal.
void colon(const Word *by)
size_t getExclusiveVarGenerator()
Returns the index of a generator that is the only one to be divisible by some variable.
void getLcm(Word *lcm) const
Puts the least common multiple of the generators of the ideal into lcm.
size_t getMinSupportGen() const
Returns the index of a generator with minimum support.
void getVarDividesCounts(vector< size_t > &counts) const
Sets counts[var] to the number of generators that var divides.
void compact(const Word *remove)
Removes the variables that divide remove.
void removeGenerator(size_t index)
Removes the generator at index.
void print(FILE *file) const
Print a debug-suitable representation of this object to file.
static size_t getBytesOfMemoryFor(size_t varCount, size_t generatorCount)
Returns the number of bytes of memory necessary to contain an ideal with the given parameters.
size_t getMaxSupportGen() const
Returns the index of a generator with maximum support.
size_t getVarCount() const
Word * getGenerator(size_t index)
Returns the generator at index.
bool operator!=(const RawSquareFreeIdeal &ideal) const
void colonReminimize(const Word *colon)
Performs a colon and minimize.
size_t getNonMultiple(size_t var) const
Returns the index of the first generator that var does not divide or getGeneratorCount() if no such g...
Word * getGeneratorUnsafe(size_t index)
Returns a pointer to the memory where a generator at index would be, even if index is equal to or gre...
const_iterator end() const
const_iterator begin() const
size_t getMultiple(size_t var) const
Returns the index of the first generator that var divides or getGeneratorCount() if no such generator...
size_t getGeneratorCount() const
size_t insert(const Ideal &ideal)
Inserts the generators of ideal from index 0 onward until reaching a non-squarefree generator or all ...
void transpose(Word *eraseVars=0)
Equivalent to setToTransposeOf(this, eraseVars).
void swap01Exponents()
Change 0 exponents into 1 and vice versa.
void swap(size_t a, size_t b)
void setToTransposeOf(const RawSquareFreeIdeal &ideal, Word *eraseVars=0)
Resets this object to the transpose of ideal.
const Word * back() const
RawSquareFreeIdeal(const RawSquareFreeIdeal &)
bool isMinimallyGenerated() const
Returns true if no generator divides another.
void getLcmOfNonMultiples(Word *lcm, size_t var) const
Sets lcm to be the least common multple of those generators that var does not divide.
void insertNonMultiples(const Word *term, const RawSquareFreeIdeal &ideal)
Insert those generators of ideal that are not multiples of term.
size_t getWordsPerTerm() const
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)
void gcd(Word *res, const Word *resEnd, const Word *a, const Word *b)
unsigned long Word
The native unsigned type for the CPU.