Frobby 0.9.5
BigattiState.cpp
Go to the documentation of this file.
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2009 University of Aarhus
3 Contact Bjarke Hammersholt Roune for license information (www.broune.com)
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see http://www.gnu.org/licenses/.
17*/
18#include "stdinc.h"
19#include "BigattiState.h"
20
22#include <sstream>
23
25 const Ideal& ideal, const Term& multiply):
26 _algorithm(algorithm),
27 _ideal(ideal),
28 _multiply(multiply) {
29 ASSERT(_algorithm != 0);
31}
32
34 return _ideal;
35}
36
38 return _multiply;
39}
40
44
48
53
55 ASSERT(var < getVarCount());
56
60 while ((*begin)[var] == 0) {
61 ++begin;
62 ASSERT(begin != end);
63 }
64
65 // This picks the lower median in case of a tie.
66 Exponent median = (*(begin + (distance(begin, end) - 1) / 2))[var];
67 ASSERT(median > 0);
68 return median;
69}
70
72 return _ideal.getTypicalExponent(var, exp);
73}
74
78
84
86 ASSERT(pivot.getVarCount() == getVarCount());
88}
89
93
97
99 ostringstream str;
100 print(str);
101 fputs(str.str().c_str(), out);
102}
103
105 out << "BigattiState(multiply: " << _multiply << "\n"
106 << _ideal << ")\n";
107}
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
Exponent median(const Exponent *a, size_t varCount)
Returns the lower median exponent of a.
Definition TermExtra.cpp:25
void freeState(auto_ptr< BigattiState > state)
void processState(auto_ptr< BigattiState > state)
void colonStep(const Term &term)
size_t getTypicalExponent(size_t &var, Exponent &exp)
virtual void run(TaskEngine &tasks)
Does whatever work this task represents.
const Term & getMultiply() const
BigattiHilbertAlgorithm * _algorithm
size_t getVarCount() const
void addStep(const Term &term)
BigattiState(BigattiHilbertAlgorithm *algorithm, const Ideal &ideal, const Term &_multiply)
const Ideal & getIdeal() const
virtual void dispose()
Called when the task is no longer used but run has not and will not be called.
Exponent getMedianPositiveExponentOf(size_t var)
void singleDegreeSort(size_t var)
void print(FILE *out)
Represents a monomial ideal with int exponents.
Definition Ideal.h:27
void singleDegreeSort(size_t var)
Definition Ideal.cpp:518
Cont::const_iterator const_iterator
Definition Ideal.h:43
size_t getTypicalExponent(size_t &var, Exponent &exp)
Sets var and exp such that var^exp is the typical non-zero exponent.
Definition Ideal.cpp:237
void insertReminimize(const Exponent *term)
Definition Ideal.cpp:484
const_iterator end() const
Definition Ideal.h:49
const_iterator begin() const
Definition Ideal.h:48
bool colonReminimize(const Exponent *colon)
Definition Ideal.cpp:550
size_t getVarCount() const
Definition Ideal.h:56
TaskEngine handles a list of tasks that are to be carried out.
Definition TaskEngine.h:40
Term represents a product of variables which does not include a coefficient.
Definition Term.h:49
static void product(Exponent *res, const Exponent *a, const Exponent *b, size_t varCount)
Sets res equal to the product of a and b.
Definition Term.h:280
size_t getVarCount() const
Definition Term.h:85
unsigned int Exponent
Definition stdinc.h:89
#define ASSERT(X)
Definition stdinc.h:86