18 #ifndef RAW_SQUARE_FREE_TERM_GUARD
19 #define RAW_SQUARE_FREE_TERM_GUARD
46 const Word* remove,
size_t varCount);
85 bool encodeTerm(
Word* encoded,
const std::vector<mpz_class>& term,
const size_t varCount);
86 bool encodeTerm(
Word* encoded,
const std::vector<std::string>& it,
const size_t varCount);
145 for (; a != aEnd; ++a, ++b)
146 if ((*a & (~*b)) != 0)
154 return word & bitMask;
166 for (; a != aEnd; ++a, ++b)
173 const Word setBit = ((
Word)1) << bitOffset;
174 const Word valueBit = ((
Word)value) << bitOffset;
175 word = (word & (~setBit)) | valueBit;
179 for (; a != aEnd; ++a, ++b)
191 const Word fullSupportWord = (((
Word)1) << varCount) - 1;
192 return *a == fullSupportWord;
196 for (; a != aEnd; ++a, ++b)
202 void print(FILE* file,
const Word* term,
size_t varCount);
203 void print(ostream& out,
const Word* term,
size_t varCount);
size_t getWordOffset(size_t var)
void setExponent(Word *a, size_t var, bool value)
Word * newTerm(size_t varCount)
Returns identity term of varCount variables.
bool isValid(const Word *a, size_t varCount)
The unused bits at the end of the last word must be zero for the functions here to work correctly.
size_t getWordCount(size_t varCount)
void colon(Word *res, const Word *resEnd, const Word *a, const Word *b)
size_t getBitOffset(size_t var)
bool encodeTerm(Word *encoded, const Exponent *term, const size_t varCount)
Assigns the RawSquareFreeTerm-encoded form of term to encoded and returns true if term is square free...
void swap(Word *a, Word *aEnd, Word *b)
size_t getVarIfPure(const Word *const a, size_t varCount)
Returns var if a equals var.
Word * newTermParse(const char *strParam)
Allocates and returns a term based on str.
void invert(Word *a, size_t varCount)
Make 0 exponents 1 and make 1 exponents 0.
void decrementAtSupport(const Word *a, size_t *inc, size_t varCount)
For every variable var that divides a, decrement inc[var] by one.
bool lexLess(const Word *a, const Word *b, size_t varCount)
bool isIdentity(const Word *a, Word *aEnd)
bool hasFullSupport(const Word *a, size_t varCount)
void toZeroAtSupport(const Word *a, size_t *inc, size_t varCount)
For every variable var that divides a, set inc[var] to zero.
size_t getSizeOfSupport(const Word *a, size_t varCount)
void colonInPlace(Word *res, const Word *resEnd, const Word *b)
void lcmInPlace(Word *res, const Word *resEnd, const Word *a)
bool getExponent(const Word *a, size_t var)
returns true if var divides a and false otherwise.
void print(FILE *file, const Word *term, size_t varCount)
void compact(Word *compacted, const Word *term, const Word *remove, size_t varCount)
For every variable var that divides remove, remove the space for that variable in term and put the re...
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)
void setToAllVarProd(Word *res, size_t varCount)
Sets all exponents of res to 1.
bool equals(const Word *a, const Word *b, size_t varCount)
Returns true if a equals b.
bool divides(const Word *a, const Word *aEnd, const Word *b)
Returns true if a divides b.
void swap(Word *a, Word *b, size_t varCount)
void deleteTerm(Word *term)
Deletes term previously returned by newTerm().
void gcdInPlace(Word *res, const Word *resEnd, const Word *a)
void assign(Word *a, const Word *b, size_t varCount)
bool isRelativelyPrime(const Word *a, const Word *b, size_t varCount)
void gcd(Word *res, const Word *resEnd, const Word *a, const Word *b)
void setToIdentity(Word *res, const Word *resEnd)
static const size_t BitsPerWord
unsigned long Word
The native unsigned type for the CPU.