CTermGenerator.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_iterators_CTermGenerator_h_
#define polybori_iterators_CTermGenerator_h_
// include basic definitions
#include <polybori/pbori_defs.h>
// include polybori functionals
#include <polybori/routines/pbori_func.h>
//#include <polybori/BooleSet.h>
BEGIN_NAMESPACE_PBORI
template <class TermType, class BehaviourTag>
class CTermGeneratorBase__;
class BooleExponent;
template <class TermType>
class CTermGeneratorBase__<TermType, type_tag<BooleExponent> > {
public:
typedef TermType value_type;
typedef value_type result_type;
template <class SequenceType>
result_type operator()(const SequenceType& seq) const{
value_type result;
result.reserve(seq.deg());
typename SequenceType::const_iterator
start(seq.begin()), finish(seq.end());
while (start != finish){
result.push_back(*start);
++start;
}
return result;
}
};
template <class TermType>
class CTermGeneratorBase__<TermType, type_tag<CTypes::size_type> > {
public:
typedef TermType value_type;
typedef value_type result_type;
template <class SequenceType>
result_type operator()(const SequenceType& seq) const{
return seq.deg();
}
};
template <class TermType>
class CTermGeneratorBase__<TermType, type_tag<CTypes::deg_type> > {
public:
typedef TermType value_type;
typedef value_type result_type;
template <class SequenceType>
result_type operator()(const SequenceType& seq) const{
return seq.deg();
}
};
template <class TermType>
class CTermGeneratorBase__<TermType, type_tag<BooleMonomial> >{
public:
typedef TermType value_type;
typedef value_type result_type;
// typedef CTypes::manager_base manager_base;
typedef BoolePolyRing data_type;
typedef data_type::dd_type dd_type;
// typedef CTypes::manager_base data_type;
data_type m_data;
CTermGeneratorBase__(const data_type& data): m_data(data) {}
CTermGeneratorBase__(): m_data() {}
template <class SequenceType>
result_type operator()(const SequenceType& seq) const {
// Do not dereference empty sequence (corresponds to end())
PBORI_ASSERT(!seq.isZero());
// @todo: avoid using manager_base here
typedef typename value_type::ring_type ring_type;
// value_type result((ring_type)manager_type(m_data));
value_type result((ring_type)(m_data));
typename SequenceType::stack_reverse_iterator
start(seq.stackRBegin()), finish(seq.stackREnd());
#ifndef PBORI_NO_TERMS_BY_TAIL
typename BooleSet::navigator navi(result.diagram().navigation());
PBORI_ASSERT((start == finish) || !start->isConstant());
while((start != finish) &&
(start->elseBranch().isEmpty()) && (start->thenBranch() == navi) ) {
navi = *start;
++start;
}
result = value_type(dd_type(m_data, navi));
#endif
while (start != finish){
result = result.change(**start);
++start;
}
return result;
}
};
template <class TermType>
class CTermGeneratorBase:
public CTermGeneratorBase__<TermType, type_tag<TermType> > {
};
template <class TermType>
class CTermGenerator:
public CTermGeneratorBase<TermType> {
public:
typedef CTermGeneratorBase<TermType> base;
typedef BoolePolyRing data_type;
CTermGenerator(const data_type&): base() {}
CTermGenerator(const CTermGenerator& rhs): base(rhs) {}
CTermGenerator(): base() {}
};
template <>
class CTermGenerator<BooleMonomial>:
public CTermGeneratorBase__<BooleMonomial, type_tag<BooleMonomial> > {
public:
typedef BooleMonomial term_type;
typedef CTermGeneratorBase__<BooleMonomial, type_tag<BooleMonomial> > base;
//typedef CTermGeneratorBase<term_type> base;
typedef base::data_type data_type;
CTermGenerator(const data_type& data): base(data) {}
CTermGenerator(const CTermGenerator& rhs): base(rhs) {}
// CTermGenerator(): base() {}
};
END_NAMESPACE_PBORI
#endif
polybori::CTermGeneratorBase__< TermType, type_tag< BooleMonomial > >::result_type
value_type result_type
Definition: CTermGenerator.h:95
polybori::BooleExponent
This class is just a wrapper for using variables for storing indices as interim data structure for Bo...
Definition: BooleExponent.h:34
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
polybori::CTermGeneratorBase__< TermType, type_tag< CTypes::deg_type > >::value_type
TermType value_type
Definition: CTermGenerator.h:77
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::groebner::deg_type
int deg_type
Definition: groebner_defs.h:42
polybori::CTermGeneratorBase__< TermType, type_tag< BooleMonomial > >::data_type
BoolePolyRing data_type
Definition: CTermGenerator.h:100
polybori::CTermGeneratorBase__< TermType, type_tag< BooleMonomial > >::operator()
result_type operator()(const SequenceType &seq) const
Definition: CTermGenerator.h:112
polybori::CTermGenerator::base
CTermGeneratorBase< TermType > base
Definition: CTermGenerator.h:161
polybori::CTermGeneratorBase__< TermType, type_tag< BooleMonomial > >::CTermGeneratorBase__
CTermGeneratorBase__(const data_type &data)
CCuddCore * m_data; // non-save variant.
Definition: CTermGenerator.h:107
polybori::BoolePolyRing
This class reinterprets decicion diagram managers as Boolean polynomial rings, adds an ordering and v...
Definition: BoolePolyRing.h:40
polybori::CTermGenerator< BooleMonomial >::term_type
BooleMonomial term_type
Definition: CTermGenerator.h:176
polybori::CTermGeneratorBase__< TermType, type_tag< BooleExponent > >::operator()
result_type operator()(const SequenceType &seq) const
Definition: CTermGenerator.h:46
pbori_func.h
polybori::CTermGenerator< BooleMonomial >::data_type
base::data_type data_type
Definition: CTermGenerator.h:179
polybori::CTermGeneratorBase__< TermType, type_tag< BooleMonomial > >::m_data
data_type m_data
Definition: CTermGenerator.h:104
polybori::CTermGenerator
Definition: CTermGenerator.h:158
polybori::CTermGeneratorBase__< TermType, type_tag< BooleMonomial > >::value_type
TermType value_type
Definition: CTermGenerator.h:94
polybori::type_tag
This class marks a given type.
Definition: pbori_func.h:613
polybori::CTermGeneratorBase__< TermType, type_tag< CTypes::size_type > >::result_type
value_type result_type
Definition: CTermGenerator.h:65
pbori_defs.h
polybori::CTermGeneratorBase__< TermType, type_tag< BooleMonomial > >::dd_type
data_type::dd_type dd_type
Definition: CTermGenerator.h:101
polybori::BoolePolyRing::dd_type
class BooleSet dd_type
set decision diagram type
Definition: BoolePolyRing.h:62
polybori::CTermGenerator< BooleMonomial >::CTermGenerator
CTermGenerator(const CTermGenerator &rhs)
Definition: CTermGenerator.h:182
polybori::CTermGenerator::data_type
BoolePolyRing data_type
Definition: CTermGenerator.h:163
polybori::CTermGeneratorBase
Definition: CTermGenerator.h:151
polybori::CTermGeneratorBase__
Definition: CTermGenerator.h:34
PBORI_ASSERT
#define PBORI_ASSERT(arg)
Definition: pbori_defs.h:118
polybori::CTermGeneratorBase__< TermType, type_tag< BooleMonomial > >::CTermGeneratorBase__
CTermGeneratorBase__()
Definition: CTermGenerator.h:109
polybori::CTermGeneratorBase__< TermType, type_tag< BooleExponent > >::value_type
TermType value_type
Definition: CTermGenerator.h:42
polybori::CTermGeneratorBase__< TermType, type_tag< CTypes::size_type > >::value_type
TermType value_type
Definition: CTermGenerator.h:64
polybori::CTermGeneratorBase__< TermType, type_tag< CTypes::size_type > >::operator()
result_type operator()(const SequenceType &seq) const
Definition: CTermGenerator.h:68
polybori::CTermGeneratorBase__< TermType, type_tag< CTypes::deg_type > >::operator()
result_type operator()(const SequenceType &seq) const
Definition: CTermGenerator.h:81
polybori::CTermGenerator< BooleMonomial >::CTermGenerator
CTermGenerator(const data_type &data)
Definition: CTermGenerator.h:181
polybori::CTermGenerator< BooleMonomial >::base
CTermGeneratorBase__< BooleMonomial, type_tag< BooleMonomial > > base
Definition: CTermGenerator.h:177
polybori::CCuddNavigator
This class defines an iterator for navigating through then and else branches of ZDDs.
Definition: CCuddNavigator.h:36
polybori::BooleMonomial
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleMonomial.h:50
polybori::CTermGeneratorBase__< TermType, type_tag< BooleExponent > >::result_type
value_type result_type
Definition: CTermGenerator.h:43
polybori::CTermGenerator::CTermGenerator
CTermGenerator(const CTermGenerator &rhs)
Definition: CTermGenerator.h:166
polybori::CTypes
This struct contains type definitions to be used in library classes.
Definition: pbori_defs.h:269
polybori::CTermGeneratorBase__< TermType, type_tag< CTypes::deg_type > >::result_type
value_type result_type
Definition: CTermGenerator.h:78
polybori::CTermGenerator::CTermGenerator
CTermGenerator(const data_type &)
Definition: CTermGenerator.h:165
polybori::CTermGenerator::CTermGenerator
CTermGenerator()
Definition: CTermGenerator.h:167