Frobby 0.10.0
Loading...
Searching...
No Matches
HilbertIndependenceConsumer.h
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2007 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 HILBERT_INDEPENDENCE_CONSUMER
18#define HILBERT_INDEPENDENCE_CONSUMER
19
20#include "Projection.h"
21#include "Term.h"
22#include "Ideal.h"
23#include "CoefTermConsumer.h"
24#include "Task.h"
25
26#include <vector>
27
29class HilbertStrategy;
30
31class HilbertIndependenceConsumer : public CoefTermConsumer, public Task {
32public:
33 HilbertIndependenceConsumer(HilbertStrategy* strategy);
34
35 void reset(CoefTermConsumer* parent,
36 IndependenceSplitter& splitter,
37 size_t varCount);
38
39 void clear();
40
41 virtual void run(TaskEngine& engine);
42 virtual void dispose();
43
44 CoefTermConsumer* getLeftConsumer();
45
46 virtual void consumeRing(const VarNames& names); // Does nothing.
47 virtual void beginConsuming(); // Does nothing.
48 virtual void consume(const mpz_class& coef, const Term& term);
49 virtual void doneConsuming(); // Does nothing.
50
51 CoefTermConsumer* getRightConsumer();
52
53 const Projection& getLeftProjection() const;
54
55 const Projection& getRightProjection() const;
56
57private:
58 class RightConsumer : public CoefTermConsumer {
59 public:
60 RightConsumer(HilbertIndependenceConsumer* parent);
61
62 virtual void consumeRing(const VarNames& names); // Does nothing.
63 virtual void beginConsuming(); // Does nothing.
64 virtual void consume(const mpz_class& coef, const Term& term);
65 virtual void doneConsuming(); // Does nothing.
66
67 private:
68 HilbertIndependenceConsumer* _parent;
69 };
70
71 virtual void consumeLeft(const mpz_class& leftCoef, const Term& leftTerm);
72
73 virtual void consumeRight(const mpz_class& coef, const Term& term);
74
75 Term _tmpTerm;
76 mpz_class _tmpCoef;
77
78 CoefTermConsumer* _parent;
79 Projection _leftProjection;
80 Projection _rightProjection;
81
82 Ideal _rightTerms;
83 vector<mpz_class> _rightCoefs;
84
85 RightConsumer _rightConsumer;
86
87 HilbertStrategy* _strategy;
88};
89
90#endif
Definition CoefTermConsumer.h:24
virtual void run(TaskEngine &engine)
Definition HilbertIndependenceConsumer.cpp:56
virtual void dispose()
Definition HilbertIndependenceConsumer.cpp:51
Definition HilbertStrategy.h:33
Represents a monomial ideal with int exponents.
Definition Ideal.h:27
Definition IndependenceSplitter.h:29
Definition Projection.h:29
Definition TaskEngine.h:40
Definition Task.h:27
Definition Term.h:49
Definition VarNames.h:38