37 ASSERT(state->debugIsValid());
52 ASSERT(state->debugIsValid());
61 size_t bytesIdeal = std::max(
64 size_t wordsElim = std::max(
66 if (bytesIdeal == 0 || wordsElim == 0)
114 ASSERT(subState->debugIsValid());
170 ASSERT(subState->debugIsValid());
186 ASSERT(subState->debugIsValid());
207 fputs(
"** an Euler characteristic algorithm state:\n", out);
208 fprintf(out,
"State sign: %s\n",
sign == 1 ?
"+1" :
"-1");
209 fputs(
"Eliminated: ", out);
216 bool EulerState::debugIsValid()
const {
241 const size_t eliminatedVarCount =
void print(FILE *out, const ColumnPrinter &pr)
This is an arena allocator.
void * alloc(size_t size)
Returns a pointer to a buffer of size bytes.
pair< T *, T * > allocArrayNoCon(size_t elementCount)
As alloc(elementCount * sizeof(T)).
void removeGenerator(size_t index)
static EulerState * rawConstruct(size_t varCount, size_t capacity, Arena *arena)
EulerState * makeSumSubState(size_t pivotVar)
EulerState * inPlaceGenSplit(size_t pivotIndex)
void toColonSubStateNoReminimizeNecessary(size_t pivotVar)
void compactEliminatedVariablesIfProfitable()
bool toColonSubState(const Word *pivot)
static EulerState * construct(const Ideal &idealParam, Arena *arena)
const Word * getEliminatedVars() const
RawSquareFreeIdeal * ideal
size_t getVarCount() const
RawSquareFreeIdeal & getIdeal()
EulerState * inPlaceStdSplit(size_t pivotVar)
size_t getNonEliminatedVarCount() const
Represents a monomial ideal with int exponents.
size_t getGeneratorCount() const
size_t getVarCount() const
A bit packed square free ideal placed in a pre-allocated buffer.
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.
void colon(const Word *by)
void compact(const Word *remove)
Removes the variables that divide remove.
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 getVarCount() const
Word * getGenerator(size_t index)
Returns the generator at index.
void colonReminimize(const Word *colon)
Performs a colon and minimize.
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).
bool isMinimallyGenerated() const
Returns true if no generator divides another.
void insertNonMultiples(const Word *term, const RawSquareFreeIdeal &ideal)
Insert those generators of ideal that are not multiples of term.
void setExponent(Word *a, size_t var, bool value)
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)
size_t getSizeOfSupport(const Word *a, size_t varCount)
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 assign(Word *a, const Word *b, size_t varCount)
bool isRelativelyPrime(const Word *a, const Word *b, size_t varCount)
void setToIdentity(Word *res, const Word *resEnd)
unsigned long Word
The native unsigned type for the CPU.