PolyBoRi
CountCriterion.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_groebner_CountCriterion_h_
17 #define polybori_groebner_CountCriterion_h_
18 
19 // include basic definitions
20 #include "groebner_defs.h"
21 
22 #include "GroebnerStrategy.h"
23 #include "interpolate.h"
24 
26 
32 public:
34  int j;
36  this->strat=&strat;
37  this->j=j;
38  }
39  bool operator() (int i){
40  const PolyEntry & e1=const_cast<const GroebnerStrategy*>(strat)->generators[i];
41  const PolyEntry & e2=const_cast<const GroebnerStrategy*>(strat)->generators[j];
42  const int USED_VARIABLES_BOUND=6;
43  if ((e1.usedVariables.deg()>USED_VARIABLES_BOUND)||
44  (e2.usedVariables.deg()>USED_VARIABLES_BOUND)||
45  (e1.usedVariables.LCMDeg(e2.usedVariables) > USED_VARIABLES_BOUND)
46 
47 
48  ||(e1.p.set().nNodes()>30)||(e2.p.set().nNodes()>30))
49  return false;
50 
52 
53  MonomialSet space=uv_exp.divisors(e1.p.ring());
54 
55  Monomial lead_lcm=e1.lead.LCM(e2.lead);
56  //I am sure, there exists combinatorial formulas
57  MonomialSet common_lead_space=lead_lcm.divisors();
58  Monomial gcd=e1.lead.GCD(e2.lead);
59  int gcd_deg = gcd_deg;
60  int standard_monomials_in_common_lead=
61  // common_lead_space.diff(
62  // common_lead_space.multiplesOf(e1.lead)).diff(
63  // common_lead_space.multiplesOf(e2.lead)).size();
64  (1<<gcd_deg)*((1<<(e1.leadDeg-gcd_deg))-1+(1<<(e1.leadDeg-gcd_deg)
65  )-1)
66  +((1<<gcd_deg)-1)*((1<<(e1.leadDeg-gcd_deg))+(1<<(e2.leadDeg-gcd_deg)));
67 
68  MonomialSet::size_type standard_monomials =
69  (standard_monomials_in_common_lead <<(uv_exp.size()-lead_lcm.deg()));
70 
71  MonomialSet zeros1=zeros(e1.p, space);
72  MonomialSet zeros2=zeros(e2.p, space);
73 
74  MonomialSet my_zeros=zeros1.intersect(zeros2);
75 
76 
77  // MonomialSet my_zeros=zeros(e1.p, space).intersect(zeros(e2.p, space));
78 
79 
80  if (PBORI_UNLIKELY(standard_monomials==my_zeros.size()))
81  {
82  strat->pairs.status.setToHasTRep(i,j);
83  return true;
84 
85  }
86  else
87  return false;
88  }
89  bool operator() (const Exponent &m){
90  int i = strat->generators.index(m);
91  return (*this)(i);
92  }
93 
94 
95 };
96 
98 
99 #endif /* polybori_CountCriterion_h_ */