Gröbner basis project
Codebase for research into Gröbner basis computation
Strategies

strategies for Gröbner basis computation More...

Classes

class  Normal_Strategy
 ordering critical pairs using the normal strategy More...
 
class  Pair_Strategy_Data
 Structure for sorting critical pairs. More...
 
class  Pair_Sugar_Data
 ordering critical pairs using the sugar strategy More...
 
class  Pair_WSugar_Strategy
 ordering critical pairs using the weighted sugar strategy More...
 
class  Poly_Strategy_Data
 polynomial-related strategy data More...
 
class  Poly_Sugar_Data
 polynomial-related data for a sugar strategy More...
 
class  Poly_WSugar_Data
 polynomial-related data for a weighted sugar strategy More...
 

Enumerations

enum  StrategyFlags { NORMAL_STRATEGY = 1, SUGAR_STRATEGY, WSUGAR_STRATEGY }
 flag indicating which strategy to use for computation More...
 

Detailed Description

strategies for Gröbner basis computation


Class Documentation

◆ Normal_Strategy

class Normal_Strategy

ordering critical pairs using the normal strategy

Author
John Perry
Date
2016

Definition at line 32 of file normal_strategy.hpp.

Inheritance diagram for Normal_Strategy:
Pair_Strategy_Data

Public Member Functions

Construction
 Normal_Strategy (Critical_Pair_Basic &cpb)
 all the information we need is in cpb already so no additional processing is necessary
 
Comparison
virtual bool equivalent (const Pair_Strategy_Data &sd) const
 implementation of equivalent()
 
virtual bool first_larger (const Pair_Strategy_Data &sd) const
 implementation of first_larger()
 
Basic properties
virtual StrategyFlags type ()
 
- Public Member Functions inherited from Pair_Strategy_Data
virtual ~Pair_Strategy_Data ()
 
bool operator== (const Pair_Strategy_Data &sd) const
 alias for equivalent()
 
bool operator> (const Pair_Strategy_Data &sd) const
 alias for first_larger()
 
bool operator>= (const Pair_Strategy_Data &sd) const
 is this larger than or equivalent to other?
 
bool operator< (const Pair_Strategy_Data &sd) const
 is this smaller than other?
 
bool operator<= (const Pair_Strategy_Data &sd) const
 is this smaller than or equivalent to other?
 
virtual void pre_spolynomial_tasks () const
 hook called immediately before computing a new s-polynomiald More...
 

Protected Attributes

Critical_Pair_Basiccp
 the critical pair to which this Normal_Strategy belongs
 

Friends

I/O
ostream & operator<< (ostream &, const Normal_Strategy &)
 

◆ Pair_Strategy_Data

class Pair_Strategy_Data

Structure for sorting critical pairs.

Author
John Perry
Date
2016

Definition at line 145 of file strategies.hpp.

Inheritance diagram for Pair_Strategy_Data:
Normal_Strategy Pair_Sugar_Data Pair_WSugar_Strategy

Public Member Functions

Destruction
virtual ~Pair_Strategy_Data ()
 
Comparison
virtual bool equivalent (const Pair_Strategy_Data &) const =0
 should return true iff this and other are equivalent
 
bool operator== (const Pair_Strategy_Data &sd) const
 alias for equivalent()
 
virtual bool first_larger (const Pair_Strategy_Data &) const =0
 should return true iff this is larger than other
 
bool operator> (const Pair_Strategy_Data &sd) const
 alias for first_larger()
 
bool operator>= (const Pair_Strategy_Data &sd) const
 is this larger than or equivalent to other?
 
bool operator< (const Pair_Strategy_Data &sd) const
 is this smaller than other?
 
bool operator<= (const Pair_Strategy_Data &sd) const
 is this smaller than or equivalent to other?
 
Computation
virtual void pre_spolynomial_tasks () const
 hook called immediately before computing a new s-polynomiald More...
 

Member Function Documentation

◆ pre_spolynomial_tasks()

void Pair_Strategy_Data::pre_spolynomial_tasks ( ) const
virtual

hook called immediately before computing a new s-polynomiald

The default is to do nothing, which is good for the normal strategy. Other strategies, however, may require some processing before reduction; the sugar strategy is an example, as an s-polynomial needs to record a new polynomial’s sugar

Definition at line 74 of file strategies.cpp.

◆ Pair_Sugar_Data

class Pair_Sugar_Data

ordering critical pairs using the sugar strategy

Author
John Perry
Date
2016

Definition at line 101 of file sugar_strategy.hpp.

Inheritance diagram for Pair_Sugar_Data:
Pair_Strategy_Data

Public Member Functions

Construction
 Pair_Sugar_Data (Critical_Pair_Basic &cpb)
 all the information we need is in cpb already so no additional processing is necessary
 
Comparison
virtual bool equivalent (const Pair_Strategy_Data &sd) const
 implementation of equivalent()
 
virtual bool first_larger (const Pair_Strategy_Data &sd) const
 implementation of first_larger()
 
Basic properties
DEG_TYPE pair_sugar () const
 
- Public Member Functions inherited from Pair_Strategy_Data
virtual ~Pair_Strategy_Data ()
 
bool operator== (const Pair_Strategy_Data &sd) const
 alias for equivalent()
 
bool operator> (const Pair_Strategy_Data &sd) const
 alias for first_larger()
 
bool operator>= (const Pair_Strategy_Data &sd) const
 is this larger than or equivalent to other?
 
bool operator< (const Pair_Strategy_Data &sd) const
 is this smaller than other?
 
bool operator<= (const Pair_Strategy_Data &sd) const
 is this smaller than or equivalent to other?
 
virtual void pre_spolynomial_tasks () const
 hook called immediately before computing a new s-polynomiald More...
 

Protected Attributes

Critical_Pair_Basiccp
 the critical pair to which this Normal_Strategy belongs
 
DEG_TYPE sugar
 the pair*rsquo;s sugar
 

◆ Pair_WSugar_Strategy

class Pair_WSugar_Strategy

ordering critical pairs using the weighted sugar strategy

Author
John Perry
Date
2016

Definition at line 116 of file weighted_sugar_strategy.hpp.

Inheritance diagram for Pair_WSugar_Strategy:
Pair_Strategy_Data

Public Member Functions

Construction
 Pair_WSugar_Strategy (Critical_Pair_Basic &)
 creates a pair whose weighted sugar is the maximum of that of the products of the polynomials in the critical pair
 
Comparison
virtual bool equivalent (const Pair_Strategy_Data &sd) const
 implementation of equivalent()
 
virtual bool first_larger (const Pair_Strategy_Data &sd) const
 implementation of first_larger()
 
Basic properties
DEG_TYPE pair_sugar ()
 the weighted sugar
 
Modification

Useful for when the ordering changes.

virtual void adjust_sugar (DEG_TYPE new_sugar)
 
- Public Member Functions inherited from Pair_Strategy_Data
virtual ~Pair_Strategy_Data ()
 
bool operator== (const Pair_Strategy_Data &sd) const
 alias for equivalent()
 
bool operator> (const Pair_Strategy_Data &sd) const
 alias for first_larger()
 
bool operator>= (const Pair_Strategy_Data &sd) const
 is this larger than or equivalent to other?
 
bool operator< (const Pair_Strategy_Data &sd) const
 is this smaller than other?
 
bool operator<= (const Pair_Strategy_Data &sd) const
 is this smaller than or equivalent to other?
 
virtual void pre_spolynomial_tasks () const
 hook called immediately before computing a new s-polynomiald More...
 

Protected Attributes

Critical_Pair_Basiccp
 the critical pair to which this Normal_Strategy belongs
 
DEG_TYPE sugar
 the pair*rsquo;s sugar
 

◆ Poly_Strategy_Data

class Poly_Strategy_Data

polynomial-related strategy data

Author
John Perry
Date
2016

Some strategies will not need this class, but others will, such as sugar (to store a polynomial’s sugar).

Definition at line 49 of file strategies.hpp.

Inheritance diagram for Poly_Strategy_Data:
Poly_Sugar_Data Poly_WSugar_Data

Public Member Functions

Destruction
virtual ~Poly_Strategy_Data ()
 
Basic properties
virtual StrategyFlags type ()=0
 
Comparison
virtual bool equivalent (const Poly_Strategy_Data &) const =0
 should return true iff strategy considers this and other equivalent
 
bool operator== (const Poly_Strategy_Data &other) const
 alias for equivalent()
 
virtual bool first_larger (const Poly_Strategy_Data &) const =0
 should return true iff strategy considers this larger than other
 
bool operator> (const Poly_Strategy_Data &other) const
 alias for first_larger()
 
bool operator>= (const Poly_Strategy_Data &other) const
 is this larger than or equivalent to other?
 
bool operator< (const Poly_Strategy_Data &other) const
 is this smaller than other?
 
bool operator<= (const Poly_Strategy_Data &other) const
 is this smaller than or equivalent to other?
 
Computation
virtual void at_generation_tasks ()
 hook called while first generating polynomial More...
 
virtual void at_generation_tasks (const Monomial &t)
 hook called while first generating a polynomial multiple More...
 
virtual bool valid_reduction (const Abstract_Polynomial &r, const Abstract_Polynomial &g) const
 hook called while finding a reducer More...
 
void pre_reduction_tasks (const Monomial &u, const Abstract_Polynomial &g)
 
virtual void pre_reduction_tasks (const EXP_TYPE *u, const Abstract_Polynomial &g)
 hook called immediately before performing reduction More...
 

Protected Attributes

const Abstract_Polynomialp
 the polynomial to which this strategy applies
 

Friends

I/O
ostream & operator<< (ostream &, const Poly_Strategy_Data &)
 print strategy-related data in the polynomial
 

Member Function Documentation

◆ at_generation_tasks() [1/2]

virtual void Poly_Strategy_Data::at_generation_tasks ( )
inlinevirtual

hook called while first generating polynomial

The default is to do nothing, which is good for the normal strategy. Other strategies, however, may perform some record-keeping; the sugar strategy, for instance, will compute the polynomial’s sugar.

Reimplemented in Poly_WSugar_Data, and Poly_Sugar_Data.

Definition at line 88 of file strategies.hpp.

◆ at_generation_tasks() [2/2]

virtual void Poly_Strategy_Data::at_generation_tasks ( const Monomial t)
inlinevirtual

hook called while first generating a polynomial multiple

Parameters
ta Monomial that we are about to multiply to create an s-polynomial

The default is to do nothing, which is good for the normal strategy. Other strategies, however, may perform some record-keeping; the sugar strategy, for instance, will compute the polynomial’s sugar.

Reimplemented in Poly_WSugar_Data, and Poly_Sugar_Data.

Definition at line 96 of file strategies.hpp.

◆ pre_reduction_tasks()

virtual void Poly_Strategy_Data::pre_reduction_tasks ( const EXP_TYPE *  u,
const Abstract_Polynomial g 
)
inlinevirtual

hook called immediately before performing reduction

Parameters
gpolynomial that reduces r (where r is this)
uexponents of monomial satisfying \(u\textrm{lm}(g)=\textrm{lm}(r)\)

The default is to do nothing, which is good for the normal strategy. Other strategies, however, may require some processing before reduction; the sugar strategy is an example, as reduction may increase a polynomial’s sugar

Reimplemented in Poly_WSugar_Data, and Poly_Sugar_Data.

Definition at line 124 of file strategies.hpp.

◆ valid_reduction()

bool Poly_Strategy_Data::valid_reduction ( const Abstract_Polynomial r,
const Abstract_Polynomial g 
) const
virtual

hook called while finding a reducer

Parameters
rpolynomial that is to be reduced
gpolynomial that reduces r
Returns
true if and only if it is valid to reduce r by g

The default is to do nothing, which is good for the normal and sugar strategies. Other strategies, however, may impose constraints on the reduction; involutive and signature-based reduction, for instance, both forbid certain reductions.

Definition at line 43 of file strategies.cpp.

◆ Poly_Sugar_Data

class Poly_Sugar_Data

polynomial-related data for a sugar strategy

Author
John Perry
Date
2016

Definition at line 33 of file sugar_strategy.hpp.

Inheritance diagram for Poly_Sugar_Data:
Poly_Strategy_Data

Public Member Functions

 Poly_Sugar_Data (const Abstract_Polynomial *poly)
 records poly as the reference for this More...
 
virtual void at_generation_tasks ()
 sets the sugar to the largest total degree of a monomial in the assigned previously polynomial
 
virtual void at_generation_tasks (const Monomial &t)
 sets the sugar to the largest total degree of a monomial in the product of the monomial and the previously assigned polynomial More...
 
virtual bool equivalent (const Poly_Strategy_Data &sd) const
 returns true iff the sugars are equal More...
 
virtual bool first_larger (const Poly_Strategy_Data &sd) const
 returns true iff this sugar is larger than sd ’s More...
 
virtual void pre_reduction_tasks (const EXP_TYPE *u, const Abstract_Polynomial &g)
 re-evaluates the sugar, if need be More...
 
Basic properties
DEG_TYPE poly_sugar () const
 the sugar itself
 
virtual StrategyFlags type ()
 the strategy type
 
Modification
void force_sugar (DEG_TYPE new_sugar)
 for those times when a different sugar is appropriate
 
- Public Member Functions inherited from Poly_Strategy_Data
virtual ~Poly_Strategy_Data ()
 
bool operator== (const Poly_Strategy_Data &other) const
 alias for equivalent()
 
bool operator> (const Poly_Strategy_Data &other) const
 alias for first_larger()
 
bool operator>= (const Poly_Strategy_Data &other) const
 is this larger than or equivalent to other?
 
bool operator< (const Poly_Strategy_Data &other) const
 is this smaller than other?
 
bool operator<= (const Poly_Strategy_Data &other) const
 is this smaller than or equivalent to other?
 
virtual bool valid_reduction (const Abstract_Polynomial &r, const Abstract_Polynomial &g) const
 hook called while finding a reducer More...
 
void pre_reduction_tasks (const Monomial &u, const Abstract_Polynomial &g)
 

Protected Attributes

unsigned long long sugar
 the polynomial’s sugar
 
- Protected Attributes inherited from Poly_Strategy_Data
const Abstract_Polynomialp
 the polynomial to which this strategy applies
 

Friends

I/O
ostream & operator<< (ostream &, const Poly_Sugar_Data &)
 
I/O

Constructor & Destructor Documentation

◆ Poly_Sugar_Data()

Poly_Sugar_Data::Poly_Sugar_Data ( const Abstract_Polynomial poly)

records poly as the reference for this

Parameters
polythe polynomial whose sugar data this should be

Definition at line 26 of file sugar_strategy.cpp.

Member Function Documentation

◆ at_generation_tasks()

void Poly_Sugar_Data::at_generation_tasks ( const Monomial t)
virtual

sets the sugar to the largest total degree of a monomial in the product of the monomial and the previously assigned polynomial

Parameters
ta Monomial to multiply to this

Reimplemented from Poly_Strategy_Data.

Definition at line 51 of file sugar_strategy.cpp.

◆ equivalent()

bool Poly_Sugar_Data::equivalent ( const Poly_Strategy_Data sd) const
virtual

returns true iff the sugars are equal

Parameters
sdstrategy data containing sugar
Returns
true if and only if the sugar of this is equivalent to the sugar of sd

Implements Poly_Strategy_Data.

Definition at line 31 of file sugar_strategy.cpp.

◆ first_larger()

bool Poly_Sugar_Data::first_larger ( const Poly_Strategy_Data sd) const
virtual

returns true iff this sugar is larger than sd ’s

Parameters
sdstrategy data containing sugar
Returns
true if and only if this sugar is larger than sd ’s

Implements Poly_Strategy_Data.

Definition at line 36 of file sugar_strategy.cpp.

◆ pre_reduction_tasks()

void Poly_Sugar_Data::pre_reduction_tasks ( const EXP_TYPE *  u,
const Abstract_Polynomial g 
)
virtual

re-evaluates the sugar, if need be

Parameters
uexponent vector of a Monomial to multiply to g, then subtract from this
ga polynomial

Reimplemented from Poly_Strategy_Data.

Definition at line 61 of file sugar_strategy.cpp.

◆ Poly_WSugar_Data

class Poly_WSugar_Data

polynomial-related data for a weighted sugar strategy

Author
John Perry
Date
2016

This strategy is based on a weight vector, rather than simply adding exponents. While the weight vector can be that of a weighted ordering, one is also free to use a different weight altogether. Simply supply the relevant data.

Definition at line 39 of file weighted_sugar_strategy.hpp.

Inheritance diagram for Poly_WSugar_Data:
Poly_Strategy_Data

Public Member Functions

 Poly_WSugar_Data (const Abstract_Polynomial *poly, const WT_TYPE *w)
 records poly as the reference for this More...
 
virtual void at_generation_tasks ()
 sets the sugar to the largest weighted degree of a monomial in the assigned previously polynomial
 
virtual void at_generation_tasks (const Monomial &t)
 sets the sugar to the largest weighted degree of a monomial in the product of the monomial and the previously assigned polynomial More...
 
virtual bool equivalent (const Poly_Strategy_Data &sd) const
 returns true iff the sugars are equal More...
 
virtual bool first_larger (const Poly_Strategy_Data &sd) const
 returns true iff this sugar is larger than sd ’s More...
 
virtual void pre_reduction_tasks (const EXP_TYPE *u, const Abstract_Polynomial &g)
 re-evaluates the sugar, if need be More...
 
Basic properties
StrategyFlags type ()
 type of strategy
 
DEG_TYPE poly_sugar () const
 the sugar itself
 
const WT_TYPE * weighting () const
 the weights used to compute the sugar
 
Modification
void change_weights (const WT_TYPE *w)
 changes the weights used to compute the sugar to w
 
- Public Member Functions inherited from Poly_Strategy_Data
virtual ~Poly_Strategy_Data ()
 
bool operator== (const Poly_Strategy_Data &other) const
 alias for equivalent()
 
bool operator> (const Poly_Strategy_Data &other) const
 alias for first_larger()
 
bool operator>= (const Poly_Strategy_Data &other) const
 is this larger than or equivalent to other?
 
bool operator< (const Poly_Strategy_Data &other) const
 is this smaller than other?
 
bool operator<= (const Poly_Strategy_Data &other) const
 is this smaller than or equivalent to other?
 
virtual bool valid_reduction (const Abstract_Polynomial &r, const Abstract_Polynomial &g) const
 hook called while finding a reducer More...
 
void pre_reduction_tasks (const Monomial &u, const Abstract_Polynomial &g)
 

Protected Attributes

DEG_TYPE sugar
 the polynomial’s sugar
 
const WT_TYPE * weights
 pointer to the weights
 
- Protected Attributes inherited from Poly_Strategy_Data
const Abstract_Polynomialp
 the polynomial to which this strategy applies
 

Friends

I/O
ostream & operator<< (ostream &, const Poly_WSugar_Data &)
 
I/O

Constructor & Destructor Documentation

◆ Poly_WSugar_Data()

Poly_WSugar_Data::Poly_WSugar_Data ( const Abstract_Polynomial poly,
const WT_TYPE *  w 
)

records poly as the reference for this

This expects the weights to be as long as the number of monomials. It copies the list, so you can subsequently modify it without subsequently affecting correctness.

Warning
The weights are not copied. Please do not modify them, as behavior is hard to predict in this case. It is predictable, but it’s likely highly undesirable. Better to create a new Poly_WSugar_Data instead.
Parameters
polypolynomial whose sugar this is
wweight vector to compute weighted sugar

Definition at line 27 of file weighted_sugar_strategy.cpp.

Member Function Documentation

◆ at_generation_tasks()

void Poly_WSugar_Data::at_generation_tasks ( const Monomial t)
virtual

sets the sugar to the largest weighted degree of a monomial in the product of the monomial and the previously assigned polynomial

Parameters
ta Monomial to multiply to this

Reimplemented from Poly_Strategy_Data.

Definition at line 56 of file weighted_sugar_strategy.cpp.

◆ equivalent()

bool Poly_WSugar_Data::equivalent ( const Poly_Strategy_Data sd) const
virtual

returns true iff the sugars are equal

Parameters
sdsugar data to compare with this
Returns
true if and only if this has sugar comparable to sd

Implements Poly_Strategy_Data.

Definition at line 35 of file weighted_sugar_strategy.cpp.

◆ first_larger()

bool Poly_WSugar_Data::first_larger ( const Poly_Strategy_Data sd) const
virtual

returns true iff this sugar is larger than sd ’s

Parameters
sdsugar data to compare with this
Returns
true if and only if this has larger sugar than sd

Implements Poly_Strategy_Data.

Definition at line 40 of file weighted_sugar_strategy.cpp.

◆ pre_reduction_tasks()

void Poly_WSugar_Data::pre_reduction_tasks ( const EXP_TYPE *  u,
const Abstract_Polynomial g 
)
virtual

re-evaluates the sugar, if need be

Parameters
umonomial to multiply to g, then reduce this by the product
ga polynomial whose leading monomial divides this

Reimplemented from Poly_Strategy_Data.

Definition at line 71 of file weighted_sugar_strategy.cpp.

Enumeration Type Documentation

◆ StrategyFlags

enum StrategyFlags
strong

flag indicating which strategy to use for computation

Author
John Perry
Date
2016

Definition at line 34 of file strategies.hpp.