Gröbner basis project
Codebase for research into Gröbner basis computation
|
Implementation of geobuckets. More...
#include <polynomial_geobucket.hpp>
Public Member Functions | |
Construction | |
Polynomial_Geobucket (Polynomial_Ring &R, Monomial_Ordering *order=generic_grevlex_ptr) | |
Initializes a polynomial with the given number of variables, over the given field. | |
Polynomial_Geobucket (Abstract_Polynomial &p) | |
Initializes a geobucket that is a copy of \(p\). | |
Destruction | |
~Polynomial_Geobucket () | |
Deallocates buckets, if they exist. | |
Basic properties | |
virtual void | sort_by_order () |
Sorts each geobucket. More... | |
virtual void | set_monomial_ordering (Monomial_Ordering *order, bool sort_anew=true) |
Sets the monomial ordering for each bucket. More... | |
virtual Monomial & | leading_monomial () const |
Returns the leading monomial. More... | |
virtual Prime_Field_Element | leading_coefficient () const |
Returns the leading coefficient. More... | |
virtual unsigned | length () const |
Number of monomials in this polynomial. More... | |
virtual Polynomial_Linked_List * | zero_polynomial () const |
A geobucket initialized to zero. | |
virtual bool | is_zero () const |
true iff all the buckets are nullptr or themselves zero. More... | |
virtual bool | can_reduce (Abstract_Polynomial &other) const |
Whether this can reduce other . A geobucket should not generally be used to reduce other polynomials, so avoid this like the plague. | |
virtual Geobucket_Iterator * | new_iterator () const |
An iterator that poses no risk of modifying the polynomial. | |
virtual Polynomial_Iterator * | begin () const |
virtual Polynomial_Iterator * | end () const |
virtual Geobucket_Iterator * | new_mutable_iterator () |
An iterator that may modify the current position. | |
Computation | |
virtual void | recompute_leading_monomial () |
You will need to call this after every operation that might modify the leading term. More... | |
virtual Polynomial_Geobucket * | monomial_multiple (const Monomial &t) const |
Returns \(\texttt{this}\times t\). | |
virtual Polynomial_Geobucket * | scalar_multiple (const Prime_Field_Element &a) const |
Returns \(\texttt{this}\times a\). | |
virtual Polynomial_Geobucket & | operator+= (const Abstract_Polynomial &g) |
Adds \(g\) to this . Recomputes leading monomial. | |
virtual Polynomial_Geobucket & | operator-= (const Abstract_Polynomial &g) |
Subtracts \(g\) from this . Recomputes leading monomial. | |
virtual void | add_polynomial_multiple (const Prime_Field_Element &b, const Monomial &u, const Abstract_Polynomial &g, bool subtract=false) |
Adds \(bug\) to this . Recomputes leading monomial. | |
virtual Polynomial_Linked_List * | detach_head () |
Detaches the head and recomputes leading monomial. | |
virtual void | add_last (const Prime_Field_Element &a, const Monomial &t) |
Adds \(at\) as a monomial of this . (Not necessarily the last!) More... | |
virtual Abstract_Polynomial * | canonicalize (bool constant_result=false) |
Returns a copy of this in a simplified linear form. More... | |
![]() | |
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 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 | println (ostream &os=cout) const |
virtual void | printlncout () const |
Protected Member Functions | |
unsigned | lglen (unsigned i) |
Log-length of \(i\), used to select a bucket for a polynomial of length \(i\). | |
Protected Attributes | |
Polynomial_Linked_List ** | buckets |
Array of ptrs to linked list polys; most initialized to nullptr . | |
![]() | |
Polynomial_Ring & | R |
data about polynomial ring | |
Poly_Strategy_Data * | strat = nullptr |
data for computational strategies | |
Friends | |
class | Geobucket_Iterator |
I/O | |
ostream & | operator<< (ostream &, const Polynomial_Geobucket &) |
prints the geobucket in an explicitly geobucket form More... | |
virtual void | print (unsigned i, ostream &os=cout) const |
prints the \(i\)th bucket More... | |
virtual void | print (ostream &os=cout) const |
prints the polynomial with an explicitly bucket form More... | |
Implementation of geobuckets.
NUM_BUCKETS
. Definition at line 97 of file polynomial_geobucket.hpp.
|
virtual |
Adds \(at\) as a monomial of this
. (Not necessarily the last!)
bucket[0]
). Implements Mutable_Polynomial.
Definition at line 346 of file polynomial_geobucket.cpp.
|
virtual |
Returns a copy of this
in a simplified linear form.
If constant
is true
, the result is a Constant_Polynomial
. Otherwise, the result is a Polynomial_Linked_List
. Choose the latter if you anticipate further reduction, such as tail reduction. (Geobuckets by default do not reduce lower-order terms.)
Definition at line 361 of file polynomial_geobucket.cpp.
|
virtual |
true
iff all the buckets are nullptr
or themselves zero.
Implements Abstract_Polynomial.
Definition at line 184 of file polynomial_geobucket.cpp.
|
virtual |
Returns the leading coefficient.
Implements Abstract_Polynomial.
Definition at line 168 of file polynomial_geobucket.cpp.
|
virtual |
Returns the leading monomial.
Implements Abstract_Polynomial.
Definition at line 164 of file polynomial_geobucket.cpp.
|
virtual |
Number of monomials in this polynomial.
Implements Abstract_Polynomial.
Definition at line 172 of file polynomial_geobucket.cpp.
|
virtual |
prints the \(i\)th bucket
In the context of geobuckets, this makes more sense than printing the polynomial. Practically, printing the polynomial does the same thing as printing the contents of the buckets, but the more general function can be misleading on account of the un-simplified nature of the polynomial.
Definition at line 382 of file polynomial_geobucket.cpp.
|
virtual |
prints the polynomial with an explicitly bucket form
Prints the polynomial in the form
\[(b_1) + (b_2) + \cdots + (b_\textrm{last}).\]
Parentheses separate buckets, whose sums have not (yet) been simplified. Uninitiated and nonzero buckets are not printed.
Reimplemented from Abstract_Polynomial.
Definition at line 386 of file polynomial_geobucket.cpp.
|
virtual |
You will need to call this after every operation that might modify the leading term.
The assumption here is that the first bucket no longer contains a valid leading term, so we skip it and try to extract from a later one. If the other buckets are all zero, we indicate this.
Definition at line 197 of file polynomial_geobucket.cpp.
|
virtual |
Sets the monomial ordering for each bucket.
Implements Abstract_Polynomial.
Definition at line 157 of file polynomial_geobucket.cpp.
|
virtual |
Sorts each geobucket.
Implements Abstract_Polynomial.
Definition at line 151 of file polynomial_geobucket.cpp.
|
friend |
prints the geobucket in an explicitly geobucket form
Definition at line 400 of file polynomial_geobucket.cpp.