PolyBoRi
ReductionStrategy.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_groebner_ReductionStrategy_h_
17 #define polybori_groebner_ReductionStrategy_h_
18 
19 // include basic definitions
20 #include "groebner_defs.h"
21 #include "polynomial_properties.h"
22 #include "PolyEntryVector.h"
23 #include "ReductionOptions.h"
24 #include "ReductionTerms.h"
25 #include "SetAssociatedMinimal.h"
26 
28 
35  public PolyEntryVector, public ReductionOptions, public ReductionTerms {
36  typedef ReductionStrategy self;
37 public:
38 
41  ReductionTerms(ring) { }
42 
44  void addGenerator(const PolyEntry& entry) {
45  PolyEntryVector::append(entry);
46  setupSetsForElement(back());
47  }
48 
51  void append(const PolyEntry& entry) { addGenerator(entry); }
52 
53  Polynomial nf(const Polynomial& p) const {
54  return (optRedTail? reducedNormalForm(p): headNormalForm(p));
55  }
56 
57  bool canRewrite(const Polynomial& p) const {
58  return is_rewriteable(p, minimalLeadingTerms);
59  }
60 
61  int select1(const Polynomial& p) const;
62  int select1(const Monomial& m) const;
63 
64  int select_short(const Polynomial& p) const {
65  return select_short_by_terms(p.leadDivisors());
66  }
67  int select_short(const Monomial& m) const {
68  return select_short_by_terms(m.divisors());
69  }
70 
71  Polynomial headNormalForm(const Polynomial& p) const;
72  Polynomial reducedNormalForm(const Polynomial& p) const;
73 
74  void llReduceAll();
75 
76  operator const PolyEntryVector&() const {
77  return static_cast<const PolyEntryVector&>(*this);
78  }
79 
80 protected:
81  void llReduce(const PolyEntry& entry, const Exponent& ll_e);
82 
83  int select_short_by_terms(const MonomialSet&) const;
84 
86  std::for_each(removed.expBegin(), removed.expEnd(),
88  }
89 
90  void setupSetsForElement(const PolyEntry& entry);
91 
92 
93  template <class Iterator, class CompareType>
94  size_type minimum(Iterator start, Iterator finish, const CompareType& comp)
95  const {
96  start = std::min_element(start, finish, comp);
97  if PBORI_UNLIKELY(start == finish)
98  return size_type(-1);
99 
100  return index(*start);
101  }
102 
103 };
104 
105 
106 inline bool
108 
109  return (!(strat.minimalLeadingTerms.hasTermOfVariables(lm)));//
110  // strat.generators.minimalLeadingTerms.intersect(lm.divisors()).isZero();
111 }
112 
113 
114 
115 
117 
118 #endif /* polybori_ReductionStrategy_h_ */