Frobby 0.9.5
MsmSlice.h
Go to the documentation of this file.
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
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().
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
99};
100
101inline void swap(MsmSlice& a, MsmSlice& b) { a.swap(b); }
102
103
104#endif
void swap(MsmSlice &a, MsmSlice &b)
Definition: MsmSlice.h:101
Represents a monomial ideal with int exponents.
Definition: Ideal.h:27
Invariant: either the slice is a trivial base case, or removeDoubleLcm returns false.
Definition: MsmSlice.h:33
virtual bool getLowerBound(Term &bound, size_t var) const
Calculates a lower bound that depends on var.
Definition: MsmSlice.cpp:213
MsmSlice(MsmStrategy &strategy)
Definition: MsmSlice.cpp:23
TermConsumer * _consumer
Definition: MsmSlice.h:98
void twoVarBaseCase()
Definition: MsmSlice.cpp:244
virtual bool baseCase(bool simplified)
Returns true if this slice is a base case slice, and in that case produces output in a derivative-spe...
Definition: MsmSlice.cpp:40
void setToProjOf(const MsmSlice &slice, const Projection &projection, TermConsumer *consumer)
Definition: MsmSlice.cpp:134
virtual Slice & operator=(const Slice &slice)
Performs a deep copy of slice into this object.
Definition: MsmSlice.cpp:114
bool removeDoubleLcm()
Definition: MsmSlice.cpp:195
virtual void outerSlice(const Term &pivot)
Sets this object to the outer slice according to pivot.
Definition: MsmSlice.cpp:155
void oneMoreGeneratorBaseCase()
Definition: MsmSlice.cpp:280
virtual bool simplifyStep()
Like simplify(), except that only one simplification step is performed.
Definition: MsmSlice.cpp:122
void swap(MsmSlice &slice)
Definition: MsmSlice.cpp:165
bool twoNonMaxBaseCase()
Definition: MsmSlice.cpp:343
TermConsumer * getConsumer()
Definition: MsmSlice.h:42
virtual bool innerSlice(const Term &pivot)
Sets this object to the inner slice according to pivot.
Definition: MsmSlice.cpp:143
This class represents a slice, which is the central data structure of the Slice Algorithm.
Definition: Slice.h:77
This class is used to transfer terms one at a time from one part of the program to another,...
Definition: TermConsumer.h:36
Term represents a product of variables which does not include a coefficient.
Definition: Term.h:49