CBlockOrderingFacade.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_orderings_CBlockOrderingFacade_h_
#define polybori_orderings_CBlockOrderingFacade_h_
#include "COrderingFacade.h"
BEGIN_NAMESPACE_PBORI
template <class OrderType, class OrderTag>
class CBlockOrderingFacade:
public COrderingFacade <OrderType, OrderTag> {
typedef CBlockOrderingFacade self;
typedef COrderingFacade<OrderType, OrderTag> base_type;
public:
typedef self base;
typedef typename base_type::order_lead_tag order_lead_tag;
typedef typename base_type::poly_type poly_type;
typedef typename base_type::monom_type monom_type;
typedef typename base_type::exp_type exp_type;
typedef typename base_type::deg_type deg_type;
typedef typename base_type::set_type set_type;
typedef typename base_type::comp_type comp_type;
CBlockOrderingFacade(): base_type(), m_indices() {
m_indices.push_back(0);
m_indices.push_back(CTypes::max_index());
};
CBlockOrderingFacade(const self& rhs): base_type(rhs), m_indices(rhs.m_indices) {};
~CBlockOrderingFacade() = 0;
COrderingBase::block_iterator blockBegin() const { return m_indices.begin() + 1; }
COrderingBase::block_iterator blockEnd() const { return m_indices.end(); }
void appendBlock(COrderingBase::checked_idx_type idx) {
// by checked_idx_type idx should always be <= max(int) (== blockEnd() - 1)
PBORI_ASSERT(idx <= *(blockEnd() - 1));
if PBORI_UNLIKELY((idx >= CTypes::max_index()) || (idx <= *(blockEnd() - 2)))
throw std::runtime_error("Blocks must be positive and have to be "
"added in a strictly increasing order.");
m_indices.back() = idx;
m_indices.push_back(CTypes::max_index());
}
void clearBlocks() {
m_indices.clear();
m_indices.push_back(0);
m_indices.push_back(CTypes::max_index());
}
monom_type lead(const poly_type& poly) const {
CBlockDegreeCache<set_type> blockDegCache(poly.ring());
CacheManager<order_lead_tag> cache_mgr(poly.ring());
typename base_type::descending_property descending;
return base_type::monom( dd_block_degree_lead(cache_mgr, blockDegCache,
poly.navigation(), m_indices.begin(),
set_type(poly.ring()), descending) );
}
monom_type lead(const poly_type& poly, deg_type) const {
return lead(poly);
}
exp_type leadExp(const poly_type& poly) const {
return lead(poly).exp();
}
exp_type leadExp(const poly_type& poly, deg_type) const {
return leadExp(poly);
}
protected:
template <class TermType, class BinOpType>
comp_type compare_terms(const TermType& lhs, const TermType& rhs,
const BinOpType& idx_comparer) const {
return block_dlex_compare(lhs.begin(), lhs.end(),rhs.begin(), rhs.end(),
blockBegin(), blockEnd(), idx_comparer);
}
COrderingBase::block_idx_type m_indices;
};
template <class OrderType, class OrderTag>
inline CBlockOrderingFacade<OrderType, OrderTag>::~CBlockOrderingFacade() {}
END_NAMESPACE_PBORI
#endif
polybori::invalid_tag
This class shows, whether a property of an order is invalid.
Definition: tags.h:27
polybori::CBlockOrderingFacade::m_indices
COrderingBase::block_idx_type m_indices
index data
Definition: CBlockOrderingFacade.h:128
polybori::block_dlex_compare
CTypes::comp_type block_dlex_compare(LhsIterator lhsStart, LhsIterator lhsFinish, RhsIterator rhsStart, RhsIterator rhsFinish, Iterator start, Iterator finish, BinaryPredicate idx_comp)
Definition: pbori_routines_order.h:414
polybori::CBlockOrderingFacade::poly_type
base_type::poly_type poly_type
Definition: CBlockOrderingFacade.h:42
polybori::CBlockOrderingFacade::exp_type
base_type::exp_type exp_type
Definition: CBlockOrderingFacade.h:44
polybori::BooleExponent
This class is just a wrapper for using variables for storing indices as interim data structure for Bo...
Definition: BooleExponent.h:34
polybori::BoolePolynomial::navigation
navigator navigation() const
Navigate through structure.
Definition: BoolePolynomial.h:441
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::COrderingFacade
This class initialize the interface for orderings of CDynamicOrderBase for a given OrderType...
Definition: COrderingFacade.h:43
polybori::CacheManager
Definition: CacheManager.h:31
polybori::CAuxTypes::deg_type
int deg_type
Type for polynomial degrees (ranges from -1 to maxint)
Definition: pbori_defs.h:222
COrderingFacade.h
polybori::BoolePolynomial::ring
const ring_type & ring() const
Access ring, where this belongs to.
Definition: BoolePolynomial.h:478
polybori::CBlockOrderingFacade::base
self base
*this is to be used as base for OrderType only
Definition: CBlockOrderingFacade.h:37
polybori::CBlockOrderingFacade
This class implements block orderings for COrderingFacade. OrderType must inherit from COrderingFacad...
Definition: CBlockOrderingFacade.h:28
polybori::CAuxTypes::comp_type
short int comp_type
Type for comparisons.
Definition: pbori_defs.h:237
polybori::CBlockOrderingFacade::order_lead_tag
base_type::order_lead_tag order_lead_tag
Definition: CBlockOrderingFacade.h:41
polybori::CBlockOrderingFacade::lead
monom_type lead(const poly_type &poly) const
generic block lead
Definition: CBlockOrderingFacade.h:88
polybori::CBlockOrderingFacade::CBlockOrderingFacade
CBlockOrderingFacade(const self &rhs)
Copy Constructor.
Definition: CBlockOrderingFacade.h:57
polybori::CBlockOrderingFacade::deg_type
base_type::deg_type deg_type
Definition: CBlockOrderingFacade.h:45
polybori::CBlockOrderingFacade::monom_type
base_type::monom_type monom_type
Definition: CBlockOrderingFacade.h:43
polybori::BoolePolynomial
This class wraps the underlying decicion diagram type and defines the necessary operations.
Definition: BoolePolynomial.h:85
polybori::CBlockOrderingFacade::leadExp
exp_type leadExp(const poly_type &poly) const
Extraction of leading exponent - just using lead.
Definition: CBlockOrderingFacade.h:106
polybori::COrderingBase::block_iterator
block_idx_type::const_iterator block_iterator
Type for block iterators.
Definition: COrderingBase.h:68
polybori::CBlockOrderingFacade::set_type
base_type::set_type set_type
Definition: CBlockOrderingFacade.h:46
polybori::CBlockOrderingFacade::blockBegin
COrderingBase::block_iterator blockBegin() const
Definition: CBlockOrderingFacade.h:64
polybori::CBlockOrderingFacade::lead
monom_type lead(const poly_type &poly, deg_type) const
Definition: CBlockOrderingFacade.h:101
polybori::COrderingBase::block_idx_type
std::vector< idx_type > block_idx_type
Type for block indices.
Definition: COrderingBase.h:65
PBORI_ASSERT
#define PBORI_ASSERT(arg)
Definition: pbori_defs.h:118
polybori::CBlockOrderingFacade::comp_type
base_type::comp_type comp_type
Definition: CBlockOrderingFacade.h:47
polybori::CBlockDegreeCache
Definition: CDegreeCache.h:258
polybori::CBlockOrderingFacade::appendBlock
void appendBlock(COrderingBase::checked_idx_type idx)
Definition: CBlockOrderingFacade.h:67
polybori::CBlockOrderingFacade::CBlockOrderingFacade
CBlockOrderingFacade()
Default Constructor.
Definition: CBlockOrderingFacade.h:51
polybori::dd_block_degree_lead
TermType dd_block_degree_lead(const CacheType &cache_mgr, const DegCacheMgr &deg_mgr, NaviType navi, Iterator block_iter, TermType init, SizeType degree, DescendingProperty prop)
Definition: pbori_routines_order.h:325
polybori::BooleSet
Definition: BooleSet.h:57
polybori::CBlockOrderingFacade::blockEnd
COrderingBase::block_iterator blockEnd() const
Definition: CBlockOrderingFacade.h:65
polybori::BooleMonomial
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleMonomial.h:50
polybori::CBlockOrderingFacade::compare_terms
comp_type compare_terms(const TermType &lhs, const TermType &rhs, const BinOpType &idx_comparer) const
Comparison of monomials/expoinents template.
Definition: CBlockOrderingFacade.h:120
polybori::CCacheTypes::lead_tag
Definition: CCacheManagement.h:41
PBORI_UNLIKELY
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59
polybori::CBlockOrderingFacade::clearBlocks
void clearBlocks()
Definition: CBlockOrderingFacade.h:80
polybori::CCheckedIdx
This class defines CCheckedIdx.
Definition: CCheckedIdx.h:29
polybori::CBlockOrderingFacade::leadExp
exp_type leadExp(const poly_type &poly, deg_type) const
Definition: CBlockOrderingFacade.h:112