PolyBoRi
PairE.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_groebner_PairE_h_
17 #define polybori_groebner_PairE_h_
18 
19 // include basic definitions
20 #include "groebner_defs.h"
21 
23 
28 class PairE{
29 private:
30  int type;
31 public:
32  int getType() const{
33  return type;
34  }
37  //three sorts of pairs
38  //x*poly, poly, i,j
40  Exponent lm; //must not be the real lm, can be lm of syzygy or something else
41 
42  PairE(const PairE& rhs):
43  type(rhs.getType()), wlen(rhs.wlen), sugar(rhs.sugar),
44  data(rhs.data), lm(rhs.lm) {}
45 
46 
48  return data->extract(v);
49  }
50  PairE(int i, int j, const PolyEntryVector &v):
51  type(IJ_PAIR),
52  wlen(v[i].weightedLength+v[j].weightedLength-2),
53  data(new IJPairData(i,j)),
54  lm(v[i].leadExp+v[j].leadExp) {
55  sugar=lm.deg()+std::max(v[i].ecart(),v[j].ecart());
56  }
57 
58  PairE(int i, idx_type v, const PolyEntryVector &gen,int type):
59  wlen(gen[i].weightedLength+gen[i].length),
60  sugar(gen[i].deg+1),
61  data(new VariablePairData(i,v)),
62  // sugar(gen[i].lmDeg+1),///@only do that because of bad criteria impl
63 
64  lm(gen[i].leadExp) {
66  this->type=type;
67  if (gen[i].leadExp==gen[i].usedVariables)
68  sugar=gen[i].deg;
69  if (gen[i].tailVariables.deg()<gen[i].deg)
70  sugar=gen[i].deg;
71  }
72 
73  PairE(const Polynomial& delayed):
74  type(DELAYED_PAIR), wlen(delayed.eliminationLength()),
75  sugar(delayed.deg()),
76  data(new PolyPairData(delayed)),
77  //lm(delayed.lead()),
78  lm(delayed.leadExp()) { }
79 
80  const PolyPairData& delayedPair() const {
81  PBORI_ASSERT(type == DELAYED_PAIR);
82  return *static_cast<const PolyPairData*>(data.get());
83  }
84 
85  const IJPairData& ijPair() const {
86  PBORI_ASSERT(type == IJ_PAIR);
87  return *static_cast<const IJPairData*>(data.get());
88  }
89 
90  const VariablePairData& variablePair() const {
91  return *static_cast<const VariablePairData*>(data.get());
92  }
93 };
94 
96 
97 #endif /* polybori_PairE_h_ */