Gröbner basis project
Codebase for research into Gröbner basis computation
Constant_Polynomial Class Reference

A Constant_Polynomial is a polynomial that should not change. More...

#include <polynomial_array.hpp>

Inheritance diagram for Constant_Polynomial:
Abstract_Polynomial

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 Monomialleading_monomial () const
 
virtual Prime_Field_Element leading_coefficient () const
 
virtual unsigned length () const
 
virtual bool is_zero () const
 
Computation
virtual Constant_Polynomialzero_polynomial () const
 
virtual Constant_Polynomialmonomial_multiple (const Monomial &t) const
 
virtual Constant_Polynomialscalar_multiple (const Prime_Field_Element &c) const
 
Iteration
virtual Constant_Polynomial_Iteratornew_iterator () const
 an iterator that poses no risk of modifying the polynomial
 
virtual Polynomial_Iteratorbegin () const
 iterator to the first element
 
virtual Polynomial_Iteratorend () 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...
 
- Public Member Functions inherited from Abstract_Polynomial
 Abstract_Polynomial (Polynomial_Ring &ring, Monomial_Ordering *ordering)
 
virtual ~Abstract_Polynomial ()
 
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 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...
 
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_ElementA
 array of coefficients, in one-to-one correspondence with M
 
unsigned head
 location of leading term in array (always farther left)
 
MonomialM
 array of monomials, in one-to-one correspondence with A
 
unsigned m
 position after last monomial
 
- Protected Attributes inherited from Abstract_Polynomial
Polynomial_RingR
 data about polynomial ring
 
Poly_Strategy_Datastrat = nullptr
 data for computational strategies
 

Friends

class Constant_Polynomial_Iterator
 
class Mutable_Constant_Polynomial_Iterator
 

Detailed Description

A Constant_Polynomial is a polynomial that should not change.

Author
John Perry
Date
2015

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).

Examples:
test_4by4.cpp, test_cyclic4.cpp, and test_cyclicn.cpp.

Definition at line 66 of file polynomial_array.hpp.

Constructor & Destructor Documentation

◆ Constant_Polynomial() [1/2]

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() [2/2]

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.

Member Function Documentation

◆ is_zero()

bool Constant_Polynomial::is_zero ( ) const
virtual

is this polynomial zero?

Implements Abstract_Polynomial.

Definition at line 160 of file polynomial_array.cpp.

◆ leading_coefficient()

Prime_Field_Element Constant_Polynomial::leading_coefficient ( ) const
virtual

Leading coefficient – call after sort_by_order()!

Implements Abstract_Polynomial.

Definition at line 154 of file polynomial_array.cpp.

◆ leading_monomial()

Monomial & Constant_Polynomial::leading_monomial ( ) const
virtual

Leading monomial – call after sort_by_order()!

Implements Abstract_Polynomial.

Definition at line 152 of file polynomial_array.cpp.

◆ length()

unsigned Constant_Polynomial::length ( ) const
virtual

Number of monomials

Implements Abstract_Polynomial.

Definition at line 158 of file polynomial_array.cpp.

◆ monomial_multiple()

Constant_Polynomial * Constant_Polynomial::monomial_multiple ( const Monomial t) const
virtual

multiple of this and u

Implements Abstract_Polynomial.

Definition at line 172 of file polynomial_array.cpp.

◆ scalar_multiple()

Constant_Polynomial * Constant_Polynomial::scalar_multiple ( const Prime_Field_Element c) const
virtual

multiple of this and c

Implements Abstract_Polynomial.

Definition at line 180 of file polynomial_array.cpp.

◆ serialized()

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.

◆ sort_by_order()

void Constant_Polynomial::sort_by_order ( )
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.

Examples:
test_4by4.cpp, and test_cyclic4.cpp.

Definition at line 134 of file polynomial_array.cpp.

◆ zero_polynomial()

Constant_Polynomial * Constant_Polynomial::zero_polynomial ( ) const
virtual

zero constant polynomial: one entry, and it’s zero!

Implements Abstract_Polynomial.

Definition at line 164 of file polynomial_array.cpp.


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