EulerState.h
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2011 Bjarke Hammersholt Roune (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#ifndef EULER_STATE_GUARD
#define EULER_STATE_GUARD
#include "RawSquareFreeIdeal.h"
class Ideal;
class Arena;
class EulerState {
public:
static EulerState* construct(const Ideal& idealParam, Arena* arena);
static EulerState* construct
(const RawSquareFreeIdeal& idealParam, Arena* arena);
EulerState* inPlaceStdSplit(size_t pivotVar);
EulerState* inPlaceStdSplit(Word* pivot);
EulerState* inPlaceGenSplit(size_t pivotIndex);
bool toColonSubState(const Word* pivot);
bool toColonSubState(size_t pivotVar);
void toColonSubStateNoReminimizeNecessary(size_t pivotVar);
void toColonSubStateNoReminimizeNecessary(Word* pivot);
EulerState* makeSumSubState(size_t pivotVar);
EulerState* makeSumSubState(Word* pivot);
void flipSign() {sign = -sign;}
int getSign() const {return sign;}
void transpose();
EulerState* getParent() {return _parent;}
RawSquareFreeIdeal& getIdeal() {return *ideal;}
const RawSquareFreeIdeal& getIdeal() const {return *ideal;}
const Word* getEliminatedVars() const {return eliminated;}
size_t getVarCount() const {return getIdeal().getVarCount();}
size_t getNonEliminatedVarCount() const;
void removeGenerator(size_t index) {ideal->removeGenerator(index);}
void compactEliminatedVariablesIfProfitable();
void print(FILE* out);
#ifdef DEBUG
bool debugIsValid() const;
#endif
private:
EulerState(const EulerState&); // unavailable
static EulerState* rawConstruct(size_t varCount, size_t capacity,
Arena* arena);
void toZero();
void allocateIdealAndEliminated(size_t varCount, size_t capacity);
void deallocate();
RawSquareFreeIdeal* ideal;
Word* eliminated;
int sign;
Arena* _alloc;
EulerState* _parent;
};
#endif
RawSquareFreeIdeal.h
Arena
This is an arena allocator.
Definition Arena.h:53
EulerState::removeGenerator
void removeGenerator(size_t index)
Definition EulerState.h:55
EulerState::rawConstruct
static EulerState * rawConstruct(size_t varCount, size_t capacity, Arena *arena)
Definition EulerState.cpp:57
EulerState::makeSumSubState
EulerState * makeSumSubState(size_t pivotVar)
Definition EulerState.cpp:158
EulerState::inPlaceGenSplit
EulerState * inPlaceGenSplit(size_t pivotIndex)
Definition EulerState.cpp:95
EulerState::flipSign
void flipSign()
Definition EulerState.h:43
EulerState::toColonSubStateNoReminimizeNecessary
void toColonSubStateNoReminimizeNecessary(size_t pivotVar)
Definition EulerState.cpp:140
EulerState::eliminated
Word * eliminated
Definition EulerState.h:77
EulerState::compactEliminatedVariablesIfProfitable
void compactEliminatedVariablesIfProfitable()
Definition EulerState.cpp:196
EulerState::deallocate
void deallocate()
EulerState::toZero
void toZero()
Definition EulerState.cpp:233
EulerState::getIdeal
RawSquareFreeIdeal & getIdeal()
Definition EulerState.h:49
EulerState::toColonSubState
bool toColonSubState(const Word *pivot)
Definition EulerState.cpp:118
EulerState::getSign
int getSign() const
Definition EulerState.h:44
EulerState::construct
static EulerState * construct(const Ideal &idealParam, Arena *arena)
Definition EulerState.cpp:28
EulerState::getIdeal
const RawSquareFreeIdeal & getIdeal() const
Definition EulerState.h:50
EulerState::ideal
RawSquareFreeIdeal * ideal
Definition EulerState.h:76
EulerState::_alloc
Arena * _alloc
Definition EulerState.h:79
EulerState::transpose
void transpose()
Definition EulerState.cpp:190
EulerState::getVarCount
size_t getVarCount() const
Definition EulerState.h:52
EulerState::inPlaceStdSplit
EulerState * inPlaceStdSplit(size_t pivotVar)
Definition EulerState.cpp:81
EulerState::print
void print(FILE *out)
Definition EulerState.cpp:206
EulerState::getEliminatedVars
const Word * getEliminatedVars() const
Definition EulerState.h:51
EulerState::_parent
EulerState * _parent
Definition EulerState.h:80
EulerState::getParent
EulerState * getParent()
Definition EulerState.h:48
EulerState::sign
int sign
Definition EulerState.h:78
EulerState::EulerState
EulerState(const EulerState &)
EulerState::allocateIdealAndEliminated
void allocateIdealAndEliminated(size_t varCount, size_t capacity)
EulerState::getNonEliminatedVarCount
size_t getNonEliminatedVarCount() const
Definition EulerState.cpp:240
Ideal
Represents a monomial ideal with int exponents.
Definition Ideal.h:27
RawSquareFreeIdeal
A bit packed square free ideal placed in a pre-allocated buffer.
Definition RawSquareFreeIdeal.h:37
RawSquareFreeIdeal::getVarCount
size_t getVarCount() const
Definition RawSquareFreeIdeal.h:125
Word
unsigned long Word
The native unsigned type for the CPU.
Definition stdinc.h:93