PolyBoRi
LLReductor.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_groebner_LLReductor_h_
17 #define polybori_groebner_LLReductor_h_
18 
19 #include "ll_red_nf.h"
20 
21 // include basic definitions
22 #include "groebner_defs.h"
23 
25 
26 // groebner_alg.h
27 MonomialSet recursively_insert(MonomialSet::navigator p,
28  idx_type idx, MonomialSet mset);
29 
34 class LLReductor:
35  public MonomialSet {
36 
37  typedef MonomialSet base;
38  typedef LLReductor self;
39 public:
41  LLReductor(const BoolePolyRing& ring): base(ring.one()) {}
42 
44  template <class Type>
45  LLReductor(const Type& value): base(value) { PBORI_ASSERT(!isZero()); }
46 
47 
49  bool isCompatible(const PolyEntry& entry) {
50 
51  PBORI_ASSERT (!isZero());
52  return (entry.leadDeg == 1) &&
53  (*(entry.p.navigation()) == entry.lead.firstIndex() ) &&
54  (!expBegin()->reducibleBy(entry.lead.firstIndex()));
55  }
56 
58  Polynomial update(const PolyEntry& entry) {
59  return (isCompatible(entry)? insert(entry): entry.p);
60  }
61 
62 private:
63  self& operator=(const self& rhs) {
64  return static_cast<self&>(static_cast<base&>(*this) = rhs);
65  }
66 
67  Polynomial insert(const PolyEntry& entry) {
68 
69  Polynomial poly = ll_red_nf(entry.p, *this);
70  PBORI_ASSERT(poly.lead() == entry.lead);
71 
72  operator=(recursively_insert(poly.navigation().elseBranch(),
73  entry.lead.firstIndex(),
74  ll_red_nf(*this, poly.set())));
75  return poly;
76  }
77 
78 };
79 
81 
82 #endif /* polybori_groebner_LLReductor_h_ */
navigator navigation() const
Navigate through structure.
Definition: BoolePolynomial.h:441
monom_type lead() const
Get leading term.
Definition: BoolePolynomial.cc:225
deg_type leadDeg
Definition: PolyEntryBase.h:59
Polynomial p
Definition: PolyEntryBase.h:54
#define END_NAMESPACE_PBORIGB
Definition: groebner_defs.h:16
LLReductor(const Type &value)
Construct copy or MonomialSet.
Definition: LLReductor.h:45
set_type set() const
Get corresponding subset of of the powerset over all variables.
Definition: BoolePolynomial.h:464
This class reinterprets decicion diagram managers as Boolean polynomial rings, adds an ordering and v...
Definition: BoolePolyRing.h:40
idx_type firstIndex() const
Definition: BooleMonomial.h:230
#define BEGIN_NAMESPACE_PBORIGB
Definition: groebner_defs.h:15
self elseBranch() const
Increment in else direction.
Definition: CCuddNavigator.h:98
This class defines PolyEntry.
Definition: PolyEntry.h:32
This class wraps the underlying decicion diagram type and defines the necessary operations.
Definition: BoolePolynomial.h:85
polybori::BooleSet MonomialSet
Definition: groebner_defs.h:45
MonomialSet recursively_insert(MonomialSet::navigator p, idx_type idx, MonomialSet mset)
Definition: groebner_alg.cc:368
Polynomial ll_red_nf(const Polynomial &p, const BooleSet &reductors)
Definition: ll_red_nf.h:63
#define PBORI_ASSERT(arg)
Definition: pbori_defs.h:118
LLReductor(const BoolePolyRing &ring)
Construct reductor from Ring.
Definition: LLReductor.h:41
Accessing .insert()
polybori::CTypes::idx_type idx_type
Definition: groebner_defs.h:44
Monomial lead
Definition: PolyEntryBase.h:55
Definition: BooleSet.h:57
Polynomial update(const PolyEntry &entry)
Insert polynomial if compatible, return updated polynomial.
Definition: LLReductor.h:58
bool isCompatible(const PolyEntry &entry)
Test whether polynomial is a compatible reductor element.
Definition: LLReductor.h:49
This class defines LLReductor.
Definition: LLReductor.h:34