1 #ifndef __CRITICAL_PAIR_CPP_ 2 #define __CRITICAL_PAIR_CPP_ 21 #include "critical_pair.hpp" 23 #include "polynomial.hpp" 24 #include "strategies.hpp" 25 #include "sugar_strategy.hpp" 26 #include "weighted_sugar_strategy.hpp" 27 #include "particular_orderings.hpp" 33 if (p.
q ==
nullptr) cout << 0;
42 os << static_cast<const Critical_Pair_Basic &>(p);
50 ) : tpq(f->leading_monomial()), p(f), q(nullptr), s(nullptr),
51 tp(tpq.num_vars()), tq(tpq.num_vars())
57 case StrategyFlags::NORMAL_STRATEGY:
60 case StrategyFlags::SUGAR_STRATEGY :
63 case StrategyFlags::WSUGAR_STRATEGY:
74 ) :
tpq(f->leading_monomial().
lcm(g->leading_monomial())),
75 p((f->leading_monomial().larger_than(g->leading_monomial())) ? f : g ),
76 q((f->leading_monomial().larger_than(g->leading_monomial())) ? g : f ),
84 tp /= p->leading_monomial();
87 case StrategyFlags::NORMAL_STRATEGY:
90 case StrategyFlags::SUGAR_STRATEGY :
93 case StrategyFlags::WSUGAR_STRATEGY:
103 if (
s !=
nullptr)
return s;
107 case SPolyCreationFlags::LINKED_LST:
110 case SPolyCreationFlags::GEOBUCKETS:
113 case SPolyCreationFlags::DOUBLE_BUF:
122 case StrategyFlags::NORMAL_STRATEGY:
124 case StrategyFlags::SUGAR_STRATEGY :
126 case StrategyFlags::WSUGAR_STRATEGY: {
129 if (sd ==
nullptr) w =
nullptr;
155 if (
s !=
nullptr)
return s;
156 if (p->monomial_ordering() != ordering)
157 p->set_monomial_ordering(ordering);
161 case StrategyFlags::NORMAL_STRATEGY:
break;
162 case StrategyFlags::SUGAR_STRATEGY:
break;
163 case StrategyFlags::WSUGAR_STRATEGY: {
164 if (p->strategy() ==
nullptr)
170 if (
q !=
nullptr and
q->
strategy() ==
nullptr)
172 else if (
q !=
nullptr) {
The general class of a polynomial.
Implementation of geobuckets.
const Monomial_Ordering * monomial_ordering() const
reports leading monomial’s monomial ordering
Critical_Pair_Basic(Abstract_Polynomial *f, StrategyFlags strategy)
create critical pair (f,0) for initial polynomial
Monomial tq
monomial multiple of that produces -polynomial
virtual void pre_spolynomial_tasks() const
hook called immediately before computing a new s-polynomiald
Mutable_Polynomial * s
S-polynomial.
ordering critical pairs using the weighted sugar strategy
void set_monomial_ordering(const Monomial_Ordering *mord)
sets the Monomial_Ordering associated with this Monomial
virtual Monomial & leading_monomial() const =0
leading monomial – call after sort_by_order()!
virtual Prime_Field_Element leading_coefficient() const =0
leading coefficient – call after sort_by_order()!
const Monomial & lcm() const
lcm of leading monomials of polynomials
Controls the creation of s-polynomials, specialized for the dynamic algorithm.
Monomial tpq
lcm of leading monomials of and
ordering critical pairs using the sugar strategy
Abstract_Polynomial * q
second polynomial in the critical pair
void print(bool=true, ostream &=cout, const string *names=nullptr) const
prints the monomial to the give stream with the given names; adds a newline if the boolean is true ...
virtual void at_generation_tasks()
hook called while first generating polynomial
StrategyFlags
flag indicating which strategy to use for computation
SPolyCreationFlags
flag indicating which structure to use for an s-polynomial
virtual void multiply_by_monomial(const Monomial &t)
multiply by monomial
Polynomials that need arithmetic typically descend from this class.
Weighted_Ordering * ordering
the Monomial_Ordering assigned to this pair — might disagree with that of polynomials; they must be ...
polynomial-related data for a weighted sugar strategy
Element of a field of prime characteristic.
bool is_one() const
Is this the multiplicative identity?
virtual void set_monomial_ordering(const Monomial_Ordering *order, bool sort_anew=true)=0
set the monomial ordering and sort the polynomials (optionally, but by default)
polynomial-related data for a sugar strategy
virtual Mutable_Polynomial * s_polynomial()
to use only if s-polynomial is already computed by another method
virtual void multiply_by_scalar(const Prime_Field_Element &a)
multiply by scalar
ordering critical pairs using the normal strategy
void change_weights(const WT_TYPE *w)
changes the weights used to compute the sugar to w
Pair_Strategy_Data * key
strategy used to sort critical pairs
interface to a weighted monomial ordering
virtual void add_polynomial_multiple(const Prime_Field_Element &, const Monomial &, const Abstract_Polynomial &, bool subtract=false)=0
add monomial multiple of other
void set_strategy(Poly_Strategy_Data *psd)
sets the polynomial’s strategy to psd
Polynomials represented as a doubly linked list.
virtual const string * name_list() const
names of all the variabiles
Polynomials implemented using double buffers.A double-buffered polynomial maintains at all times two ...
Controls the creation of s-polynomials.
Polynomial_Ring & base_ring() const
ring in which this polynomial resides
Monomial tp
monomial multiple of that produces -polynomial
Abstract_Polynomial * p
first polynomial in the critical pair
virtual Poly_Strategy_Data * strategy() const
strategy related information