1 #ifndef __DBL_BUF_POLYNOMIAL_H_ 2 #define __DBL_BUF_POLYNOMIAL_H_ 22 using std::cout;
using std::endl;
24 #include "polynomial.hpp" 25 #include "polynomial_linked_list.hpp" 60 virtual bool fellOff()
const override;
135 virtual Monomial & leading_monomial()
const override;
139 virtual unsigned length()
const override;
141 virtual bool is_zero()
const override;
147 virtual void set_monomial_ordering(
167 virtual void add_polynomial_multiple(
174 virtual void sort_by_order()
override;
206 inline bool test_buffer(
unsigned b,
unsigned n) {
return sizes[b] >= n; }
215 if (mons[b] !=
nullptr) {
216 for (
unsigned k = 0; k < sizes[b]; ++k)
217 mons[b][k].deinitialize();
221 unsigned new_size = 2*n;
224 for (
unsigned k = 0; k < new_size; ++k)
225 mons[b][k].initialize_exponents(n);
239 unsigned active_buffer;
The general class of a polynomial.
long long current_position
current position in the list
virtual bool canMoveRight() const override
Can this iterator move right, or would it fall off?
virtual bool canMoveLeft() const override
virtual void restart_iteration() override
This should move the iterator to the leading term.
const Abstract_Polynomial * p
the polynomial this points to
Iterator over double-buffered polynomials.
unsigned tail
position of last monomial
virtual void set_currMonomial(const Monomial &t) override
change monomial in current position
virtual void set_currCoeff(const Prime_Field_Element &a) override
change coefficient in current position
Polynomials that need arithmetic typically descend from this class.
virtual void moveRight() override
Moves right in the polynomial, to the next smaller monomial.
bool test_buffer(unsigned b, unsigned n)
true iff buffer b has space to hold n elements; expand other buffer if not.
Implementation of monomials.
Element of a field of prime characteristic.
interface to a monomial ordering
Encapsulates information about a polynomial ring for easy access: ground field, number of indetermina...
virtual void moveLeft() override
Moves left in the polynomial, to the next larger monomial.
virtual bool fellOff() const override
A Mutable_Polynomial_Iterator allows one to modify the terms of a polynomial.
void expand_buffer(unsigned b, unsigned n)
Expand buffer b to hold elements.
virtual const Prime_Field_Element & currCoeff() const override
Reports the coefficient at the current position.
Monomial * T
pointer to monomials
Polynomials represented as a doubly linked list.
Used to iterate through a polynomial.
Prime_Field_Element * A
pointer to coefficients
virtual const Monomial & currMonomial() const override
Reports the monomial at the current position.
Polynomials implemented using double buffers.A double-buffered polynomial maintains at all times two ...
unsigned head
position of first monomial