Gröbner basis project
Codebase for research into Gröbner basis computation
|
A Constant_Polynomial is a polynomial that should not change. More...
#include <polynomial_array.hpp>
Public Member Functions | |
Construction | |
Constant_Polynomial (unsigned length, Polynomial_Ring &R, const Monomial *mons, const Prime_Field_Element *coeffs, Monomial_Ordering *order=nullptr) | |
Constant_Polynomial (unsigned length, Polynomial_Ring &R, Monomial_Ordering *order=generic_grevlex_ptr) | |
Constant_Polynomial (const Abstract_Polynomial &p) | |
Creates a constant polynomial copy of p. | |
Constant_Polynomial (Polynomial_Ring &, Monomial_Ordering *, uint64_t, uint64_t *) | |
from serial data | |
Destruction | |
~Constant_Polynomial () | |
Basic properties | |
virtual void | set_monomial_ordering (Monomial_Ordering *order, bool sort_anew=true) |
sort by order | |
virtual void | sort_by_order () |
sort according to the leading monomial’s ordering More... | |
virtual Monomial & | leading_monomial () const |
virtual Prime_Field_Element | leading_coefficient () const |
virtual unsigned | length () const |
virtual bool | is_zero () const |
Computation | |
virtual Constant_Polynomial * | zero_polynomial () const |
virtual Constant_Polynomial * | monomial_multiple (const Monomial &t) const |
virtual Constant_Polynomial * | scalar_multiple (const Prime_Field_Element &c) const |
Iteration | |
virtual Constant_Polynomial_Iterator * | new_iterator () const |
an iterator that poses no risk of modifying the polynomial | |
virtual Polynomial_Iterator * | begin () const |
iterator to the first element | |
virtual Polynomial_Iterator * | end () const |
iterator to the last element | |
Serialization | |
uint64_t * | serialized (uint64_t &size) |
returns an array of uint64_t containing the polynomial data and assigns the length of this array to size More... | |
![]() | |
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 | |
Prime_Field_Element * | A |
array of coefficients, in one-to-one correspondence with M | |
unsigned | head |
location of leading term in array (always farther left) | |
Monomial * | M |
array of monomials, in one-to-one correspondence with A | |
unsigned | m |
position after last monomial | |
![]() | |
Polynomial_Ring & | R |
data about polynomial ring | |
Poly_Strategy_Data * | strat = nullptr |
data for computational strategies | |
Friends | |
class | Constant_Polynomial_Iterator |
class | Mutable_Constant_Polynomial_Iterator |
A Constant_Polynomial is a polynomial that should not change.
We do allow on change at this level: to resort the monomials. We do not consider this a real change (it’s still the same polynomial), and in any case even this is effectively unimplemented right now (unless you set up the polynomial with unsorted terms, in which case sorting them helps).
Definition at line 66 of file polynomial_array.hpp.
Constant_Polynomial::Constant_Polynomial | ( | unsigned | length, |
Polynomial_Ring & | R, | ||
const Monomial * | mons, | ||
const Prime_Field_Element * | coeffs, | ||
Monomial_Ordering * | order = nullptr |
||
) |
We assume that mons and coeffs both have length n. We do not check that the monomials have the same number of variables, nor that the coefficients come from the same field, nor do we sort the monomials. The client needs to do this!
Definition at line 37 of file polynomial_array.cpp.
Constant_Polynomial::Constant_Polynomial | ( | unsigned | length, |
Polynomial_Ring & | R, | ||
Monomial_Ordering * | order = generic_grevlex_ptr |
||
) |
This is a pretty useless constructor unless you know what you’re doing. Unless you’re a child of Constant_Polynomial, you don’t know what you’re doing. Even then, you probably don’t know what you’re doing.
Definition at line 64 of file polynomial_array.cpp.
|
virtual |
is this polynomial zero?
Implements Abstract_Polynomial.
Definition at line 160 of file polynomial_array.cpp.
|
virtual |
Leading coefficient – call after sort_by_order()!
Implements Abstract_Polynomial.
Definition at line 154 of file polynomial_array.cpp.
|
virtual |
Leading monomial – call after sort_by_order()!
Implements Abstract_Polynomial.
Definition at line 152 of file polynomial_array.cpp.
|
virtual |
Number of monomials
Implements Abstract_Polynomial.
Definition at line 158 of file polynomial_array.cpp.
|
virtual |
multiple of this and u
Implements Abstract_Polynomial.
Definition at line 172 of file polynomial_array.cpp.
|
virtual |
multiple of this and c
Implements Abstract_Polynomial.
Definition at line 180 of file polynomial_array.cpp.
uint64_t * Constant_Polynomial::serialized | ( | uint64_t & | size | ) |
returns an array of uint64_t
containing the polynomial data and assigns the length of this array to size
The data is stored in the form [ A1 M11 M12 ... M1n A2 M21 M22 ... M2n ... ] where Ai is the ith coefficient (lead is first) and Mij is the exponent of xj in the ith monomial
Definition at line 103 of file polynomial_array.cpp.
|
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.
Implements Abstract_Polynomial.
Definition at line 134 of file polynomial_array.cpp.
|
virtual |
zero constant polynomial: one entry, and it’s zero!
Implements Abstract_Polynomial.
Definition at line 164 of file polynomial_array.cpp.