Frobby 0.10.0
Loading...
Searching...
No Matches
EulerState.h
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
22class Ideal;
23class Arena;
24
25class EulerState {
26public:
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);
32 EulerState* inPlaceStdSplit(Word* pivot);
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);
38 void toColonSubStateNoReminimizeNecessary(Word* pivot);
39
40 EulerState* makeSumSubState(size_t pivotVar);
41 EulerState* makeSumSubState(Word* pivot);
42
43 void flipSign() {sign = -sign;}
44 int getSign() const {return sign;}
45
46 void transpose();
47
48 EulerState* getParent() {return _parent;}
49 RawSquareFreeIdeal& getIdeal() {return *ideal;}
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
57 void compactEliminatedVariablesIfProfitable();
58
59 void print(FILE* out);
60
61#ifdef DEBUG
62 bool debugIsValid() const;
63#endif
64
65private:
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
76 RawSquareFreeIdeal* ideal;
77 Word* eliminated;
78 int sign;
79 Arena* _alloc;
80 EulerState* _parent;
81};
82
83#endif
Definition Arena.h:53
Represents a monomial ideal with int exponents.
Definition Ideal.h:27
Definition RawSquareFreeIdeal.h:37
unsigned long Word
Definition stdinc.h:60