Gröbner basis project
Codebase for research into Gröbner basis computation
Abstract_Polynomial Class Referenceabstract

The general class of a polynomial. More...

#include <polynomial.hpp>

Inheritance diagram for Abstract_Polynomial:
Constant_Polynomial Mutable_Polynomial Double_Buffered_Polynomial Polynomial_Geobucket Polynomial_Linked_List

Public Member Functions

Construction
 Abstract_Polynomial (Polynomial_Ring &ring, Monomial_Ordering *ordering)
 
Destruction
virtual ~Abstract_Polynomial ()
 
Basic properties
Polynomial_Ringbase_ring () const
 ring in which this polynomial resides
 
Prime_Fieldground_field ()
 ground field – all coefficients should be in this field
 
unsigned number_of_variables () const
 number of variables – all monomials should agree with this (though it is never tested by the class)
 
Monomial_Orderingmonomial_ordering () const
 reports leading monomial’s monomial ordering
 
virtual Monomialleading_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()!
 
virtual unsigned length () const =0
 number of monomials
 
virtual bool is_zero () const =0
 is this polynomial zero?
 
virtual bool can_reduce (Abstract_Polynomial &other) const
 can this reduce other?
 
virtual Poly_Strategy_Datastrategy () const
 strategy related information
 
virtual DEG_TYPE standard_degree () const
 maximum sum of exponents for any monomial
 
virtual DEG_TYPE weighted_degree (const WT_TYPE *w=nullptr) const
 weighted sum of exponents for any monomial More...
 
Computation
virtual Abstract_Polynomialzero_polynomial () const =0
 new zero polynomial of this same type
 
virtual Abstract_Polynomialmonomial_multiple (const Monomial &) const =0
 multiple of this and \(u\)
 
virtual Abstract_Polynomialscalar_multiple (const Prime_Field_Element &) const =0
 multiple of this and \(c\)
 
void set_strategy (Poly_Strategy_Data *psd)
 sets the polynomial’s strategy to psd
 
Ordering monomials
virtual void set_monomial_ordering (Monomial_Ordering *order, bool sort_anew=true)=0
 set the monomial ordering and sort the polynomials (optionally, but by default) More...
 
virtual void sort_by_order ()=0
 sort according to the leading monomial’s ordering More...
 
Iteration
virtual Polynomial_Iteratornew_iterator () const =0
 An iterator that poses no risk of modifying the polynomial.
 
virtual Polynomial_Iteratorbegin () const =0
 
virtual Polynomial_Iteratorend () const =0
 

Protected Attributes

Polynomial_RingR
 data about polynomial ring
 
Poly_Strategy_Datastrat = nullptr
 data for computational strategies
 

I/O

virtual void print (ostream &os=cout) const
 
virtual void println (ostream &os=cout) const
 
virtual void printlncout () const
 
ostream & operator<< (ostream &os, const Abstract_Polynomial &p)
 output
 

Detailed Description

The general class of a polynomial.

Author
John Perry
Date
2015

This class encapsulates the minimum feature set necessary for our application. Naturally, it must be possible to identify a leading monomial and coefficient. Every polynomial must also be able to produce an iterator; indicate its its length (number of monomials), and its number of variables; describe its ground field; and produce a zero polynomial of the same type (this has its uses).

Warning
Monomials should have the same number of variables, and coefficients should all come from the same field. Behavior is undefined if these assumptions are violated. From an algebraic point of view, it doesn’t make much sense to violate them, anyway; (in/pro)ject into a different ring if you want to screw around like this.
Examples:
test_cyclicn.cpp.

Definition at line 84 of file polynomial.hpp.

Constructor & Destructor Documentation

◆ Abstract_Polynomial()

Abstract_Polynomial::Abstract_Polynomial ( Polynomial_Ring ring,
Monomial_Ordering ordering 
)
inline
Parameters
ringthe polynomial ring in which this polynomial will reside
orderingthe monomial ordering that first sorts the monomials

Definition at line 93 of file polynomial.hpp.

Member Function Documentation

◆ set_monomial_ordering()

virtual void Abstract_Polynomial::set_monomial_ordering ( Monomial_Ordering order,
bool  sort_anew = true 
)
pure virtual

set the monomial ordering and sort the polynomials (optionally, but by default)

Warning
In most cases you will want to sort anew immediately after setting the ordering. Otherwise, the monomials may be in the wrong order! That is therefore the default behavior of this function, but in case you don’t want to sort, that option is provided.

Implemented in Polynomial_Linked_List, Polynomial_Geobucket, Double_Buffered_Polynomial, and Constant_Polynomial.

◆ sort_by_order()

virtual void Abstract_Polynomial::sort_by_order ( )
pure virtual

sort according to the leading monomial’s ordering

Note that it makes sense to sort even Constant_Polynomial’s, as it is not the polynomial that changes, only the order of its monomials.

Implemented in Polynomial_Linked_List, Double_Buffered_Polynomial, Polynomial_Geobucket, and Constant_Polynomial.

◆ weighted_degree()

DEG_TYPE Abstract_Polynomial::weighted_degree ( const WT_TYPE *  w = nullptr) const
virtual

weighted sum of exponents for any monomial

If the given weight pointer is nullptr, returns the standard degree.

Definition at line 91 of file polynomial.cpp.


The documentation for this class was generated from the following files: