manpagez: man pages & more
info cln
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.2 Functions on univariate polynomials

Given a univariate polynomial ring R, the following members can be used.

cl_ring R->basering()

This returns the base ring, as passed to ‘find_univpoly_ring’.

cl_UP R->zero()

This returns 0 in R, a polynomial of degree -1.

cl_UP R->one()

This returns 1 in R, a polynomial of degree == 0.

cl_UP R->canonhom (const cl_I& x)

This returns x in R, a polynomial of degree <= 0.

cl_UP R->monomial (const cl_ring_element& x, uintL e)

This returns a sparse polynomial: x * X^e, where X is the indeterminate.

cl_UP R->create (sintL degree)

Creates a new polynomial with a given degree. The zero polynomial has degree -1. After creating the polynomial, you should put in the coefficients, using the set_coeff member function, and then call the finalize member function.

The following are the only destructive operations on univariate polynomials.

void set_coeff (cl_UP& x, uintL index, const cl_ring_element& y)

This changes the coefficient of X^index in x to be y. After changing a polynomial and before applying any "normal" operation on it, you should call its finalize member function.

void finalize (cl_UP& x)

This function marks the endpoint of destructive modifications of a polynomial. It normalizes the internal representation so that subsequent computations have less overhead. Doing normal computations on unnormalized polynomials may produce wrong results or crash the program.

The following operations are defined on univariate polynomials.

cl_univpoly_ring x.ring ()

Returns the ring to which the univariate polynomial x belongs.

cl_UP operator+ (const cl_UP&, const cl_UP&)

Returns the sum of two univariate polynomials.

cl_UP operator- (const cl_UP&, const cl_UP&)

Returns the difference of two univariate polynomials.

cl_UP operator- (const cl_UP&)

Returns the negative of a univariate polynomial.

cl_UP operator* (const cl_UP&, const cl_UP&)

Returns the product of two univariate polynomials. One of the arguments may also be a plain integer or an element of the base ring.

cl_UP square (const cl_UP&)

Returns the square of a univariate polynomial.

cl_UP expt_pos (const cl_UP& x, const cl_I& y)

y must be > 0. Returns x^y.

bool operator== (const cl_UP&, const cl_UP&)
bool operator!= (const cl_UP&, const cl_UP&)

Compares two univariate polynomials, belonging to the same univariate polynomial ring, for equality.

bool zerop (const cl_UP& x)

Returns true if x is 0 in R.

sintL degree (const cl_UP& x)

Returns the degree of the polynomial. The zero polynomial has degree -1.

sintL ldegree (const cl_UP& x)

Returns the low degree of the polynomial. This is the degree of the first non-vanishing polynomial coefficient. The zero polynomial has ldegree -1.

cl_ring_element coeff (const cl_UP& x, uintL index)

Returns the coefficient of X^index in the polynomial x.

cl_ring_element x (const cl_ring_element& y)

Evaluation: If x is a polynomial and y belongs to the base ring, then ‘x(y)’ returns the value of the substitution of y into x.

cl_UP deriv (const cl_UP& x)

Returns the derivative of the polynomial x with respect to the indeterminate X.

The following output functions are defined (see also the chapter on input/output).

void fprint (std::ostream& stream, const cl_UP& x)
std::ostream& operator<< (std::ostream& stream, const cl_UP& x)

Prints the univariate polynomial x on the stream. The output may depend on the global printer settings in the variable default_print_flags.

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on August 27, 2013 using texi2html 5.0.

© 2000-2018
Individual documents may contain additional copyright information.