CountCriterion.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_groebner_CountCriterion_h_
#define polybori_groebner_CountCriterion_h_
// include basic definitions
#include "groebner_defs.h"
#include "GroebnerStrategy.h"
#include "interpolate.h"
BEGIN_NAMESPACE_PBORIGB
class CountCriterion{
public:
GroebnerStrategy* strat;
int j;
CountCriterion(GroebnerStrategy& strat, int j){
this->strat=&strat;
this->j=j;
}
bool operator() (int i){
const PolyEntry & e1=const_cast<const GroebnerStrategy*>(strat)->generators[i];
const PolyEntry & e2=const_cast<const GroebnerStrategy*>(strat)->generators[j];
const int USED_VARIABLES_BOUND=6;
if ((e1.usedVariables.deg()>USED_VARIABLES_BOUND)||
(e2.usedVariables.deg()>USED_VARIABLES_BOUND)||
(e1.usedVariables.LCMDeg(e2.usedVariables) > USED_VARIABLES_BOUND)
||(e1.p.set().nNodes()>30)||(e2.p.set().nNodes()>30))
return false;
Exponent uv_exp=e1.usedVariables.LCM(e2.usedVariables);
MonomialSet space=uv_exp.divisors(e1.p.ring());
Monomial lead_lcm=e1.lead.LCM(e2.lead);
//I am sure, there exists combinatorial formulas
MonomialSet common_lead_space=lead_lcm.divisors();
Monomial gcd=e1.lead.GCD(e2.lead);
int gcd_deg = gcd_deg;
int standard_monomials_in_common_lead=
// common_lead_space.diff(
// common_lead_space.multiplesOf(e1.lead)).diff(
// common_lead_space.multiplesOf(e2.lead)).size();
(1<<gcd_deg)*((1<<(e1.leadDeg-gcd_deg))-1+(1<<(e1.leadDeg-gcd_deg)
)-1)
+((1<<gcd_deg)-1)*((1<<(e1.leadDeg-gcd_deg))+(1<<(e2.leadDeg-gcd_deg)));
MonomialSet::size_type standard_monomials =
(standard_monomials_in_common_lead <<(uv_exp.size()-lead_lcm.deg()));
MonomialSet zeros1=zeros(e1.p, space);
MonomialSet zeros2=zeros(e2.p, space);
MonomialSet my_zeros=zeros1.intersect(zeros2);
// MonomialSet my_zeros=zeros(e1.p, space).intersect(zeros(e2.p, space));
if (PBORI_UNLIKELY(standard_monomials==my_zeros.size()))
{
strat->pairs.status.setToHasTRep(i,j);
return true;
}
else
return false;
}
bool operator() (const Exponent &m){
int i = strat->generators.index(m);
return (*this)(i);
}
};
END_NAMESPACE_PBORIGB
#endif /* polybori_CountCriterion_h_ */
polybori::BooleMonomial::deg
deg_type deg() const
Degree of the monomial.
Definition: BooleMonomial.h:146
polybori::groebner::PolyEntryBase::usedVariables
Exponent usedVariables
Definition: PolyEntryBase.h:62
polybori::groebner::CountCriterion::strat
GroebnerStrategy * strat
Definition: CountCriterion.h:33
polybori::BooleExponent
This class is just a wrapper for using variables for storing indices as interim data structure for Bo...
Definition: BooleExponent.h:34
polybori::BooleMonomial::GCD
self GCD(const self &) const
Compute the greatest common divisor.
Definition: BooleMonomial.cc:169
polybori::groebner::PolyEntryBase::leadDeg
deg_type leadDeg
Definition: PolyEntryBase.h:59
polybori::groebner::PolyEntryVector::index
size_type index(const KeyType &key) const
Retrieve index associated to key.
Definition: PolyEntryVector.h:99
polybori::groebner::PolyEntryBase::p
Polynomial p
Definition: PolyEntryBase.h:54
polybori::BooleExponent::LCMDeg
deg_type LCMDeg(const self &) const
Degree of the least common multiple.
Definition: BooleExponent.cc:293
END_NAMESPACE_PBORIGB
#define END_NAMESPACE_PBORIGB
Definition: groebner_defs.h:16
polybori::BooleExponent::divisors
set_type divisors(const ring_type &) const
Divisors of the monomial.
Definition: BooleExponent.cc:417
polybori::BooleExponent::LCM
self LCM(const self &) const
Compute the greatest common divisor.
Definition: BooleExponent.cc:319
polybori::BooleMonomial::LCM
self LCM(const self &) const
Compute the least common multiple.
Definition: BooleMonomial.cc:219
polybori::BoolePolynomial::ring
const ring_type & ring() const
Access ring, where this belongs to.
Definition: BoolePolynomial.h:478
polybori::groebner::CountCriterion
This class defines CountCriterion.
Definition: CountCriterion.h:31
polybori::BoolePolynomial::set
set_type set() const
Get corresponding subset of of the powerset over all variables.
Definition: BoolePolynomial.h:464
BEGIN_NAMESPACE_PBORIGB
#define BEGIN_NAMESPACE_PBORIGB
Definition: groebner_defs.h:15
polybori::groebner::PolyEntry
This class defines PolyEntry.
Definition: PolyEntry.h:32
polybori::groebner::PairManager::status
PairStatusSet status
Definition: PairManager.h:75
polybori::groebner::GroebnerStrategy::generators
ReductionStrategy generators
Definition: GroebnerStrategy.h:204
polybori::groebner::CountCriterion::j
int j
Definition: CountCriterion.h:34
polybori::groebner::CountCriterion::CountCriterion
CountCriterion(GroebnerStrategy &strat, int j)
Definition: CountCriterion.h:35
groebner_defs.h
polybori::BooleMonomial::divisors
set_type divisors() const
Divisors of the monomial.
Definition: BooleMonomial.h:154
polybori::BooleSet::size
size_type size() const
Returns number of terms.
Definition: BooleSet.h:242
polybori::groebner::GroebnerStrategy
This class defines GroebnerStrategy.
Definition: GroebnerStrategy.h:41
polybori::groebner::PairStatusSet::setToHasTRep
void setToHasTRep(int ia, int ja)
Definition: PairStatusSet.h:39
polybori::groebner::PairManagerFacade::pairs
PairManagerWithStrategy< strategy_type > pairs
For compatibility reasons make this a public member.
Definition: PairManagerFacade.h:95
polybori::CCuddDDFacade::nNodes
size_type nNodes() const
Number of nodes in the current decision diagram.
Definition: CCuddDDFacade.h:235
polybori::groebner::zeros
MonomialSet zeros(Polynomial p, MonomialSet candidates)
Definition: interpolate.cc:85
polybori::groebner::PolyEntryBase::lead
Monomial lead
Definition: PolyEntryBase.h:55
polybori::CAuxTypes::size_type
std::size_t size_type
Type for lengths, dimensions, etc.
Definition: pbori_defs.h:219
polybori::BooleSet
Definition: BooleSet.h:57
GroebnerStrategy.h
polybori::BooleMonomial
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleMonomial.h:50
polybori::BooleExponent::size
size_type size() const
Degree of the corresponding monomial.
Definition: BooleExponent.h:109
PBORI_UNLIKELY
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59
interpolate.h
polybori::BooleExponent::deg
deg_type deg() const
Degree of the corresponding monomial.
Definition: BooleExponent.h:118