16 #ifndef polybori_groebner_PolyEntryIndices_h_
17 #define polybori_groebner_PolyEntryIndices_h_
45 lm2Index(), exp2Index() {}
50 lm2Index[entry.
lead] = rhs;
57 lm2Index_map_type::iterator lm_pos = lm2Index.find(key);
59 lm2Index[entry.
lead] = lm_pos->second;
60 exp2Index[entry.
leadExp] = lm_pos->second;
61 lm2Index.erase(lm_pos);
62 exp2Index.erase(exp2Index.find(key.
exp()));
67 template <
class KeyType>
69 return get(key, uncheck());
73 template <
class KeyType>
74 data_type
checked(
const KeyType& key)
const {
75 return get(key, check());
81 template <
class CheckType>
82 data_type
get(data_type key, CheckType)
const {
return key; }
84 template <
class CheckType>
85 data_type
get(
const Exponent& key, CheckType dummy)
const {
86 return get(exp2Index, key, dummy);
89 template <
class CheckType>
90 data_type
get(
const Monomial& key, CheckType dummy)
const {
91 return get(lm2Index, key, dummy);
94 template <
class CheckType>
95 data_type
get(
const PolyEntry& key, CheckType dummy)
const {
96 return get(lm2Index, key.lead, dummy);
99 template <
class MapType,
class KeyType>
100 data_type
get(
const MapType& map,
const KeyType& key, check)
const {
102 typename MapType::const_iterator result(map.find(key));
104 if (result == map.end())
105 return (data_type)-1;
108 return result->second;
111 template <
class MapType,
class KeyType>
112 data_type
get(
const MapType& map,
const KeyType& key, uncheck)
const {
114 typename MapType::const_iterator result(map.find(key));
116 return result->second;
120 lm2Index_map_type lm2Index;
121 exp2Index_map_type exp2Index;
Monomial::idx_map_type lm2Index_map_type
Definition: PolyEntryIndices.h:25
This class is just a wrapper for using variables for storing indices as interim data structure for Bo...
Definition: BooleExponent.h:34
value_type::second_type data_type
Definition: PolyEntryIndices.h:42
std::map< self, idx_type, symmetric_composition< std::less< poly_type::navigator >, navigates< poly_type > > > idx_map_type
Type for index maps.
Definition: BooleMonomial.h:98
#define END_NAMESPACE_PBORIGB
Definition: groebner_defs.h:16
Monomial::idx_map_type lm2Index_map_type
Definition: PolyEntryIndices.h:39
Exponent::idx_map_type exp2Index_map_type
Definition: PolyEntryIndices.h:40
#define BEGIN_NAMESPACE_PBORIGB
Definition: groebner_defs.h:15
void update(const Monomial &key, const PolyEntry &entry)
Consistently replacing keys.
Definition: PolyEntryIndices.h:54
This class defines PolyEntry.
Definition: PolyEntry.h:32
lm2Index_map_type::value_type value_type
Definition: PolyEntryIndices.h:41
Exponent::idx_map_type exp2Index_map_type
Definition: PolyEntryIndices.h:26
This class defines PolyEntryIndices.
Definition: PolyEntryIndices.h:33
generate_index_map< self >::type idx_map_type
Type for index maps.
Definition: BooleExponent.h:76
data_type checked(const KeyType &key) const
Savely looking up indices, returns -1 if key is invalid.
Definition: PolyEntryIndices.h:74
#define PBORI_ASSERT(arg)
Definition: pbori_defs.h:118
Exponent leadExp
Definition: PolyEntryBase.h:60
data_type operator()(const KeyType &key) const
Lookup indices.
Definition: PolyEntryIndices.h:68
PolyEntryIndices()
Definition: PolyEntryIndices.h:44
exp_type exp() const
Get exponent vector.
Definition: BooleMonomial.cc:256
void insert(const PolyEntry &entry, const data_type &rhs)
Consistently inserting element.
Definition: PolyEntryIndices.h:48
Monomial lead
Definition: PolyEntryBase.h:55
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleMonomial.h:50
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59