CTermStack.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_iterators_CTermStack_h_
#define polybori_iterators_CTermStack_h_
// get standard header
#include <stack>
#include <iterator>
#include <utility> // for std::pair
// include basic definitions
#include <polybori/pbori_defs.h>
// include polybori functionals
#include <polybori/routines/pbori_func.h>
// include polybori properties
#include <polybori/common/traits.h>
#include <polybori/routines/pbori_routines.h>
// include boost's indirect iterator facilities
#include <boost/iterator/indirect_iterator.hpp>
#include <polybori/BoolePolyRing.h>
#include <polybori/BooleEnv.h>
#include <polybori/cache/CDegreeCache.h>
#include "CBidirectTermIter.h"
#include <polybori/BooleSet.h>
BEGIN_NAMESPACE_PBORI
template<class NavigatorType>
struct cached_deg {
typedef CDegreeCache<BooleSet> cache_type;
typedef typename cache_type::manager_type manager_type;
cached_deg(const manager_type & mgr): m_deg_cache(mgr) {}
typename NavigatorType::deg_type
operator()(NavigatorType navi) const {
return dd_cached_degree(m_deg_cache, navi);
}
cache_type m_deg_cache;
};
template <class NavigatorType>
class cached_block_deg {
public:
typedef typename NavigatorType::idx_type idx_type;
typedef cached_block_deg<NavigatorType> self;
typedef std::vector<idx_type> block_idx_type;
typedef typename block_idx_type::const_iterator block_iterator;
typedef CBlockDegreeCache<BooleEnv::dd_type>
cache_type;
typedef typename cache_type::manager_type manager_type;
cached_block_deg(const manager_type& mgr):
m_current_block(block_begin(mgr)),
m_deg_cache(mgr) { }
typename NavigatorType::size_type
operator()(NavigatorType navi) const {
return dd_cached_block_degree(m_deg_cache, navi, max());
}
idx_type min() const {
PBORI_ASSERT(*m_current_block != 0); // assuming first element to be zero
return *(m_current_block - 1);
}
idx_type max() const {
return *m_current_block;
}
self& operator++(){
PBORI_ASSERT(max() != CTypes::max_idx);
++m_current_block;
return *this;
}
self& operator--(){
PBORI_ASSERT(min() != 0);
--m_current_block;
return *this;
}
private:
// block_iterator m_indices;
block_iterator m_current_block;
cache_type m_deg_cache;
};
template <class NavigatorType, class BaseType = internal_tag>
class CTermStackBase:
public BaseType {
public:
template <class, class> friend class CTermStackBase;
typedef CTermStackBase<NavigatorType, BaseType> self;
typedef NavigatorType navigator;
typedef typename navigator::idx_type idx_type;
typedef typename navigator::size_type size_type;
typedef typename navigator::deg_type deg_type;
typedef typename navigator::bool_type bool_type;
typedef std::deque<navigator> stack_type;
typedef typename stack_type::reference reference;
typedef typename stack_type::const_reference const_reference;
typedef boost::indirect_iterator<typename stack_type::const_iterator,
typename navigator::value_type,
boost::use_default,
typename navigator::reference>
const_iterator;
typedef typename stack_type::const_iterator stack_iterator;
typedef typename stack_type::const_reverse_iterator stack_reverse_iterator;
typedef boost::indirect_iterator<typename stack_type::const_reverse_iterator,
typename navigator::value_type,
boost::use_default,
typename navigator::reference>
const_reverse_iterator;
private:
void pop() { m_stack.pop_back(); }
protected:
void push(navigator __x) { m_stack.push_back(__x); }
void clear() { m_stack.clear(); }
public:
bool_type empty() const { return m_stack.empty(); }
const_reference top() const {
PBORI_ASSERT(!empty());
return m_stack.back();
}
idx_type index() const { return *top(); }
size_type size() const { return m_stack.size(); }
const_iterator begin() const { return stackBegin(); }
const_iterator end() const { return stackEnd(); }
const_reverse_iterator rbegin() const { return stackRBegin(); }
const_reverse_iterator rend() const { return stackREnd(); }
navigator navigation() const {
PBORI_ASSERT(m_stack.begin() != m_stack.end());
return *m_stack.begin();
}
typedef typename stack_type::value_type top_type;
CTermStackBase(): BaseType(), m_stack() { }
CTermStackBase(navigator navi): BaseType(), m_stack() {
if (navi.isValid())
push(navi);
}
CTermStackBase(const CTermStackBase& rhs):
BaseType(rhs), m_stack(rhs.m_stack) { }
bool_type equal(const self& rhs) const {
if(empty() || rhs.empty())
return (empty() && rhs.empty());
else
return (m_stack == rhs.m_stack);
}
void incrementThen() {
PBORI_ASSERT(!top().isConstant());
push(top());
m_stack.back().incrementThen();
}
void incrementElse() {
PBORI_ASSERT(!isConstant());
m_stack.back().incrementElse();
}
void decrementNode() {
PBORI_ASSERT(!empty());
pop();
}
bool_type isConstant() const {
PBORI_ASSERT(!empty());
return top().isConstant();
}
bool_type isTerminated() const {
PBORI_ASSERT(!empty());
return top().isTerminated();
}
bool_type isInvalid() const {
PBORI_ASSERT(!empty());
return top().isEmpty();
}
void followThen() {
PBORI_ASSERT(!empty());
while(!isConstant())
incrementThen();
}
void markOne() {
PBORI_ASSERT(empty());
push(navigator());
}
bool_type markedOne() const {
if PBORI_UNLIKELY(empty())
return false;
else
return !m_stack.front().isValid();
}
void clearOne() {
pop();
PBORI_ASSERT(empty());
}
deg_type deg() const {
return (markedOne()? 0: (deg_type)size());
}
void restart(navigator navi) {
PBORI_ASSERT(empty());
push(navi);
}
bool isOne() const { return markedOne(); }
bool isZero() const { return empty(); }
bool atBegin() const { return empty(); }
bool atEnd() const { return atEnd(top()); }
bool atEnd(navigator navi) const { return navi.isConstant(); }
bool validEnd() const { return validEnd(top()); }
bool validEnd(navigator navi) const {
while(!navi.isConstant()) {
navi.incrementElse();
}
return navi.terminalValue();
}
void print() const{
std::cout <<"(";
std::copy(begin(), end(), std::ostream_iterator<int>(std::cout, ", "));
std::cout <<")";
}
stack_iterator stackBegin() const {
if (markedOne())
return m_stack.end();
else
return m_stack.begin();
}
stack_iterator stackEnd() const {
return m_stack.end();
}
stack_reverse_iterator stackRBegin() const {
if (markedOne())
return m_stack.rend();
else
return m_stack.rbegin();
}
stack_reverse_iterator stackREnd() const {
return m_stack.rend();
}
protected:
template <class TermStack>
void append(const TermStack& rhs) {
PBORI_ASSERT(empty() || rhs.empty() || ((*rhs.begin()) > (*top())) );
m_stack.insert(m_stack.end(), rhs.m_stack.begin(), rhs.m_stack.end());
}
private:
stack_type m_stack;
navigator m_zero;
};
template <class NavigatorType, class Category, class BaseType = internal_tag>
class CTermStack:
public CTermStackBase<NavigatorType, BaseType> {
public:
typedef CTermStackBase<NavigatorType, BaseType> base;
typedef CTermStack<NavigatorType, Category, BaseType> self;
typedef CTermStack<NavigatorType, Category, internal_tag> purestack_type;
typedef Category iterator_category;
typedef typename base::navigator navigator;
typedef typename on_same_type<Category, std::forward_iterator_tag,
project_ith<0>,
handle_else<NavigatorType> >::type
else_handler;
else_handler handleElse;
using base::incrementThen;
using base::followThen;
CTermStack(): base() { }
CTermStack(navigator navi): base(navi) { }
CTermStack(const CTermStack& rhs):
base(rhs), handleElse(rhs.handleElse) { }
template <class Dummy>
CTermStack(navigator navi, const Dummy&): base(navi) { }
void init() {
if (!base::empty()){
followThen();
terminate();
}
}
void initLast() {
if (!base::empty()){
followElse();
terminate();
}
}
void incrementElse() {
handleElse(base::top());
base::incrementElse();
}
void next() {
bool invalid = true;
while (!base::empty() && invalid) {
incrementElse();
if ((invalid = base::isInvalid()))
base::decrementNode();
}
}
void previous() {
previous(Category());
}
void increment() {
PBORI_ASSERT(!base::empty());
if PBORI_UNLIKELY(base::markedOne()) {
base::clearOne();
return;
}
next();
if PBORI_UNLIKELY(!base::empty()) {
followThen();
terminate();
}
}
void decrement() {
if PBORI_UNLIKELY(base::markedOne()) {
base::clearOne();
}
previous();
if PBORI_UNLIKELY(!base::empty()){
followElse();
base::decrementNode();
}
}
void terminate() {
PBORI_ASSERT(!base::empty());
bool isZero = base::isInvalid();
base::decrementNode();
if PBORI_UNLIKELY(base::empty() && !isZero)
base::markOne();
}
void followElse() {
while( !base::isConstant() ) // if still in interior of a path
incrementValidElse();
}
void incrementValidElse() {
PBORI_ASSERT(!base::empty() && !base::isConstant());
if(!base::top().elseBranch().isEmpty())
incrementElse(); // go in direction of last term, if possible
else
incrementThen();
}
protected:
template <class TermStack>
void append(const TermStack& rhs) {
base::append(rhs);
append(rhs, Category());
}
private:
void previous(std::forward_iterator_tag);
void previous(std::bidirectional_iterator_tag);
template <class TermStack>
void append(const TermStack&, std::forward_iterator_tag){}
template <class TermStack>
void append(const TermStack& rhs, std::bidirectional_iterator_tag){
handleElse.append(rhs.handleElse);
}
};
template <class NavigatorType, class Category, class BaseType>
inline void CTermStack<NavigatorType, Category, BaseType>::previous(
std::forward_iterator_tag) { }
template <class NavigatorType, class Category, class BaseType>
inline void CTermStack<NavigatorType, Category, BaseType>::previous(
std::bidirectional_iterator_tag) {
if(handleElse.empty()) {
base::clear();
return;
}
navigator navi = handleElse.top();
PBORI_ASSERT(base::empty() || base::top().isValid());
while(!base::empty() && (base::index() >= *navi) ) {
base::decrementNode();
}
handleElse.pop();
base::push(navi);
incrementThen();
}
template <class NavigatorType, class Category>
class CReverseTermStack:
public CTermStack<NavigatorType, Category> {
public:
typedef NavigatorType navigator;
typedef CTermStack<NavigatorType, Category> base;
CReverseTermStack(): base() { }
CReverseTermStack(navigator navi): base(navi) { }
CReverseTermStack(const CReverseTermStack& rhs): base(rhs) { }
template <class Dummy>
CReverseTermStack(navigator navi, const Dummy&): base(navi) { }
void init() { base::initLast(); }
void initLast() { base::init(); }
void increment() { base::decrement(); }
void decrement() { base::increment(); }
};
template <class NavigatorType, class BlockProperty, class Category, class
BaseType = internal_tag>
class CDegStackCore;
template <class NavigatorType, class Category, class BaseType>
class CDegStackCore<NavigatorType, invalid_tag, Category, BaseType>:
public CTermStack<NavigatorType, Category, BaseType> {
public:
typedef CTermStack<NavigatorType, Category, BaseType> base;
typedef NavigatorType navigator;
typedef typename cached_deg<navigator>::manager_type manager_type;
// CDegStackCore(): base(), getDeg(manager_type()) {}
CDegStackCore(navigator navi, const manager_type& mgr):
base(navi), getDeg(mgr) {}
CDegStackCore(const CDegStackCore& rhs):
base(rhs), getDeg(rhs.getDeg) {}
void gotoEnd() {
PBORI_ASSERT(!base::empty());
while(!base::isConstant()) {
base::incrementElse();
}
}
cached_deg<navigator> getDeg;
};
template <class NavigatorType, class Category, class BaseType>
class CDegStackCore<NavigatorType, valid_tag, Category, BaseType> :
public CTermStack<NavigatorType, Category, BaseType> {
public:
typedef CTermStack<NavigatorType, Category, BaseType> base;
typedef NavigatorType navigator;
typedef typename base::idx_type idx_type;
typedef typename base::deg_type deg_type;
typedef typename base::size_type size_type;
typedef typename cached_block_deg<navigator>::manager_type manager_type;
// CDegStackCore(): base(), block(manager_type()) {}
CDegStackCore(navigator navi, const manager_type& mgr):
base(navi), block(mgr) {}
CDegStackCore(const CDegStackCore& rhs):
base(rhs), block(rhs.block) {}
deg_type getDeg(navigator navi) const { return block(navi); }
bool atBegin() const {
return base::empty() || (base::index() < block.min());
}
bool atEnd() const { return atEnd(base::top()); }
bool atEnd(navigator navi) const {
return navi.isConstant() || (*navi >= block.max());
}
bool validEnd() const{ return validEnd(base::top()); }
bool validEnd(navigator navi) const {
while(!atEnd(navi))
navi.incrementElse();
return (navi.isConstant()? navi.terminalValue(): *navi >= block.max());
}
void next() {
bool invalid = true;
while (!atBegin() && invalid) {
PBORI_ASSERT(!base::isConstant());
base::incrementElse();
if ((invalid = base::isInvalid()))
base::decrementNode();
}
}
void previous() {
if( base::handleElse.empty() || (*base::handleElse.top() < block.min()) ) {
while(!atBegin())
base::decrementNode();
return;
}
navigator navi = base::handleElse.top();
PBORI_ASSERT(base::top().isValid());
while(!atBegin() && (base::index() >= *navi) ) {
base::decrementNode();
}
if (base::empty() || (base::index() < *navi)) {
base::handleElse.pop();
base::push(navi);
}
base::incrementThen();
}
void gotoEnd() {
PBORI_ASSERT(!base::empty());
while( (!base::isConstant()) && (base::index() < block.max()) ) {
base::incrementElse();
}
}
protected:
cached_block_deg<navigator> block;
};
template <class NavigatorType, class BlockProperty, class DescendingProperty,
class BaseType = internal_tag>
class CDegStackBase;
template <class NavigatorType, class BlockProperty, class BaseType>
class CDegStackBase<NavigatorType, valid_tag, BlockProperty, BaseType>:
public CDegStackCore<NavigatorType, BlockProperty,
std::forward_iterator_tag, BaseType> {
public:
typedef CDegStackCore<NavigatorType, BlockProperty,
std::forward_iterator_tag, BaseType> base;
typedef typename base::size_type size_type;
typedef typename base::deg_type deg_type;
typedef std::greater<size_type> size_comparer;
typedef typename base::manager_type manager_type;
// CDegStackBase(): base() {}
CDegStackBase(NavigatorType navi, const manager_type& mgr): base(navi, mgr) {}
CDegStackBase(const CDegStackBase& rhs): base(rhs) {}
integral_constant<bool, false> takeLast;
void proximate() { base::next(); }
void incrementBranch() { base::incrementThen(); }
bool maxOnThen(deg_type deg) const {
return (base::getDeg(base::top().thenBranch()) + 1 == deg);
}
};
template <class NavigatorType, class BlockProperty, class BaseType>
class CDegStackBase<NavigatorType, invalid_tag, BlockProperty, BaseType>:
public CDegStackCore<NavigatorType, BlockProperty,
std::bidirectional_iterator_tag, BaseType> {
public:
typedef CDegStackCore<NavigatorType, BlockProperty,
std::bidirectional_iterator_tag, BaseType> base;
typedef typename base::size_type size_type;
typedef typename base::deg_type deg_type;
typedef std::greater_equal<size_type> size_comparer;
typedef typename base::manager_type manager_type;
// CDegStackBase(): base() {}
CDegStackBase(NavigatorType navi, const manager_type& mgr): base(navi, mgr) {}
CDegStackBase(const CDegStackBase& rhs): base(rhs) {}
integral_constant<bool, true> takeLast;
void proximate() { base::previous(); }
void incrementBranch() { base::incrementValidElse(); }
bool maxOnThen(deg_type deg) const {
return !(base::getDeg(base::top().elseBranch()) == deg);
}
};
template <class NavigatorType, class DescendingProperty,
class BlockProperty = invalid_tag, class BaseType = internal_tag>
class CDegTermStack:
public CDegStackBase<NavigatorType, DescendingProperty, BlockProperty, BaseType> {
public:
typedef CDegStackBase<NavigatorType, DescendingProperty, BlockProperty, BaseType> base;
typedef CDegTermStack<NavigatorType, DescendingProperty, BlockProperty, BaseType> self;
typedef typename base::navigator navigator;
typedef typename navigator::size_type size_type;
typedef typename navigator::deg_type deg_type;
typedef typename base::manager_type manager_type;
// CDegTermStack(): base(), m_start() {}
CDegTermStack(navigator navi, const manager_type& mgr):
base(navi, mgr), m_start(navi), m_zero(mgr.zero().navigation()) {}
CDegTermStack(const CDegTermStack& rhs):
base(rhs), m_start(rhs.m_start), m_zero(rhs.m_zero) {}
void init() {
if (!base::empty()) {
followDeg();
base::terminate();
}
}
void followDeg() {
PBORI_ASSERT(!base::empty());
deg_type deg = base::getDeg(base::top());
while (deg > 0) {
if ( base::maxOnThen(deg) ) {
--deg;
base::incrementThen();
}
else
base::incrementElse();
}
}
void increment() {
PBORI_ASSERT(!base::empty());
if (base::markedOne()) {
base::clearOne();
return;
}
size_type upperbound = base::size();
degTerm();
if(base::empty()) {
restart();
findTerm(upperbound);
}
if(!base::empty())
base::terminate();
}
void degTerm() {
size_type size = base::size() + 1;
PBORI_ASSERT(!base::isConstant());
bool doloop;
do {
PBORI_ASSERT(!base::empty());
base::proximate();
if (base::atBegin())
return;
while (!base::atEnd() && (base::size() < size) ) {
base::incrementBranch();
}
base::gotoEnd();
if ((doloop = (base::isInvalid() || (base::size() != size)) ) )
base::decrementNode();
} while (!base::empty() && doloop);
}
void decrement() {}
void findTerm(size_type upperbound) {
PBORI_ASSERT(!base::empty());
typename base::purestack_type max_elt, current(base::top());
base::decrementNode();
typename base::size_comparer comp;
while (!current.empty() &&
(base::takeLast() || (max_elt.size() != upperbound)) ) {
while (!base::atEnd(current.top()) && (current.size() < upperbound) )
current.incrementThen();
if (base::validEnd(current.top())) {
if (comp(current.size(), max_elt.size()))
max_elt = current;
current.decrementNode();
}
current.next();
}
base::append(max_elt);
if(max_elt.empty())
invalidate();
}
void restart() { base::restart(m_start); }
void invalidate() {
PBORI_ASSERT(m_zero.isValid());
PBORI_ASSERT(m_zero.isEmpty());
base::push(m_zero);
}
private:
navigator m_start, m_zero;
};
template <class NavigatorType, class DescendingProperty, class BaseType = internal_tag>
class CBlockTermStack:
public CDegTermStack<NavigatorType, DescendingProperty, valid_tag, BaseType> {
public:
typedef CDegTermStack<NavigatorType, DescendingProperty, valid_tag, BaseType> base;
typedef CBlockTermStack<NavigatorType, DescendingProperty, BaseType> self;
typedef typename base::navigator navigator;
typedef typename navigator::size_type size_type;
typedef typename navigator::idx_type idx_type;
typedef typename base::manager_type manager_type;
CBlockTermStack(navigator navi, const manager_type& mgr):
base(navi, mgr) { }
CBlockTermStack(const CBlockTermStack& rhs): base(rhs) { }
void init() {
if (!base::empty()) {
followDeg();
base::terminate();
}
}
void increment() {
PBORI_ASSERT(!base::empty());
if (base::markedOne()) {
base::clearOne();
return;
}
navigator current = base::top();
while (*current < base::block.min())
--base::block;
incrementBlock();
while ( (base::size() > 1 ) && base::isInvalid() ) {
--base::block;
base::decrementNode();
incrementBlock();
}
followDeg();
PBORI_ASSERT(!base::empty());
base::terminate();
}
void followBlockDeg() { base::followDeg(); }
void followDeg() {
PBORI_ASSERT(base::top().isValid());
if (!base::isConstant() )
followBlockDeg();
while (!base::isConstant() ) {
++base::block;
followBlockDeg();
}
}
void incrementBlock() {
PBORI_ASSERT(!base::empty());
size_type size = base::size() + 1;
if (base::index() < base::block.min()) {
base::invalidate();
return;
}
base::degTerm();
if (base::size() == size) return;
if (base::empty())
base::restart();
else {
PBORI_ASSERT(base::index() < base::block.min());
base::incrementThen();
}
while (!base::isConstant() && (base::index() < base::block.min()))
base::incrementElse();
PBORI_ASSERT(size > base::size());
base::findTerm(size - base::size());
base::gotoEnd();
}
};
END_NAMESPACE_PBORI
#endif
polybori::CReverseTermStack
This class defines an iterator for the monomials in a Boolean polynomial in reversed lexicographicxal...
Definition: CTermStack.h:527
polybori::CTermStackBase::const_iterator
boost::indirect_iterator< typename stack_type::const_iterator, typename navigator::value_type, boost::use_default, typename navigator::reference > const_iterator
Definition: CTermStack.h:156
polybori::invalid_tag
This class shows, whether a property of an order is invalid.
Definition: tags.h:27
polybori::CDegTermStack::increment
void increment()
Definition: CTermStack.h:777
polybori::block_begin
BooleEnv::block_iterator block_begin(const BooleEnv::ring_type &ring)
please use BooleEnv::ring()
Definition: BooleEnv.cc:138
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::size_type
base::size_type size_type
Definition: CTermStack.h:711
polybori::CBlockTermStack::manager_type
base::manager_type manager_type
Definition: CTermStack.h:878
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::CDegStackCore
CDegStackCore(navigator navi, const manager_type &mgr)
Definition: CTermStack.h:599
polybori::CTermStackBase::isOne
bool isOne() const
Definition: CTermStack.h:287
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::getDeg
deg_type getDeg(navigator navi) const
Definition: CTermStack.h:605
polybori::CTermStackBase::clear
void clear()
Definition: CTermStack.h:174
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::next
void next()
Definition: CTermStack.h:625
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::block
cached_block_deg< navigator > block
Definition: CTermStack.h:664
polybori::CTermStackBase::rend
const_reverse_iterator rend() const
Definition: CTermStack.h:191
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::manager_type
base::manager_type manager_type
Definition: CTermStack.h:683
polybori::CDegStackCore< NavigatorType, invalid_tag, Category, BaseType >::CDegStackCore
CDegStackCore(const CDegStackCore &rhs)
Definition: CTermStack.h:572
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::validEnd
bool validEnd() const
Definition: CTermStack.h:616
polybori::CBlockTermStack::idx_type
navigator::idx_type idx_type
Definition: CTermStack.h:877
polybori::cached_block_deg::max
idx_type max() const
Definition: CTermStack.h:93
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::proximate
void proximate()
Definition: CTermStack.h:723
polybori::CDegStackCore
Definition: CTermStack.h:555
polybori::CTermStackBase::deg
deg_type deg() const
Definition: CTermStack.h:278
polybori::CTermStackBase::stack_iterator
stack_type::const_iterator stack_iterator
Definition: CTermStack.h:158
polybori::CReverseTermStack::CReverseTermStack
CReverseTermStack(navigator navi)
Construct from initial navigator.
Definition: CTermStack.h:537
polybori::CTermStack::initLast
void initLast()
Definition: CTermStack.h:397
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::size_type
base::size_type size_type
Definition: CTermStack.h:595
polybori::CTermStackBase::const_reference
stack_type::const_reference const_reference
Definition: CTermStack.h:150
polybori::CTermStack::increment
void increment()
Definition: CTermStack.h:424
polybori::CTermStackBase::navigator
NavigatorType navigator
Get type of navigators.
Definition: CTermStack.h:136
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::takeLast
integral_constant< bool, false > takeLast
Definition: CTermStack.h:690
polybori::CTermStack::purestack_type
CTermStack< NavigatorType, Category, internal_tag > purestack_type
Defining a type for simple stacking of term elements.
Definition: CTermStack.h:361
polybori::cached_deg::cached_deg
cached_deg(const manager_type &mgr)
Definition: CTermStack.h:52
polybori::dd_cached_degree
NaviType::deg_type dd_cached_degree(const DegreeCacher &cache, NaviType navi)
Definition: pbori_routines_misc.h:49
polybori::handle_else
Definition: CBidirectTermIter.h:31
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::CDegStackBase
CDegStackBase(const CDegStackBase &rhs)
Definition: CTermStack.h:719
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::validEnd
bool validEnd(navigator navi) const
Definition: CTermStack.h:617
polybori::groebner::deg_type
int deg_type
Definition: groebner_defs.h:42
polybori::CTermStack::previous
void previous()
Definition: CTermStack.h:419
polybori::CDegTermStack::navigator
base::navigator navigator
Definition: CTermStack.h:742
polybori::on_same_type
This class switches betweem two types, depending on equality of types.
Definition: pbori_func.h:589
polybori::CReverseTermStack::CReverseTermStack
CReverseTermStack()
Default constructor.
Definition: CTermStack.h:534
polybori::CTermStackBase::equal
bool_type equal(const self &rhs) const
Equality test (assume iterators from same instance)
Definition: CTermStack.h:216
polybori::CTermStack::else_handler
on_same_type< Category, std::forward_iterator_tag, project_ith< 0 >, handle_else< NavigatorType > >::type else_handler
Definition: CTermStack.h:368
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::previous
void previous()
Definition: CTermStack.h:635
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::maxOnThen
bool maxOnThen(deg_type deg) const
Definition: CTermStack.h:727
polybori::project_ith
Accessing ith of n arguments (ITH = 0 returns default value of first type)
Definition: pbori_func.h:144
polybori::CTermStackBase::size
size_type size() const
Definition: CTermStack.h:184
BooleSet.h
polybori::CBlockTermStack::CBlockTermStack
CBlockTermStack(navigator navi, const manager_type &mgr)
Construct stack from navigator.
Definition: CTermStack.h:881
polybori::CDegTermStack::restart
void restart()
Definition: CTermStack.h:851
polybori::CTermStackBase::CTermStackBase
CTermStackBase(const CTermStackBase &rhs)
Copy constructor.
Definition: CTermStack.h:212
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::proximate
void proximate()
Definition: CTermStack.h:692
polybori::CDegTermStack::invalidate
void invalidate()
Definition: CTermStack.h:853
polybori::CTermStackBase::validEnd
bool validEnd(navigator navi) const
Definition: CTermStack.h:296
polybori::CBlockTermStack
Definition: CTermStack.h:868
polybori::CTermStackBase::stack_type
std::deque< navigator > stack_type
Define type for stacking.
Definition: CTermStack.h:147
polybori::CTermStack::navigator
base::navigator navigator
Definition: CTermStack.h:364
polybori::CTermStackBase::index
idx_type index() const
Definition: CTermStack.h:183
polybori::cached_deg::operator()
NavigatorType::deg_type operator()(NavigatorType navi) const
Definition: CTermStack.h:55
traits.h
polybori::CDegStackCore< NavigatorType, invalid_tag, Category, BaseType >::gotoEnd
void gotoEnd()
Definition: CTermStack.h:575
polybori::CTermStackBase::isZero
bool isZero() const
Definition: CTermStack.h:288
polybori::CTermStack::CTermStack
CTermStack(navigator navi)
Construct from initial navigator.
Definition: CTermStack.h:379
polybori::CTermStack::next
void next()
Definition: CTermStack.h:409
polybori::CTermStackBase::isInvalid
bool_type isInvalid() const
Definition: CTermStack.h:250
polybori::CTermStackBase::stackRBegin
stack_reverse_iterator stackRBegin() const
Definition: CTermStack.h:320
polybori::CDegStackCore< NavigatorType, invalid_tag, Category, BaseType >::base
CTermStack< NavigatorType, Category, BaseType > base
Definition: CTermStack.h:563
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::takeLast
integral_constant< bool, true > takeLast
Definition: CTermStack.h:721
pbori_func.h
polybori::cached_block_deg::operator()
NavigatorType::size_type operator()(NavigatorType navi) const
Definition: CTermStack.h:84
polybori::integral_constant< bool, false >
polybori::CDegTermStack::decrement
void decrement()
Definition: CTermStack.h:822
polybori::CTermStackBase::CTermStackBase
CTermStackBase()
Default constructor.
Definition: CTermStack.h:203
polybori::CReverseTermStack::init
void init()
Definition: CTermStack.h:547
polybori::CTermStackBase::append
void append(const TermStack &rhs)
Definition: CTermStack.h:333
polybori::CTermStack::handleElse
else_handler handleElse
Definition: CTermStack.h:370
polybori::CBlockTermStack::navigator
base::navigator navigator
Definition: CTermStack.h:875
polybori::cached_block_deg::operator--
self & operator--()
Definition: CTermStack.h:102
polybori::CTermStackBase::empty
bool_type empty() const
Definition: CTermStack.h:178
polybori::CDegStackCore< NavigatorType, invalid_tag, Category, BaseType >::manager_type
cached_deg< navigator >::manager_type manager_type
Definition: CTermStack.h:565
polybori::CTermStackBase::bool_type
navigator::bool_type bool_type
Definition: CTermStack.h:143
polybori::CBlockTermStack::CBlockTermStack
CBlockTermStack(const CBlockTermStack &rhs)
Copy constructor.
Definition: CTermStack.h:885
polybori::CTermStack::CTermStack
CTermStack(const CTermStack &rhs)
Copy constructor.
Definition: CTermStack.h:382
polybori::CDegStackCore< NavigatorType, invalid_tag, Category, BaseType >::getDeg
cached_deg< navigator > getDeg
Definition: CTermStack.h:582
polybori::CTermStackBase::stackREnd
stack_reverse_iterator stackREnd() const
Definition: CTermStack.h:327
polybori::CDegTermStack::init
void init()
Definition: CTermStack.h:754
polybori::CTermStackBase::incrementElse
void incrementElse()
Definition: CTermStack.h:230
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::CDegStackBase
CDegStackBase(NavigatorType navi, const manager_type &mgr)
Definition: CTermStack.h:717
polybori::CTermStackBase::const_reverse_iterator
boost::indirect_iterator< typename stack_type::const_reverse_iterator, typename navigator::value_type, boost::use_default, typename navigator::reference > const_reverse_iterator
Definition: CTermStack.h:166
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::incrementBranch
void incrementBranch()
Definition: CTermStack.h:725
polybori::CBlockTermStack::init
void init()
Definition: CTermStack.h:887
polybori::dd_cached_block_degree
NaviType::deg_type dd_cached_block_degree(const DegreeCacher &cache, NaviType navi, IdxType nextBlock)
Definition: pbori_routines_order.h:278
polybori::CDegTermStack
Definition: CTermStack.h:735
polybori::cached_block_deg
Definition: CTermStack.h:64
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::CDegStackBase
CDegStackBase(NavigatorType navi, const manager_type &mgr)
Definition: CTermStack.h:686
polybori::CDegTermStack::degTerm
void degTerm()
Definition: CTermStack.h:797
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::atEnd
bool atEnd(navigator navi) const
Definition: CTermStack.h:612
pbori_defs.h
polybori::CTermStackBase::idx_type
navigator::idx_type idx_type
Type for indices.
Definition: CTermStack.h:138
polybori::CTermStackBase::decrementNode
void decrementNode()
Definition: CTermStack.h:235
polybori::CDegStackCore< NavigatorType, invalid_tag, Category, BaseType >::navigator
NavigatorType navigator
Definition: CTermStack.h:564
polybori::CTermStack::append
void append(const TermStack &rhs)
Definition: CTermStack.h:477
polybori::CTermStackBase::stack_reverse_iterator
stack_type::const_reverse_iterator stack_reverse_iterator
Definition: CTermStack.h:160
polybori::CTermStackBase::isConstant
bool_type isConstant() const
Definition: CTermStack.h:240
polybori::CTermStackBase::validEnd
bool validEnd() const
Definition: CTermStack.h:295
polybori::cached_deg::m_deg_cache
cache_type m_deg_cache
Definition: CTermStack.h:58
CBidirectTermIter.h
polybori::CTermStackBase::stackEnd
stack_iterator stackEnd() const
Definition: CTermStack.h:316
polybori::CTermStack::init
void init()
Definition: CTermStack.h:390
polybori::CDegTermStack::findTerm
void findTerm(size_type upperbound)
Definition: CTermStack.h:824
polybori::CBlockTermStack::increment
void increment()
Definition: CTermStack.h:894
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::base
CDegStackCore< NavigatorType, BlockProperty, std::bidirectional_iterator_tag, BaseType > base
Definition: CTermStack.h:710
polybori::CTermStackBase::followThen
void followThen()
Definition: CTermStack.h:255
polybori::CBlockDegreeCache< BooleEnv::dd_type >::manager_type
base::manager_type manager_type
Definition: CDegreeCache.h:274
polybori::cached_deg
Definition: CTermStack.h:49
polybori::CTermStack::terminate
void terminate()
Definition: CTermStack.h:452
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::deg_type
base::deg_type deg_type
Definition: CTermStack.h:712
polybori::CTermStack
This class defines an iterator for the monomials in a Boolean polynomial.
Definition: CTermStack.h:353
polybori::cached_deg::cache_type
CDegreeCache< BooleSet > cache_type
Definition: CTermStack.h:50
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::size_comparer
std::greater< size_type > size_comparer
Definition: CTermStack.h:682
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::size_type
base::size_type size_type
Definition: CTermStack.h:680
polybori::CDegTermStack::CDegTermStack
CDegTermStack(const CDegTermStack &rhs)
Definition: CTermStack.h:751
polybori::CBlockTermStack::base
CDegTermStack< NavigatorType, DescendingProperty, valid_tag, BaseType > base
Definition: CTermStack.h:872
PBORI_ASSERT
#define PBORI_ASSERT(arg)
Definition: pbori_defs.h:118
polybori::CTermStack::followElse
void followElse()
Definition: CTermStack.h:462
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::deg_type
base::deg_type deg_type
Definition: CTermStack.h:681
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::atBegin
bool atBegin() const
Definition: CTermStack.h:607
polybori::CTermStackBase::markedOne
bool_type markedOne() const
Definition: CTermStack.h:266
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::incrementBranch
void incrementBranch()
Definition: CTermStack.h:694
polybori::cached_deg::manager_type
cache_type::manager_type manager_type
Definition: CTermStack.h:51
polybori::cached_block_deg::min
idx_type min() const
Definition: CTermStack.h:88
polybori::CTermStackBase::incrementThen
void incrementThen()
Definition: CTermStack.h:224
polybori::CTermStackBase::navigation
navigator navigation() const
Get navigator of stack start.
Definition: CTermStack.h:194
polybori::CDegStackCore< NavigatorType, invalid_tag, Category, BaseType >::CDegStackCore
CDegStackCore(navigator navi, const manager_type &mgr)
Definition: CTermStack.h:569
polybori::CTermStackBase::stackBegin
stack_iterator stackBegin() const
Definition: CTermStack.h:309
polybori::CReverseTermStack::decrement
void decrement()
Definition: CTermStack.h:550
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::manager_type
cached_block_deg< navigator >::manager_type manager_type
Definition: CTermStack.h:596
polybori::cached_block_deg::block_idx_type
std::vector< idx_type > block_idx_type
Type for block indices.
Definition: CTermStack.h:71
polybori::CTermStackBase::CTermStackBase
CTermStackBase(navigator navi)
Construct from initial navigator.
Definition: CTermStack.h:206
polybori::CTermStackBase::size_type
navigator::size_type size_type
Type for lengths.
Definition: CTermStack.h:141
polybori::CTermStack::decrement
void decrement()
Definition: CTermStack.h:439
polybori::cached_block_deg::operator++
self & operator++()
Definition: CTermStack.h:96
pbori_routines.h
polybori::CTermStackBase::isTerminated
bool_type isTerminated() const
Definition: CTermStack.h:245
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::deg_type
base::deg_type deg_type
Definition: CTermStack.h:594
polybori::CTermStackBase::end
const_iterator end() const
Definition: CTermStack.h:187
polybori::CTermStackBase::print
void print() const
Definition: CTermStack.h:303
polybori::CBlockDegreeCache< BooleEnv::dd_type >
polybori::CTermStackBase::top_type
stack_type::value_type top_type
result type of top()
Definition: CTermStack.h:200
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::size_comparer
std::greater_equal< size_type > size_comparer
Definition: CTermStack.h:713
polybori::cached_block_deg::cache_type
CBlockDegreeCache< BooleEnv::dd_type > cache_type
Definition: CTermStack.h:76
polybori::cached_block_deg::manager_type
cache_type::manager_type manager_type
Definition: CTermStack.h:77
polybori::CDegStackBase< NavigatorType, invalid_tag, BlockProperty, BaseType >::manager_type
base::manager_type manager_type
Definition: CTermStack.h:714
BoolePolyRing.h
polybori::internal_tag
This class marks an internal part of a procedure.
Definition: pbori_func.h:607
polybori::CDegTermStack::CDegTermStack
CDegTermStack(navigator navi, const manager_type &mgr)
Definition: CTermStack.h:748
polybori::CReverseTermStack::initLast
void initLast()
Definition: CTermStack.h:548
polybori::CBlockTermStack::followBlockDeg
void followBlockDeg()
Definition: CTermStack.h:919
polybori::CDegreeCache< BooleSet >::manager_type
base::manager_type manager_type
Definition: CDegreeCache.h:151
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::base
CTermStack< NavigatorType, Category, BaseType > base
Definition: CTermStack.h:591
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::maxOnThen
bool maxOnThen(deg_type deg) const
Definition: CTermStack.h:696
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::atEnd
bool atEnd() const
Definition: CTermStack.h:611
polybori::CReverseTermStack::CReverseTermStack
CReverseTermStack(const CReverseTermStack &rhs)
Copy constructor.
Definition: CTermStack.h:540
polybori::CReverseTermStack::base
CTermStack< NavigatorType, Category > base
Definition: CTermStack.h:531
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::idx_type
base::idx_type idx_type
Definition: CTermStack.h:593
polybori::CTermStack::iterator_category
Category iterator_category
Definition: CTermStack.h:362
polybori::cached_block_deg::cached_block_deg
cached_block_deg(const manager_type &mgr)
Definition: CTermStack.h:79
polybori::groebner::idx_type
polybori::CTypes::idx_type idx_type
Definition: groebner_defs.h:44
polybori::CTermStackBase::atBegin
bool atBegin() const
Definition: CTermStack.h:290
polybori::CReverseTermStack::increment
void increment()
Definition: CTermStack.h:549
polybori::CTermStack::incrementElse
void incrementElse()
Definition: CTermStack.h:404
polybori::CDegStackBase
Definition: CTermStack.h:669
polybori::CTermStackBase
This class defines an iterator for the monomials in a Boolean polynomial.
Definition: CTermStack.h:126
CDegreeCache.h
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::CDegStackBase
CDegStackBase(const CDegStackBase &rhs)
Definition: CTermStack.h:688
polybori::CDegreeCache< BooleSet >
polybori::CReverseTermStack::navigator
NavigatorType navigator
Definition: CTermStack.h:530
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::navigator
NavigatorType navigator
Definition: CTermStack.h:592
polybori::CTermStack::incrementValidElse
void incrementValidElse()
Definition: CTermStack.h:467
polybori::CDegTermStack::size_type
navigator::size_type size_type
Definition: CTermStack.h:743
polybori::CDegStackBase< NavigatorType, valid_tag, BlockProperty, BaseType >::base
CDegStackCore< NavigatorType, BlockProperty, std::forward_iterator_tag, BaseType > base
Definition: CTermStack.h:678
polybori::CTermStack::CTermStack
CTermStack(navigator navi, const Dummy &)
Definition: CTermStack.h:388
polybori::CTermStackBase::reference
stack_type::reference reference
Definition: CTermStack.h:149
polybori::CDegTermStack::followDeg
void followDeg()
Definition: CTermStack.h:760
polybori::CDegTermStack::base
CDegStackBase< NavigatorType, DescendingProperty, BlockProperty, BaseType > base
Definition: CTermStack.h:739
polybori::CBlockTermStack::followDeg
void followDeg()
Definition: CTermStack.h:921
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::CDegStackCore
CDegStackCore(const CDegStackCore &rhs)
Definition: CTermStack.h:602
polybori::CTermStack::CTermStack
CTermStack()
Default constructor.
Definition: CTermStack.h:376
polybori::CTermStackBase::clearOne
void clearOne()
Definition: CTermStack.h:273
polybori::CBlockTermStack::size_type
navigator::size_type size_type
Definition: CTermStack.h:876
polybori::CDegTermStack::manager_type
base::manager_type manager_type
Definition: CTermStack.h:745
polybori::CDegStackCore< NavigatorType, valid_tag, Category, BaseType >::gotoEnd
void gotoEnd()
Definition: CTermStack.h:656
polybori::CTermStackBase::begin
const_iterator begin() const
Definition: CTermStack.h:186
polybori::CTermStack::base
CTermStackBase< NavigatorType, BaseType > base
Definition: CTermStack.h:357
PBORI_UNLIKELY
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59
polybori::CTermStackBase::atEnd
bool atEnd() const
Definition: CTermStack.h:292
polybori::CTermStackBase::restart
void restart(navigator navi)
Definition: CTermStack.h:282
polybori::CTermStackBase::markOne
void markOne()
Definition: CTermStack.h:261
polybori::cached_block_deg::idx_type
NavigatorType::idx_type idx_type
Definition: CTermStack.h:66
polybori::cached_block_deg::block_iterator
block_idx_type::const_iterator block_iterator
Type for block iterators.
Definition: CTermStack.h:74
polybori::CTermStackBase::atEnd
bool atEnd(navigator navi) const
Definition: CTermStack.h:293
polybori::CBlockTermStack::incrementBlock
void incrementBlock()
Definition: CTermStack.h:933
polybori::valid_tag
This class shows, whether a property of an order is valid.
Definition: tags.h:32
polybori::CTermStackBase::top
const_reference top() const
Definition: CTermStack.h:179
polybori::CTermStackBase::rbegin
const_reverse_iterator rbegin() const
Definition: CTermStack.h:189
polybori::CReverseTermStack::CReverseTermStack
CReverseTermStack(navigator navi, const Dummy &)
Definition: CTermStack.h:545
BooleEnv.h
polybori::CDegTermStack::deg_type
navigator::deg_type deg_type
Definition: CTermStack.h:744
polybori::CTermStackBase::push
void push(navigator __x)
Definition: CTermStack.h:172
polybori::CTermStackBase::deg_type
navigator::deg_type deg_type
Definition: CTermStack.h:142