BoolePolyRing.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_BoolePolyRing_h_
#define polybori_BoolePolyRing_h_
// load PolyBoRi settings
# include <polybori/pbori_defs.h>
// include basic decision diagram manager interface
#include "ring/CCuddCore.h"
#include "except/PBoRiError.h"
#include "common/CCheckedIdx.h"
#include <boost/intrusive_ptr.hpp>
#include "common/CWeakPtr.h"
#include <list>
BEGIN_NAMESPACE_PBORI
class WeakRingPtr; // forward declaration
class BoolePolyRing:
public CTypes::orderenums_type, public CTypes::compenums_type,
public CTypes::auxtypes_type {
typedef BoolePolyRing self;
public:
friend class WeakRingPtr;
typedef class BooleExponent exp_type;
typedef class BooleMonomial monom_type;
typedef class BooleVariable var_type;
typedef class BooleSet dd_type;
typedef class BoolePolynomial poly_type;
typedef CTypes::ordercode_type ordercode_type;
typedef CTypes::vartext_type vartext_type;
typedef CCheckedIdx checked_idx_type;
typedef CCuddCore core_type;
typedef core_type::const_varname_reference const_varname_reference;
typedef boost::intrusive_ptr<core_type> core_ptr;
typedef core_type::order_type order_type;
typedef core_type::order_ptr order_ptr;
typedef order_type& order_reference;
typedef DdManager mgr_type;
using CTypes::orderenums_type::ordercodes;
typedef std::vector<idx_type> block_idx_type;
typedef block_idx_type::const_iterator block_iterator;
protected:
BoolePolyRing(const core_ptr& rhs): p_core(rhs) {}
explicit BoolePolyRing(const CWeakPtr<core_type>& rhs):
p_core(rhs.operator->()) { PBORI_ASSERT(p_core != NULL); }
public:
explicit BoolePolyRing(size_type nvars = 1,
ordercode_type order = lp);
BoolePolyRing(size_type nvars, const order_ptr& order):
p_core(new core_type(nvars, order)) {}
BoolePolyRing(const self& rhs): p_core(rhs.p_core) {}
~BoolePolyRing() {}
size_type nVariables() const { return p_core->m_mgr.nVariables(); }
vartext_type getVariableName(checked_idx_type idx) const {
return p_core->m_names[idx];
}
void setVariableName(checked_idx_type idx, vartext_type varname) {
p_core->m_names.set(idx, varname);
}
void clearCache() { p_core->m_mgr.cacheFlush(); }
ostream_type& print(ostream_type&) const;
hash_type hash() const {
return static_cast<hash_type>(reinterpret_cast<std::ptrdiff_t
>(getManager()));
}
hash_type id() const {
return static_cast<hash_type>(reinterpret_cast<std::ptrdiff_t>(p_core.operator->()));
}
order_reference ordering() const { return *(p_core->pOrder); }
mgr_type* getManager() const { return p_core->m_mgr.getManager(); }
self clone() const { return self(core_ptr(new core_type(*p_core))); }
void changeOrdering(ordercode_type);
poly_type coerce(const poly_type& rhs) const;
monom_type coerce(const monom_type& rhs) const;
var_type coerce(const var_type& rhs) const;
dd_type variableDiagram(checked_idx_type nvar) const;
var_type variable(checked_idx_type nvar) const;
dd_type zero() const;
dd_type one() const;
dd_type constant(bool is_one) const;
protected:
core_ptr core() const { return p_core; };
core_ptr p_core;
};
inline BoolePolyRing::ostream_type&
operator<<(BoolePolyRing::ostream_type& os, const BoolePolyRing& ring) {
return ring.print(os);
}
END_NAMESPACE_PBORI
#endif // of #ifndef polybori_BoolePolyRing_h_
polybori::BoolePolyRing::getManager
mgr_type * getManager() const
Get plain decision diagram manager.
Definition: BoolePolyRing.h:159
polybori::BoolePolyRing::order_reference
order_type & order_reference
Reference for handling mterm orderings.
Definition: BoolePolyRing.h:88
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::CCuddCore::const_varname_reference
variable_names_type::const_reference const_varname_reference
Define type for getting names of variables.
Definition: CCuddCore.h:63
polybori::COrderEnums::ordercodes
ordercodes
Codes For orderings.
Definition: pbori_defs.h:154
polybori::BoolePolyRing::vartext_type
CTypes::vartext_type vartext_type
Definition: BoolePolyRing.h:69
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::BoolePolyRing::const_varname_reference
core_type::const_varname_reference const_varname_reference
Definition: BoolePolyRing.h:77
CCuddCore.h
polybori::BoolePolyRing::checked_idx_type
CCheckedIdx checked_idx_type
Check indices bevor using.
Definition: BoolePolyRing.h:73
polybori::operator<<
BoolePolyRing::ostream_type & operator<<(BoolePolyRing::ostream_type &os, const BoolePolyRing &ring)
Stream output operator.
Definition: BoolePolyRing.h:201
polybori::COrderEnums
This struct contains type definitions and enumerations to be used for order codes.
Definition: pbori_defs.h:152
polybori::BoolePolyRing::clone
self clone() const
Construct ring with similiar properties (deep copy)
Definition: BoolePolyRing.h:162
polybori::BoolePolyRing::var_type
class BooleVariable var_type
set variables type
Definition: BoolePolyRing.h:59
polybori::BoolePolyRing::monom_type
class BooleMonomial monom_type
set monomial type
Definition: BoolePolyRing.h:56
polybori::COrderingBase
Definition: COrderingBase.h:43
polybori::BoolePolyRing
This class reinterprets decicion diagram managers as Boolean polynomial rings, adds an ordering and v...
Definition: BoolePolyRing.h:40
polybori::BoolePolyRing::core_type
CCuddCore core_type
Type of actual data.
Definition: BoolePolyRing.h:76
polybori::BoolePolyRing::block_idx_type
std::vector< idx_type > block_idx_type
Type for block indices.
Definition: BoolePolyRing.h:95
polybori::BoolePolyRing::ordercode_type
CTypes::ordercode_type ordercode_type
Definition: BoolePolyRing.h:68
polybori::BoolePolyRing::ordering
order_reference ordering() const
Access ordering of *this.
Definition: BoolePolyRing.h:156
polybori::CAuxTypes
This struct contains auxiliary type definitions.
Definition: pbori_defs.h:210
polybori::WeakRingPtr
This class defines WeakRingPtr.
Definition: WeakRingPtr.h:32
polybori::BoolePolynomial
This class wraps the underlying decicion diagram type and defines the necessary operations.
Definition: BoolePolynomial.h:85
polybori::BoolePolyRing::id
hash_type id() const
Get unique identifier for this ring.
Definition: BoolePolyRing.h:151
polybori::CCuddCore
This class prepares the CUDD's raw decision diagram manager structure for the use with instrinsive po...
Definition: CCuddCore.h:50
polybori::CAuxTypes::hash_type
std::size_t hash_type
Type for hashing.
Definition: pbori_defs.h:231
pbori_defs.h
polybori::BoolePolyRing::dd_type
class BooleSet dd_type
set decision diagram type
Definition: BoolePolyRing.h:62
polybori::BoolePolyRing::exp_type
class BooleExponent exp_type
define exponent type
Definition: BoolePolyRing.h:53
polybori::lp
Definition: embed.h:57
polybori::BoolePolyRing::clearCache
void clearCache()
Clears the function cache.
Definition: BoolePolyRing.h:139
CWeakPtr.h
polybori::DdManager
pbori_DdManager DdManager
Definition: traits.h:33
PBORI_ASSERT
#define PBORI_ASSERT(arg)
Definition: pbori_defs.h:118
polybori::BoolePolyRing::getVariableName
vartext_type getVariableName(checked_idx_type idx) const
Get name of variable with index idx.
Definition: BoolePolyRing.h:129
polybori::BoolePolyRing::nVariables
size_type nVariables() const
Get number of ring variables.
Definition: BoolePolyRing.h:126
polybori::BoolePolyRing::print
ostream_type & print(ostream_type &) const
Print out statistics and settings for current ring to output stream.
Definition: BoolePolyRing.cc:120
polybori::BoolePolyRing::order_ptr
core_type::order_ptr order_ptr
Smart pointer for handling mterm orderings.
Definition: BoolePolyRing.h:85
PBoRiError.h
CCheckedIdx.h
polybori::BoolePolyRing::setVariableName
void setVariableName(checked_idx_type idx, vartext_type varname)
Set name of variable with index idx.
Definition: BoolePolyRing.h:134
polybori::BoolePolyRing::~BoolePolyRing
~BoolePolyRing()
Destructor.
Definition: BoolePolyRing.h:123
polybori::BoolePolyRing::BoolePolyRing
BoolePolyRing(const CWeakPtr< core_type > &rhs)
Get strong reference from weak pointer (used by WeakRingPtr)
Definition: BoolePolyRing.h:107
polybori::CWeakPtr
Forward declaration of friend.
Definition: CWeakPtr.h:31
polybori::CAuxTypes::vartext_type
const char * vartext_type
Type for setting/getting names of variables.
Definition: pbori_defs.h:249
polybori::BoolePolyRing::BoolePolyRing
BoolePolyRing(const self &rhs)
Copy constructor (cheap)
Definition: BoolePolyRing.h:120
polybori::BoolePolyRing::hash
hash_type hash() const
Get unique identifier for manager of *this.
Definition: BoolePolyRing.h:145
polybori::BoolePolyRing::BoolePolyRing
BoolePolyRing(const core_ptr &rhs)
Definition: BoolePolyRing.h:104
polybori::CAuxTypes::size_type
std::size_t size_type
Type for lengths, dimensions, etc.
Definition: pbori_defs.h:219
polybori::CCuddCore::order_ptr
boost::shared_ptr< order_type > order_ptr
Smart pointer for handling mterm orderings.
Definition: CCuddCore.h:72
polybori::BooleSet
Definition: BooleSet.h:57
polybori::BooleMonomial
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleMonomial.h:50
polybori::BoolePolyRing::block_iterator
block_idx_type::const_iterator block_iterator
Type for block iterators.
Definition: BoolePolyRing.h:98
polybori::BoolePolyRing::mgr_type
DdManager mgr_type
Definition: BoolePolyRing.h:90
polybori::BooleVariable
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleVariable.h:39
polybori::CCompareEnums
This struct contains type definitions and enumerations to be used for comparisons.
Definition: pbori_defs.h:193
polybori::BoolePolyRing::core_ptr
boost::intrusive_ptr< core_type > core_ptr
Smart pointer to core.
Definition: BoolePolyRing.h:79
polybori::CCheckedIdx
This class defines CCheckedIdx.
Definition: CCheckedIdx.h:29
polybori::CAuxTypes::ordercode_type
int ordercode_type
Type for ordering codes.
Definition: pbori_defs.h:240
polybori::BoolePolyRing::BoolePolyRing
BoolePolyRing(size_type nvars, const order_ptr &order)
Constructor for nvars variables (and given pointer to ordering)
Definition: BoolePolyRing.h:116
polybori::BoolePolyRing::order_type
core_type::order_type order_type
Type for handling mterm orderings.
Definition: BoolePolyRing.h:82
polybori::BoolePolyRing::poly_type
class BoolePolynomial poly_type
set polynomial type
Definition: BoolePolyRing.h:65