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

quick-’n-dirty Dense_Univariate rational polynomial class More...

#include <dense_univariate_rational_poly.hpp>

Public Member Functions

Construction
 Dense_Univariate_Rational_Polynomial (DEG_TYPE)
 construct with the number of expected terms
 
 Dense_Univariate_Rational_Polynomial (const Dense_Univariate_Rational_Polynomial &)
 copy constructor
 
 Dense_Univariate_Rational_Polynomial (DEG_TYPE, int64_t *, uint64_t *)
 construct from given data, with the expected number of terms
 
Destruction
 ~Dense_Univariate_Rational_Polynomial ()
 
Modification
void expand_poly (DEG_TYPE)
 expand to allow for higher-degree monomials More...
 
void set_coefficient (DEG_TYPE k, COEF_TYPE a, UCOEF_TYPE b)
 set the coefficient of \(x^k\) to \(\frac{a}{b}\)
 
void scale_by (COEF_TYPE a)
 multiplies every monomial by a constant integer
 
void scale_by (COEF_TYPE a, UCOEF_TYPE b)
 multiplies every monomial by a constant rational More...
 
void multiply_by_monomial_of_degree (DEG_TYPE)
 a hopefully efficient multiplication algorithm More...
 
void multiply_by (const Dense_Univariate_Rational_Polynomial &)
 highly inefficient polynomial multiplication ( \(O(mn)\))
 
void negate ()
 negates the numerators
 
void add (const Dense_Univariate_Rational_Polynomial &)
 adds other to this
 
void operator+= (const Dense_Univariate_Rational_Polynomial &other)
 alias for add()
 
void subtract (const Dense_Univariate_Rational_Polynomial &)
 subtracts other from this
 
void operator-= (const Dense_Univariate_Rational_Polynomial &other)
 alias for subtract()
 
Computation
Dense_Univariate_Rational_Polynomial operator- (const Dense_Univariate_Rational_Polynomial &) const
 returns the difference between this and the other
 
Basic properties
bool is_zero () const
 indicates whether the polynomial is zero
 
COEF_TYPE numerator (DEG_TYPE k) const
 returns the \(k\)th numerator
 
UCOEF_TYPE denominator (DEG_TYPE k) const
 returns the \(k\)th denominator
 
DEG_TYPE degree () const
 returns the polynomial’s degree
 
const COEF_TYPE * numerator_array ()
 all the numerators
 
const UCOEF_TYPE * denominator_array ()
 all the denominators
 

Protected Attributes

DEG_TYPE deg
 degree of the polynomial (largest nonzero exponent)
 
UCOEF_TYPE * denominators
 list of denominators; index 0 is the constant’s
 
COEF_TYPE * numerators
 list of numerators; index 0 is the constant’s
 
DEG_TYPE size
 number of slots for coefficients
 

Friends

I/O
ostream & operator<< (ostream &os, Dense_Univariate_Rational_Polynomial &p)
 

Detailed Description

quick-’n-dirty Dense_Univariate rational polynomial class

Author
John Perry
Date
2016
Warning
You must have deg smaller than size, as deg indexes the monomial of largest degree, which can be at most size - 1.

Definition at line 20 of file dense_univariate_rational_poly.hpp.

Member Function Documentation

◆ expand_poly()

void Dense_Univariate_Rational_Polynomial::expand_poly ( DEG_TYPE  n)

expand to allow for higher-degree monomials

You should do this at the beginning of any computation that could expand the size of the polynomial.

Definition at line 59 of file dense_univariate_rational_poly.cpp.

◆ multiply_by_monomial_of_degree()

void Dense_Univariate_Rational_Polynomial::multiply_by_monomial_of_degree ( DEG_TYPE  k)

a hopefully efficient multiplication algorithm

Moves exponents from higher degrees to even higher degrees, freeing up space for smaller exponents.

Definition at line 94 of file dense_univariate_rational_poly.cpp.

◆ scale_by()

void Dense_Univariate_Rational_Polynomial::scale_by ( COEF_TYPE  a,
UCOEF_TYPE  b 
)

multiplies every monomial by a constant rational

Parameters
arational’s numerator
brational’s denominator

Definition at line 85 of file dense_univariate_rational_poly.cpp.


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