PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 #ifndef polybori_groebner_PairE_h_ 00017 #define polybori_groebner_PairE_h_ 00018 00019 // include basic definitions 00020 #include "groebner_defs.h" 00021 00022 BEGIN_NAMESPACE_PBORIGB 00023 00028 class PairE{ 00029 private: 00030 int type; 00031 public: 00032 int getType() const{ 00033 return type; 00034 } 00035 wlen_type wlen; 00036 deg_type sugar; 00037 //three sorts of pairs 00038 //x*poly, poly, i,j 00039 pair_data_ptr data; 00040 Exponent lm; //must not be the real lm, can be lm of syzygy or something else 00041 00042 PairE(const PairE& rhs): 00043 type(rhs.getType()), wlen(rhs.wlen), sugar(rhs.sugar), 00044 data(rhs.data), lm(rhs.lm) {} 00045 00046 00047 Polynomial extract(const PolyEntryVector& v) const { 00048 return data->extract(v); 00049 } 00050 PairE(int i, int j, const PolyEntryVector &v): 00051 type(IJ_PAIR), 00052 wlen(v[i].weightedLength+v[j].weightedLength-2), 00053 data(new IJPairData(i,j)), 00054 lm(v[i].leadExp+v[j].leadExp) { 00055 sugar=lm.deg()+std::max(v[i].ecart(),v[j].ecart()); 00056 } 00057 00058 PairE(int i, idx_type v, const PolyEntryVector &gen,int type): 00059 wlen(gen[i].weightedLength+gen[i].length), 00060 sugar(gen[i].deg+1), 00061 data(new VariablePairData(i,v)), 00062 // sugar(gen[i].lmDeg+1),///@only do that because of bad criteria impl 00063 00064 lm(gen[i].leadExp) { 00065 PBORI_ASSERT(type==VARIABLE_PAIR); 00066 this->type=type; 00067 if (gen[i].leadExp==gen[i].usedVariables) 00068 sugar=gen[i].deg; 00069 if (gen[i].tailVariables.deg()<gen[i].deg) 00070 sugar=gen[i].deg; 00071 } 00072 00073 PairE(const Polynomial& delayed): 00074 type(DELAYED_PAIR), wlen(delayed.eliminationLength()), 00075 sugar(delayed.deg()), 00076 data(new PolyPairData(delayed)), 00077 //lm(delayed.lead()), 00078 lm(delayed.leadExp()) { } 00079 00080 const PolyPairData& delayedPair() const { 00081 PBORI_ASSERT(type == DELAYED_PAIR); 00082 return *static_cast<const PolyPairData*>(data.get()); 00083 } 00084 00085 const IJPairData& ijPair() const { 00086 PBORI_ASSERT(type == IJ_PAIR); 00087 return *static_cast<const IJPairData*>(data.get()); 00088 } 00089 00090 const VariablePairData& variablePair() const { 00091 return *static_cast<const VariablePairData*>(data.get()); 00092 } 00093 }; 00094 00095 END_NAMESPACE_PBORIGB 00096 00097 #endif /* polybori_PairE_h_ */