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