Gröbner basis project
Codebase for research into Gröbner basis computation
|
Polynomials represented as a doubly linked list. More...
#include <polynomial_linked_list.hpp>
Public Member Functions | |
Construction | |
Polynomial_Linked_List (Polynomial_Ring &R, Monomial_Ordering *order=generic_grevlex_ptr) | |
initialize to zero | |
Polynomial_Linked_List (Polynomial_Ring &R, const Monomial &t, Monomial_Ordering *order=nullptr) | |
initialize to monomial; monomial is copied | |
Polynomial_Linked_List (Polynomial_Ring &R, const Prime_Field_Element &c, const Monomial &t, Monomial_Ordering *order=nullptr) | |
initialize to monomial and coefficient; monomial is copied | |
Polynomial_Linked_List (Polynomial_Ring &R, Monomial_Node *node, Monomial_Ordering *order=nullptr) | |
initialize to given monomial node: nothing is copied | |
Polynomial_Linked_List (const Polynomial_Linked_List &other) | |
copy constructor: deep copy of monomials | |
Polynomial_Linked_List (const Abstract_Polynomial &p) | |
constructor from abstract polynomial: deep copy of monomials | |
Destruction | |
virtual | ~Polynomial_Linked_List () |
deletes all monomial nodes | |
Basic properties | |
bool | is_zero () const |
true iff the first node in the list is nullptr or has zero coeff | |
Monomial & | leading_monomial () const |
Returns the leading monomial — call sort_by_order() first! | |
Prime_Field_Element | leading_coefficient () const |
Returns the leading coefficient — call sort_by_order first! | |
unsigned | length () const |
Returns the number of polynomials in the list. | |
virtual void | set_monomial_ordering (Monomial_Ordering *ord, bool sort_anew=true) |
set the monomial ordering and sort the polynomials (optionally, but by default) More... | |
Computation | |
virtual Polynomial_Linked_List * | zero_polynomial () const |
Returns as simple a zero polynomial as I can muster, short of this being nullptr . | |
virtual Polynomial_Linked_List * | monomial_multiple (const Monomial &u) const |
Returns a new polynomial whose value is \(\textit{this}\times u\). | |
virtual Polynomial_Linked_List * | scalar_multiple (const Prime_Field_Element &c) const |
Returns a new polynomial whose value is \(\textit{this}\times c\). | |
virtual Polynomial_Linked_List & | operator+= (const Abstract_Polynomial &other) |
Adds other to this , and returns the result. | |
virtual Polynomial_Linked_List & | operator-= (const Abstract_Polynomial &other) |
Subtracts other from this , and returns the result. | |
virtual void | add_polynomial_multiple (const Prime_Field_Element &a, const Monomial &t, const Abstract_Polynomial &q, bool subtract) |
"Fast" addition of \(atq\) to this . More... | |
virtual void | sort_by_order () |
Sort by specified weight order. | |
Iteration | |
virtual LLPolynomial_Iterator * | new_iterator () const |
an iterator that poses no risk of modifying the polynomial | |
virtual Polynomial_Iterator * | begin () const |
an iterator that poses no risk of modifying the polynomial | |
virtual Polynomial_Iterator * | end () const |
an iterator that poses no risk of modifying the polynomial | |
virtual LLPolynomial_Iterator * | new_mutable_iterator () |
An iterator that may modify the current position. | |
Modification | |
virtual Polynomial_Linked_List * | detach_head () |
Detach and return leading term. | |
virtual void | add_last (const Prime_Field_Element &c, const Monomial &t) |
Add this monomial as the last leading term. | |
![]() | |
Mutable_Polynomial (Polynomial_Ring &R, Monomial_Ordering *ordering=generic_grevlex_ptr) | |
constructor | |
virtual | ~Mutable_Polynomial ()=0 |
destructor | |
virtual void | multiply_by_scalar (const Prime_Field_Element &a) |
multiply by scalar | |
virtual void | multiply_by_monomial (const Monomial &t) |
multiply by monomial | |
virtual void | reduce_by (const Abstract_Polynomial &p) |
reduce by \(p\) until no further reduction possible | |
![]() | |
Abstract_Polynomial (Polynomial_Ring &ring, Monomial_Ordering *ordering) | |
virtual | ~Abstract_Polynomial () |
Polynomial_Ring & | base_ring () const |
ring in which this polynomial resides | |
Prime_Field & | ground_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_Ordering * | monomial_ordering () const |
reports leading monomial’s monomial ordering | |
virtual bool | can_reduce (Abstract_Polynomial &other) const |
can this reduce other ? | |
virtual Poly_Strategy_Data * | strategy () 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... | |
void | set_strategy (Poly_Strategy_Data *psd) |
sets the polynomial’s strategy to psd | |
virtual void | print (ostream &os=cout) const |
virtual void | println (ostream &os=cout) const |
virtual void | printlncout () const |
Protected Attributes | |
Monomial_Node * | head |
first monomial in the list, returned by leading_monomial() | |
![]() | |
Polynomial_Ring & | R |
data about polynomial ring | |
Poly_Strategy_Data * | strat = nullptr |
data for computational strategies | |
Friends | |
class | LLPolynomial_Iterator |
Polynomials represented as a doubly linked list.
Definition at line 154 of file polynomial_linked_list.hpp.
|
virtual |
"Fast" addition of \(atq\) to this
.
If subtract==true
, subtract instead.
Implements Mutable_Polynomial.
Definition at line 386 of file polynomial_linked_list.cpp.
|
virtual |
set the monomial ordering and sort the polynomials (optionally, but by default)
Implements Abstract_Polynomial.
Definition at line 223 of file polynomial_linked_list.cpp.