Slice.h
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#ifndef SLICE_GUARD
#define SLICE_GUARD
#include "Ideal.h"
#include "Term.h"
#include "Task.h"
class Projection;
class SliceStrategy;
class Slice : public Task {
public:
Slice(SliceStrategy& strategy);
Slice(SliceStrategy& strategy,
const Ideal& ideal, const Ideal& subtract, const Term& multiply);
virtual ~Slice();
size_t getVarCount() const {return _varCount;}
const Ideal& getIdeal() const {return _ideal;}
Ideal& getSubtract() {return _subtract;}
const Ideal& getSubtract() const {return _subtract;}
Term& getMultiply() {return _multiply;}
const Term& getMultiply() const {return _multiply;}
const Term& getLcm() const;
void print(FILE* file) const;
virtual bool baseCase(bool simplified) = 0;
virtual Slice& operator=(const Slice& slice) = 0;
void resetAndSetVarCount(size_t varCount);
void clearIdealAndSubtract();
void singleDegreeSortIdeal(size_t var);
virtual bool innerSlice(const Term& pivot);
virtual void outerSlice(const Term& pivot);
bool normalize();
bool adjustMultiply();
virtual bool simplify();
virtual bool simplifyStep() = 0;
virtual void run(TaskEngine& tasks);
virtual void dispose();
protected:
void setToProjOf(const Slice& slice, const Projection& projection);
void swap(Slice& slice);
bool pruneSubtract();
bool applyLowerBound();
virtual bool getLowerBound(Term& bound, size_t var) const = 0;
Ideal _ideal;
Ideal _subtract;
Term _multiply;
size_t _varCount;
mutable Term _lcm;
mutable bool _lcmUpdated;
size_t _lowerBoundHint;
SliceStrategy& _strategy;
};
#endif
Ideal.h
Task.h
Term.h
Ideal
Represents a monomial ideal with int exponents.
Definition Ideal.h:27
Projection
Definition Projection.h:29
SliceStrategy
This class describes the interface of a strategy object for the Slice Algorithm.
Definition SliceStrategy.h:33
Slice::_varCount
size_t _varCount
The number of variables in the ambient polynomial ring.
Definition Slice.h:275
Slice::_ideal
Ideal _ideal
The of a slice .
Definition Slice.h:266
Slice::resetAndSetVarCount
void resetAndSetVarCount(size_t varCount)
Resets this slice to in an ambient polynomial ring of varCount variables.
Definition Slice.cpp:89
Slice::_strategy
SliceStrategy & _strategy
Definition Slice.h:303
Slice::normalize
bool normalize()
Removes those generators of getIdeal() that are strictly divisible by some generator of getSubtract()...
Definition Slice.cpp:189
Slice::singleDegreeSortIdeal
void singleDegreeSortIdeal(size_t var)
Calls Ideal::singleDegreeSort on getIdeal().
Definition Slice.cpp:106
Slice::print
void print(FILE *file) const
Write a text representation of this object to file in a format appropriate for debugging.
Definition Slice.cpp:68
Slice::innerSlice
virtual bool innerSlice(const Term &pivot)
Sets this object to the inner slice according to pivot.
Definition Slice.cpp:110
Slice::outerSlice
virtual void outerSlice(const Term &pivot)
Sets this object to the outer slice according to pivot.
Definition Slice.cpp:132
Slice::_lowerBoundHint
size_t _lowerBoundHint
A hint that starting simplification through a lower bound at the variable indicated by _lowerBoundHin...
Definition Slice.h:301
Slice::operator=
virtual Slice & operator=(const Slice &slice)=0
Performs a deep copy of slice into this object.
Definition Slice.cpp:77
Slice::adjustMultiply
bool adjustMultiply()
Ensure that for each var, var appears to the first power in some generator of getIdeal().
Definition Slice.cpp:162
Slice::setToProjOf
void setToProjOf(const Slice &slice, const Projection &projection)
Set this object to be the projection of slice according to projection.
Definition Slice.cpp:218
Slice::_multiply
Term _multiply
The of a slice .
Definition Slice.h:272
Slice::swap
void swap(Slice &slice)
Simultaneously set the value of this object to that of slice and vice versa.
Definition Slice.cpp:252
Slice::Slice
Slice(SliceStrategy &strategy)
Construct the slice in a ring of zero variables.
Definition Slice.cpp:26
Slice::getMultiply
Term & getMultiply()
Returns for a slice .
Definition Slice.h:113
Slice::pruneSubtract
bool pruneSubtract()
Removes those generators of subtract that do not strictly divide the lcm of getIdeal(),...
Definition Slice.cpp:281
Slice::getSubtract
const Ideal & getSubtract() const
Returns for a slice .
Definition Slice.h:110
Slice::run
virtual void run(TaskEngine &tasks)
Does whatever work this task represents.
Definition Slice.cpp:321
Slice::_lcm
Term _lcm
The lcm of getIdeal() if _lcmUpdated is true, and otherwise the value is undefind.
Definition Slice.h:285
Slice::clearIdealAndSubtract
void clearIdealAndSubtract()
Clears getIdeal() and getSubtract() and does not change getMultiply().
Definition Slice.cpp:99
Slice::applyLowerBound
bool applyLowerBound()
Calculates a lower bound on the content of the slice using getLowerBound() and calls innerSlice with ...
Definition Slice.cpp:289
Slice::getLowerBound
virtual bool getLowerBound(Term &bound, size_t var) const =0
Calculates a lower bound that depends on var.
Slice::getIdeal
const Ideal & getIdeal() const
Returns for a slice .
Definition Slice.h:104
Slice::getLcm
const Term & getLcm() const
Returns the least common multiple of the generators of getIdeal().
Definition Slice.cpp:52
Slice::_lcmUpdated
bool _lcmUpdated
Indicates whether _lcm is correct.
Definition Slice.h:293
Slice::_subtract
Ideal _subtract
The of a slice .
Definition Slice.h:269
Slice::getVarCount
size_t getVarCount() const
Returns the number of variables in the ambient ring.
Definition Slice.h:96
Slice::baseCase
virtual bool baseCase(bool simplified)=0
Returns true if this slice is a base case slice, and in that case produces output in a derivative-spe...
Slice::getMultiply
const Term & getMultiply() const
Returns for a slice .
Definition Slice.h:116
Slice::simplifyStep
virtual bool simplifyStep()=0
Like simplify(), except that only one simplification step is performed.
Slice::~Slice
virtual ~Slice()
Definition Slice.cpp:47
Slice::dispose
virtual void dispose()
Called when the task is no longer used but run has not and will not be called.
Definition Slice.cpp:325
Slice::getSubtract
Ideal & getSubtract()
Returns for a slice .
Definition Slice.h:107
Slice::simplify
virtual bool simplify()
Simplifies this object such that it may become simpler without changing the content.
Definition Slice.cpp:204
TaskEngine
TaskEngine handles a list of tasks that are to be carried out.
Definition TaskEngine.h:40
Task
A Task object represents a unit of work that is performed when the method run() is called.
Definition Task.h:27
Term
Term represents a product of variables which does not include a coefficient.
Definition Term.h:49