Go to the documentation of this file.
38 const Ideal& initialSubtract):
41 _initialSubtract(new
Ideal(initialSubtract)) {
54 Term sliceMultiply(varCount);
55 for (
size_t var = 0; var < varCount; ++var)
56 sliceMultiply[var] = 1;
91 return auto_ptr<MsmSlice>(
static_cast<MsmSlice*
>(slice.release()));
95 return auto_ptr<Slice>(
new MsmSlice(*
this));
105 ASSERT(sliceParam.get() != 0);
107 auto_ptr<MsmSlice> slice
108 (
static_cast<MsmSlice*
>(sliceParam.release()));
110 ASSERT(!slice->adjustMultiply());
111 ASSERT(!slice->normalize());
115 Term term(slice->getVarCount());
117 const Term&
lcm = slice->getLcm();
121 bool hasTwoLabels =
false;
124 if ((*it)[var] == 1) {
128 bool couldBeLabel = !slice->getSubtract().contains(term);
130 for (
size_t v = 0; v < slice->getVarCount(); ++v) {
131 if (term[v] ==
lcm[v]) {
132 couldBeLabel =
false;
149 auto_ptr<Slice> hasLabelSlice;
156 *hasLabelSlice = *slice;
157 hasLabelSlice->innerSlice(term);
160 slice->outerSlice(term);
166 slice->innerSlice(term);
169 if (hasLabelSlice.get() != 0) {
260 ASSERT(sliceParam.get() != 0);
262 auto_ptr<MsmSlice> slice
263 (
static_cast<MsmSlice*
>(sliceParam.release()));
267 autoSplit->reset(slice->getConsumer(),
_indep);
272 auto_ptr<MsmSlice> leftSlice(
new MsmSlice(*
this));
277 auto_ptr<MsmSlice> rightSlice(
new MsmSlice(*
this));
const SplitStrategy * _split
void inverseProject(Term &to, const Exponent *from) const
void getBigProjection(Projection &projection) const
Cont::const_iterator const_iterator
auto_ptr< Slice > newSlice()
Returns a slice from the cache that freeSlice adds to, or allocate a new one using allocateSlice.
const_iterator begin() const
auto_ptr< Ideal > _initialSubtract
auto_ptr< MsmSlice > newMsmSlice()
virtual auto_ptr< Slice > allocateSlice()
Directly allocate a slice of the correct type using new.
void reset(size_t newVarCount)
void clearAndSetVarCount(size_t varCount)
TermConsumer * getLeftConsumer()
IndependenceSplitter _indep
virtual void run(TaskEngine &engine)
Does whatever work this task represents.
TaskEngine _tasks
This keeps track of pending tasks to process.
void independenceSplit(auto_ptr< Slice > slice)
TermConsumer * getRightConsumer()
bool analyze(const Slice &slice)
A SplitStrategy is an implementation of a split selection strategy for the Slice Algorithm.
virtual void getPivot(Term &pivot, Slice &slice) const =0
Sets pivot to the pivot of a pivot split on slice.
virtual bool debugIsValidSlice(Slice *slice)
Check that this slice is valid for use with this strategy.
size_t getVarCount() const
virtual bool processSlice(TaskEngine &tasks, auto_ptr< Slice > slice)
Process the parameter slice.
virtual bool simplify(Slice &slice)
Simplifies slice and returns true if it changed.
virtual void beginConsuming()=0
Tell the consumer to begin consuming an ideal.
TaskEngine handles a list of tasks that are to be carried out.
Invariant: either the slice is a trivial base case, or removeDoubleLcm returns false.
const_iterator end() const
virtual bool isPivotSplit() const =0
If returns true, only call getPivot.
virtual void pivotSplit(auto_ptr< Slice > slice)
Takes over ownership of slice.
Projection _leftProjection
void addTask(Task *task)
Add a task at the head of the list of pending tasks.
bool getUseIndependence() const
Returns true if independence splits should be performed when possible.
This class represents a slice, which is the central data structure of the Slice Algorithm.
This class is used to transfer terms one at a time from one part of the program to another,...
A Task object represents a unit of work that is performed when the method run() is called.
Term represents a product of variables which does not include a coefficient.
bool getUseSimplification() const
Returns true if slices should be simplified.
const Projection & getLeftProjection()
size_t getVarCount() const
virtual void beginConsuming()
Tell the consumer to begin consuming an ideal.
virtual void doneConsuming()
Must be called once after each time beginConsuming has been called.
void getRestProjection(Projection &projection) const
virtual void run(const Ideal &ideal)
Run the Slice algorithm.
virtual void doneConsuming()=0
Must be called once after each time beginConsuming has been called.
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)
virtual void consume(const Term &term)
Consume a term.
This class adds code to the SliceStrategy base class that is useful for derived classes.
virtual size_t getLabelSplitVariable(const Slice &slice) const =0
Returns the variable to perform a label split on.
virtual void getPivot(Term &pivot, Slice &slice)
Used by pivotSplit to obtain a pivot.
void runTasks()
Runs all pending tasks.
virtual void doneConsuming()
Must be called once after each time beginConsuming has been called.
size_t getRangeVarCount() const
virtual bool isLabelSplit() const =0
If returns true, only call getLabelSplitVariable.
Represents a monomial ideal with int exponents.
virtual void dispose()
Called when the task is no longer used but run has not and will not be called.
static void setToIdentity(Exponent *res, size_t varCount)
Set res equal to , i.e. set each entry of res equal to 0.
virtual void consume(const Term &term)=0
Consume a term.
MsmIndependenceSplit::RightConsumer _rightConsumer
void insert(const Exponent *term)
Projection _rightProjection
MsmStrategy(TermConsumer *consumer, const SplitStrategy *splitStrategy)
virtual void beginConsuming()
Tell the consumer to begin consuming an ideal.
virtual void freeSlice(auto_ptr< Slice > slice)
It is allowed to delete returned slices directly, but it is better to use freeSlice.
const Projection & getRightProjection()
A TermGrader assigns a value, the degree, to each monomial.
void labelSplit(auto_ptr< Slice > slice)
virtual void consume(const Term &term)
Consume a term.
void reset(TermConsumer *consumer, IndependenceSplitter &splitter)