/usr/include/polybori/groebner/PolynomialSugar.h is in libbrial-groebner-dev 1.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | // -*- c++ -*-
//*****************************************************************************
/** @file PolynomialSugar.h
*
* @author Michael Brickenstein
* @date 2011-06-30
*
* This file includes the definition of the class @c PolynomialSugar.
*
* @par Copyright:
* (c) 2006-2010 by The PolyBoRi Team
*
**/
//*****************************************************************************
#ifndef polybori_groebner_PolynomialSugar_h_
#define polybori_groebner_PolynomialSugar_h_
// include basic definitions
#include "groebner_defs.h"
BEGIN_NAMESPACE_PBORIGB
/** @class PolynomialSugar
* @brief This class defines PolynomialSugar.
*
**/
class PolynomialSugar{
public:
PolynomialSugar(const Polynomial& poly): lm(poly.ring()), p(poly), exp(){
sugar=p.deg();
if (!(p.isZero())){
this->lm=p.boundedLead(sugar);
this->exp=lm.exp();
PBORI_ASSERT(lm==p.lead());
PBORI_ASSERT(exp==p.leadExp());
}
length=p.length();
}
PolynomialSugar(const Polynomial& poly, int sugar, len_type length):
lm(poly.ring()), p(poly), exp() {
PBORI_ASSERT(length>=0);
//sugar=p.deg();
this->sugar=sugar;
this->length=length;
PBORI_ASSERT(sugar>=p.deg());
PBORI_ASSERT(length>=p.length());
if (!(p.isZero())){
this->lm=p.boundedLead(sugar);
this->exp=lm.exp();
PBORI_ASSERT(lm==p.lead());
PBORI_ASSERT(exp==p.leadExp());
}
}
const BooleMonomial& lead() const{
return this->lm;
}
const Exponent& leadExp() const{
return this->exp;
}
deg_type getSugar() const{
return sugar;
}
wlen_type getLengthEstimation() const {
return length;
}
bool isZero() const{
return p.isZero();
}
void add(const Polynomial p2, deg_type sugar2, wlen_type length){
PBORI_ASSERT(p2.leadExp()==exp);
PBORI_ASSERT(length>=0);
PBORI_ASSERT(length>=p2.length());
this->p=p+p2;
this->sugar=std::max(sugar2,this->sugar);
if (!(p.isZero())){
this->lm=this->p.boundedLead(sugar);
this->exp=this->lm.exp();
} else {
lm=Monomial(p2.ring());
exp=Exponent();
}
this->length+=length;
this->length-=2;
if (p2.ring().ordering().isTotalDegreeOrder()) this->sugar=this->lm.deg();
PBORI_ASSERT((p.isZero())|| (lm==p.lead()));
PBORI_ASSERT((p.isZero())||(exp==p.leadExp()));
}
void adjustSugar(){
sugar=p.deg();
}
bool isOne(){
return p.isOne();
}
Polynomial value() const{
return p;
}
wlen_type eliminationLength() const{
///@todo optimize that using length optimization
wlen_type res=1;
if (isZero()) return 0;
res=res+(sugar-exp.deg()+1)*(length-1);
PBORI_ASSERT(res>=p.eliminationLengthWithDegBound(sugar));
return res;
//return p.eliminationLengthWithDegBound(sugar);
}
void adjustLm(){
this->lm=this->p.lead();
exp=lm.exp();
PBORI_ASSERT(lm==p.lead());
PBORI_ASSERT(exp==p.leadExp());
}
protected:
Monomial lm;
len_type length;
deg_type sugar;
Polynomial p;
Exponent exp;
};
END_NAMESPACE_PBORIGB
#endif /* polybori_PolynomialSugar_h_ */
|