Frobby  0.9.5
EulerState.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2011 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #ifndef EULER_STATE_GUARD
18 #define EULER_STATE_GUARD
19 
20 #include "RawSquareFreeIdeal.h"
21 
22 class Ideal;
23 class Arena;
24 
25 class EulerState {
26 public:
27  static EulerState* construct(const Ideal& idealParam, Arena* arena);
28  static EulerState* construct
29  (const RawSquareFreeIdeal& idealParam, Arena* arena);
30 
31  EulerState* inPlaceStdSplit(size_t pivotVar);
33  EulerState* inPlaceGenSplit(size_t pivotIndex);
34 
35  bool toColonSubState(const Word* pivot);
36  bool toColonSubState(size_t pivotVar);
37  void toColonSubStateNoReminimizeNecessary(size_t pivotVar);
39 
40  EulerState* makeSumSubState(size_t pivotVar);
42 
43  void flipSign() {sign = -sign;}
44  int getSign() const {return sign;}
45 
46  void transpose();
47 
50  const RawSquareFreeIdeal& getIdeal() const {return *ideal;}
51  const Word* getEliminatedVars() const {return eliminated;}
52  size_t getVarCount() const {return getIdeal().getVarCount();}
53  size_t getNonEliminatedVarCount() const;
54 
55  void removeGenerator(size_t index) {ideal->removeGenerator(index);}
56 
58 
59  void print(FILE* out);
60 
61 #ifdef DEBUG
62  bool debugIsValid() const;
63 #endif
64 
65 private:
66  EulerState(const EulerState&); // unavailable
67  static EulerState* rawConstruct(size_t varCount, size_t capacity,
68  Arena* arena);
69 
70  void toZero();
71 
72  void allocateIdealAndEliminated(size_t varCount, size_t capacity);
73 
74  void deallocate();
75 
78  int sign;
81 };
82 
83 #endif
This is an arena allocator.
Definition: Arena.h:53
void removeGenerator(size_t index)
Definition: EulerState.h:55
static EulerState * rawConstruct(size_t varCount, size_t capacity, Arena *arena)
Definition: EulerState.cpp:57
EulerState * makeSumSubState(size_t pivotVar)
Definition: EulerState.cpp:158
EulerState * inPlaceGenSplit(size_t pivotIndex)
Definition: EulerState.cpp:95
void flipSign()
Definition: EulerState.h:43
void toColonSubStateNoReminimizeNecessary(size_t pivotVar)
Definition: EulerState.cpp:140
Word * eliminated
Definition: EulerState.h:77
void compactEliminatedVariablesIfProfitable()
Definition: EulerState.cpp:196
void deallocate()
const RawSquareFreeIdeal & getIdeal() const
Definition: EulerState.h:50
void toZero()
Definition: EulerState.cpp:233
bool toColonSubState(const Word *pivot)
Definition: EulerState.cpp:118
int getSign() const
Definition: EulerState.h:44
static EulerState * construct(const Ideal &idealParam, Arena *arena)
Definition: EulerState.cpp:28
const Word * getEliminatedVars() const
Definition: EulerState.h:51
RawSquareFreeIdeal * ideal
Definition: EulerState.h:76
Arena * _alloc
Definition: EulerState.h:79
EulerState * getParent()
Definition: EulerState.h:48
void transpose()
Definition: EulerState.cpp:190
size_t getVarCount() const
Definition: EulerState.h:52
RawSquareFreeIdeal & getIdeal()
Definition: EulerState.h:49
EulerState * inPlaceStdSplit(size_t pivotVar)
Definition: EulerState.cpp:81
void print(FILE *out)
Definition: EulerState.cpp:206
EulerState * _parent
Definition: EulerState.h:80
EulerState(const EulerState &)
void allocateIdealAndEliminated(size_t varCount, size_t capacity)
size_t getNonEliminatedVarCount() const
Definition: EulerState.cpp:240
Represents a monomial ideal with int exponents.
Definition: Ideal.h:27
A bit packed square free ideal placed in a pre-allocated buffer.
void removeGenerator(size_t index)
Removes the generator at index.
size_t getVarCount() const
unsigned long Word
The native unsigned type for the CPU.
Definition: stdinc.h:93