BooleExponent.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_BooleExponent_h_
#define polybori_BooleExponent_h_
// include basic definitions
#include <polybori/pbori_defs.h>
// get definition of BoolePolynomial, BooleMonomial, and BooleVariable
#include <polybori/BooleMonomial.h>
#include <polybori/BooleVariable.h>
BEGIN_NAMESPACE_PBORI
class BooleExponent:
public CAuxTypes {
public:
//-------------------------------------------------------------------------
// types definitions
//-------------------------------------------------------------------------
typedef std::vector<idx_type> data_type;
typedef data_type::value_type value_type;
typedef data_type::iterator iterator;
typedef data_type::const_iterator const_iterator;
typedef data_type::reverse_iterator reverse_iterator;
typedef data_type::const_reverse_iterator const_reverse_iterator;
typedef BooleExponent self;
typedef BoolePolynomial poly_type;
typedef poly_type::ring_type ring_type;
typedef poly_type::var_type var_type;
typedef poly_type::monom_type monom_type;
typedef poly_type::set_type set_type;
typedef generate_index_map<self>::type idx_map_type;
typedef invalid_tag easy_equality_property;
BooleExponent();
BooleExponent(const self&);
// explicit BooleExponent(bool);
self& get(const monom_type&);
explicit BooleExponent(const monom_type& rhs);
~BooleExponent();
const_iterator begin() const { return m_data.begin(); }
const_iterator end() const { return m_data.end(); }
const_reverse_iterator rbegin() const { return m_data.rbegin(); }
const_reverse_iterator rend() const { return m_data.rend(); }
size_type size() const { return m_data.size(); }
void reserve(size_type nsize) { m_data.reserve(nsize); }
void resize(size_type nsize) { m_data.resize(nsize); }
deg_type deg() const { return size(); }
set_type divisors(const ring_type&) const;
set_type multiples(const self&, const ring_type&) const;
set_type multiples(const monom_type&) const;
hash_type stableHash() const {
return stable_term_hash(begin(), end());
}
hash_type hash() const { return stableHash(); }
self& changeAssign(idx_type);
self change(idx_type) const;
self& insert(idx_type);
self& push_back(idx_type idx);
self& remove(idx_type);
self insertConst(idx_type) const;
self removeConst(idx_type) const;
self divide(const self&) const;
self divideByIndex(const idx_type& rhs) const {
return (reducibleBy(rhs)? removeConst(rhs) : self() ); }
self divide(const var_type& rhs) const { return divideByIndex(rhs.index()); }
self divide(const monom_type&) const;
self multiply(const self&) const;
self multiply(const idx_type& rhs) const { return insertConst(rhs); }
self multiply(const var_type& rhs) const { return multiply(rhs.index()); }
self multiply(const monom_type&) const;
self multiplyFirst(const set_type&) const;
// /// @name Arithmetical operations
// //@{
// self& operator*=(const self&);
// self& operator/=(const self&);
// self& operator*=(const var_type&);
// self& operator/=(const var_type&);
// //@}
bool_type operator==(const self& rhs) const { return m_data == rhs.m_data; }
bool_type operator!=(const self& rhs) const { return m_data != rhs.m_data; }
self& operator=(const self& rhs) { m_data = rhs.m_data; return *this; }
self& operator=(const monom_type& rhs) {
m_data.resize(rhs.size());
std::copy(rhs.begin(), rhs.end(), internalBegin());
return *this;
}
bool_type reducibleBy(const self& rhs) const;
bool_type reducibleBy(const monom_type& rhs) const;
bool_type reducibleBy(const idx_type& rhs) const;
bool_type reducibleBy(const var_type& rhs) const {
return reducibleBy(rhs.index()); }
// /// Test for reducibility wrt. to a given variable
// bool_type reducibleBy(const var_type& rhs) const;
deg_type LCMDeg(const self&) const;
self LCM(const self&) const;
//self& GCDAssign(const self&);
self GCD(const self&) const;
self& popFirst() {
if(!m_data.empty())
m_data.erase(m_data.begin());
return *this;
}
ostream_type& print(ostream_type&) const;
protected:
iterator internalBegin() { return m_data.begin(); }
iterator internalEnd() { return m_data.end(); }
reverse_iterator rInternalBegin() { return m_data.rbegin(); }
reverse_iterator rInternalEnd() { return m_data.rend(); }
data_type m_data;
};
template <class RHSType>
inline BooleExponent
operator+(const BooleExponent& lhs, const RHSType& rhs) {
return lhs.multiply(rhs);
}
template <class RHSType>
inline BooleExponent
operator-(const BooleExponent& lhs, const RHSType& rhs) {
return lhs.divide(rhs);
}
inline BooleExponent
GCD(const BooleExponent& lhs, const BooleExponent& rhs ){
return lhs.GCD(rhs);
}
inline BooleExponent
LCM(const BooleExponent& lhs, const BooleExponent& rhs ){
return lhs.LCM(rhs);
}
inline BooleExponent::ostream_type&
operator<<(BooleExponent::ostream_type& os, const BooleExponent& rhs) {
return rhs.print(os);
}
END_NAMESPACE_PBORI
#endif // of polybori_BooleExponent_h_
polybori::invalid_tag
This class shows, whether a property of an order is invalid.
Definition: tags.h:27
polybori::BooleExponent::set_type
poly_type::set_type set_type
Type of sets of Boolean variables.
Definition: BooleExponent.h:73
polybori::BooleExponent::divide
self divide(const var_type &rhs) const
Definition: BooleExponent.h:163
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::BooleExponent::stableHash
hash_type stableHash() const
Hash value for the exponent.
Definition: BooleExponent.h:130
polybori::BooleExponent::GCD
self GCD(const self &) const
Compute the greatest common divisor and assign.
Definition: BooleExponent.cc:303
polybori::BooleExponent::rInternalBegin
reverse_iterator rInternalBegin()
Start reverse iteration over indices (constant access)
Definition: BooleExponent.h:241
polybori::BooleExponent::poly_type
BoolePolynomial poly_type
Type of Boolean polynomials.
Definition: BooleExponent.h:61
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::BooleExponent::begin
const_iterator begin() const
Start iteration over indices (constant access)
Definition: BooleExponent.h:97
polybori::BooleExponent::monom_type
poly_type::monom_type monom_type
Type of Boolean variables.
Definition: BooleExponent.h:70
polybori::BooleExponent::multiply
self multiply(const var_type &rhs) const
Definition: BooleExponent.h:170
polybori::BooleExponent::LCM
self LCM(const self &) const
Compute the greatest common divisor.
Definition: BooleExponent.cc:319
polybori::CAuxTypes::deg_type
int deg_type
Type for polynomial degrees (ranges from -1 to maxint)
Definition: pbori_defs.h:222
polybori::BooleExponent::operator=
self & operator=(const self &rhs)
Assignment operation.
Definition: BooleExponent.h:190
polybori::BooleExponent::value_type
data_type::value_type value_type
Generic access to actual data.
Definition: BooleExponent.h:47
polybori::groebner::deg_type
int deg_type
Definition: groebner_defs.h:42
polybori::LCM
BooleExponent LCM(const BooleExponent &lhs, const BooleExponent &rhs)
Compute the greatest common divisor of two monomials.
Definition: BooleExponent.h:274
polybori::BooleMonomial::begin
const_iterator begin() const
Start iteration over indices.
Definition: BooleMonomial.h:130
polybori::operator+
BooleExponent operator+(const BooleExponent &lhs, const RHSType &rhs)
Multiplication of monomials.
Definition: BooleExponent.h:254
polybori::stable_term_hash
void stable_term_hash(HashType &seed, Iterator start, Iterator finish)
Definition: pbori_routines_hash.h:83
polybori::push_back
Accessing .push_back()
Definition: pbori_func.h:48
polybori::BooleExponent::iterator
data_type::iterator iterator
Definition: BooleExponent.h:51
polybori::BooleExponent::easy_equality_property
invalid_tag easy_equality_property
This type has no easy equality check.
Definition: BooleExponent.h:79
polybori::BooleExponent::popFirst
self & popFirst()
Removes the first index from exponent.
Definition: BooleExponent.h:224
polybori::BooleExponent::divideByIndex
self divideByIndex(const idx_type &rhs) const
Definition: BooleExponent.h:160
polybori::BooleExponent::ring_type
poly_type::ring_type ring_type
Type of Boolean variables.
Definition: BooleExponent.h:64
polybori::BoolePolyRing
This class reinterprets decicion diagram managers as Boolean polynomial rings, adds an ordering and v...
Definition: BoolePolyRing.h:40
polybori::BooleMonomial::end
const_iterator end() const
Finish iteration over indices.
Definition: BooleMonomial.h:133
polybori::operator-
BooleExponent operator-(const BooleExponent &lhs, const RHSType &rhs)
Division of monomials.
Definition: BooleExponent.h:261
polybori::BooleExponent::internalEnd
iterator internalEnd()
Finish iteration over indices (constant access)
Definition: BooleExponent.h:238
polybori::BooleExponent::print
ostream_type & print(ostream_type &) const
Print current polynomial to output stream.
Definition: BooleExponent.cc:428
change
Accessing .change()
polybori::CAuxTypes
This struct contains auxiliary type definitions.
Definition: pbori_defs.h:210
polybori::BooleExponent::operator==
bool_type operator==(const self &rhs) const
Definition: BooleExponent.h:185
polybori::BooleVariable::index
idx_type index() const
Get index of the variable.
Definition: BooleVariable.h:74
polybori::BooleExponent::operator=
self & operator=(const monom_type &rhs)
Definition: BooleExponent.h:191
polybori::BoolePolynomial
This class wraps the underlying decicion diagram type and defines the necessary operations.
Definition: BoolePolynomial.h:85
polybori::BooleExponent::reducibleBy
bool_type reducibleBy(const var_type &rhs) const
Definition: BooleExponent.h:201
polybori::CAuxTypes::hash_type
std::size_t hash_type
Type for hashing.
Definition: pbori_defs.h:231
polybori::operator<<
BooleExponent::ostream_type & operator<<(BooleExponent::ostream_type &os, const BooleExponent &rhs)
Stream output operator.
Definition: BooleExponent.h:282
BooleVariable.h
pbori_defs.h
polybori::BooleExponent::idx_map_type
generate_index_map< self >::type idx_map_type
Type for index maps.
Definition: BooleExponent.h:76
polybori::groebner::multiply
Polynomial multiply(const Polynomial &p, const Polynomial &q)
Definition: ll_red_nf.h:34
polybori::BooleExponent::resize
void resize(size_type nsize)
Drop compoents from the nsize-th element on.
Definition: BooleExponent.h:115
polybori::BooleExponent::divide
self divide(const self &) const
Corresponds to division of monomials.
Definition: BooleExponent.cc:268
polybori::BooleExponent::rInternalEnd
reverse_iterator rInternalEnd()
Finish reverse iteration over indices (constant access)
Definition: BooleExponent.h:244
polybori::CAuxTypes::idx_type
int idx_type
Type for indices.
Definition: pbori_defs.h:228
polybori::BooleExponent::hash
hash_type hash() const
For the exponent we only have one type of hashes.
Definition: BooleExponent.h:135
polybori::BooleExponent::end
const_iterator end() const
Finish iteration over indices (constant access)
Definition: BooleExponent.h:100
BooleMonomial.h
polybori::generate_index_map::type
std::map< Type, idx_type > type
Type for index maps.
Definition: pbori_func.h:642
polybori::BooleExponent::rend
const_reverse_iterator rend() const
Finish reverse iteration over indices (constant access)
Definition: BooleExponent.h:106
polybori::BooleExponent::const_reverse_iterator
data_type::const_reverse_iterator const_reverse_iterator
Definition: BooleExponent.h:54
insert
Accessing .insert()
polybori::BooleExponent::reverse_iterator
data_type::reverse_iterator reverse_iterator
Definition: BooleExponent.h:53
polybori::BooleMonomial::size
size_type size() const
Size of the exponents.
Definition: BooleMonomial.h:151
polybori::BooleExponent::var_type
poly_type::var_type var_type
Type of Boolean variables.
Definition: BooleExponent.h:67
polybori::groebner::idx_type
polybori::CTypes::idx_type idx_type
Definition: groebner_defs.h:44
polybori::BooleExponent::m_data
data_type m_data
The actual exponent indices.
Definition: BooleExponent.h:247
polybori::CAuxTypes::size_type
std::size_t size_type
Type for lengths, dimensions, etc.
Definition: pbori_defs.h:219
polybori::BooleExponent::reserve
void reserve(size_type nsize)
Prepare memory for exponents.
Definition: BooleExponent.h:112
polybori::BooleExponent::const_iterator
data_type::const_iterator const_iterator
Definition: BooleExponent.h:52
polybori::GCD
BooleExponent GCD(const BooleExponent &lhs, const BooleExponent &rhs)
Compute the greatest common divisor of two monomials.
Definition: BooleExponent.h:267
polybori::BooleExponent::rbegin
const_reverse_iterator rbegin() const
Start reverse iteration over indices (constant access)
Definition: BooleExponent.h:103
polybori::BooleSet
Definition: BooleSet.h:57
polybori::BooleExponent::multiply
self multiply(const idx_type &rhs) const
Definition: BooleExponent.h:169
polybori::BooleMonomial
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleMonomial.h:50
polybori::BooleExponent::size
size_type size() const
Degree of the corresponding monomial.
Definition: BooleExponent.h:109
polybori::BooleExponent::operator!=
bool_type operator!=(const self &rhs) const
Definition: BooleExponent.h:186
polybori::CAuxTypes::bool_type
bool bool_type
Type for standard true/false statements.
Definition: pbori_defs.h:216
polybori::BooleExponent::internalBegin
iterator internalBegin()
Start iteration over indices (constant access)
Definition: BooleExponent.h:235
polybori::BooleVariable
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleVariable.h:39
polybori::BooleExponent::data_type
std::vector< idx_type > data_type
Define the underlying data structure.
Definition: BooleExponent.h:44
polybori::BooleExponent::deg
deg_type deg() const
Degree of the corresponding monomial.
Definition: BooleExponent.h:118
polybori::BooleExponent::multiply
self multiply(const self &) const
Corresponds to multiplication of monomials.
Definition: BooleExponent.cc:349