Frobby 0.10.0
Loading...
Searching...
No Matches
MsmSlice.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 MSM_SLICE_GUARD
18#define MSM_SLICE_GUARD
19
20#include "Slice.h"
21#include "Term.h"
22#include "Ideal.h"
23
24class TermConsumer;
25class Projection;
26class MsmStrategy;
27
33class MsmSlice : public Slice {
34 public:
35 MsmSlice(MsmStrategy& strategy);
36 MsmSlice(MsmStrategy& strategy,
37 const Ideal& ideal,
38 const Ideal& subtract,
39 const Term& multiply,
40 TermConsumer* consumer);
41
42 TermConsumer* getConsumer() {return _consumer;}
43
44 // *** Mutators
45
46 // A base case is reached if not all variables divide the lcm of
47 // getIdeal(), or if getGeneratorCount() is 2, or if getIdeal() is
48 // square free.
49 virtual bool baseCase(bool simplified);
50
51 virtual Slice& operator=(const Slice& slice);
52
53 virtual bool simplifyStep();
54
55 void setToProjOf(const MsmSlice& slice,
56 const Projection& projection,
57 TermConsumer* consumer);
58
59 // Efficiently swaps the values of *this and slice.
60 void swap(MsmSlice& slice);
61
62 virtual bool innerSlice(const Term& pivot);
63 virtual void outerSlice(const Term& pivot);
64
65 private:
66 // Removes those generators g of getIdeal() such that g[i] equals
67 // getLcm()[i] for two distinct i. This is done iteratively until no
68 // more generators can be removed in this way. Returns true if any
69 // generators were removed.
70 bool removeDoubleLcm();
71
72 // Calculates the gcd of those generators of getIdeal() that are
73 // divisible by var. This gcd is then divided by var to yield a
74 // lower bound on the content of the slice. Returns false if a base
75 // case is detected. The real functionality is slight more
76 // sophisticated.
77 virtual bool getLowerBound(Term& bound, size_t var) const;
78
79 // Outputs the content of the slice to consumer. It is a
80 // precondition that the slice is fully simplified and that
81 // getVarCount() returns 2.
82 void twoVarBaseCase();
83
84 // Outputs the content of the slice to consumer. It is a
85 // precondition that the slice is fully simplified and that
86 // getVarCount() plus one equals
87 // getIdeal().getGeneratorCount(). This will, due to simplification,
88 // be true if there is exactly one generator that is nowhere equal
89 // to the lcm of getIdeal().
90 void oneMoreGeneratorBaseCase();
91
92 // Outputs the content of the slice to consumer or returns false. It
93 // is a precondition that the slice is fully simplified. Returns
94 // true if there are exactly two generators that are nowhere equal
95 // to the lcm of getIdeal().
96 bool twoNonMaxBaseCase();
97
98 TermConsumer* _consumer;
99};
100
101inline void swap(MsmSlice& a, MsmSlice& b) { a.swap(b); }
102
103
104#endif
Represents a monomial ideal with int exponents.
Definition Ideal.h:27
Definition MsmSlice.h:33
virtual bool baseCase(bool simplified)
Definition MsmSlice.cpp:40
virtual Slice & operator=(const Slice &slice)
Definition MsmSlice.cpp:114
virtual void outerSlice(const Term &pivot)
Definition MsmSlice.cpp:155
virtual bool simplifyStep()
Definition MsmSlice.cpp:122
virtual bool innerSlice(const Term &pivot)
Definition MsmSlice.cpp:143
Definition MsmStrategy.h:37
Definition Projection.h:29
Slice(SliceStrategy &strategy)
Definition Slice.cpp:26
Definition TermConsumer.h:36
Definition Term.h:49