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