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 =
EulerState * makeSumSubState(size_t pivotVar)
bool toColonSubState(const Word *pivot)
void print(FILE *file) const
Print a debug-suitable representation of this object to file.
EulerState * inPlaceStdSplit(size_t pivotVar)
void lcmInPlace(Word *res, const Word *resEnd, const Word *a)
void colonReminimize(const Word *colon)
Performs a colon and minimize.
RawSquareFreeIdeal * ideal
void compactEliminatedVariablesIfProfitable()
size_t getNonEliminatedVarCount() const
Word * getGenerator(size_t index)
Returns the generator at index.
Represents a monomial ideal with int exponents.
void transpose(Word *eraseVars=0)
Equivalent to setToTransposeOf(this, eraseVars).
void setToIdentity(Word *res, const Word *resEnd)
size_t getNotRelativelyPrime(const Word *term)
Returns the index of the first generator that is not relatively prime with term.
void removeGenerator(size_t index)
A bit packed square free ideal placed in a pre-allocated buffer.
size_t getVarCount() const
void setExponent(Word *a, size_t var, bool value)
void compact(const Word *remove)
Removes the variables that divide remove.
pair< T *, T * > allocArrayNoCon(size_t elementCount)
As alloc(elementCount * sizeof(T)).
unsigned long Word
The native unsigned type for the CPU.
size_t getVarCount() const
void print(FILE *out, const ColumnPrinter &pr)
static RawSquareFreeIdeal * construct(void *buffer, size_t varCount=0)
This is an arena allocator.
static EulerState * construct(const Ideal &idealParam, Arena *arena)
void * alloc(size_t size)
Returns a pointer to a buffer of size bytes.
bool getExponent(const Word *a, size_t var)
returns true if var divides a and false otherwise.
size_t getWordCount(size_t varCount)
static EulerState * rawConstruct(size_t varCount, size_t capacity, Arena *arena)
size_t getGeneratorCount() const
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...
bool isMinimallyGenerated() const
Returns true if no generator divides another.
size_t getVarCount() const
const Word * getEliminatedVars() const
bool isRelativelyPrime(const Word *a, const Word *b, size_t varCount)
void toColonSubStateNoReminimizeNecessary(size_t pivotVar)
size_t getSizeOfSupport(const Word *a, size_t varCount)
size_t getGeneratorCount() const
void assign(Word *a, const Word *b, size_t varCount)
size_t insert(const Ideal &ideal)
Inserts the generators of ideal from index 0 onward until reaching a non-squarefree generator or all ...
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...
EulerState * inPlaceGenSplit(size_t pivotIndex)
void colon(const Word *by)
RawSquareFreeIdeal & getIdeal()