DenseUnivariateRationalPolynomial Class Reference
The concrete class DenseUnivariateRationalPolynomial inherits from BPASUnivariatePolynomial and implements a univariate polynomial ring over the rational numbers with a dense representation. It overrides all the public member functions of BPASRing, BPASPolynomial and BPASUnivariatePolynomial. One can construct a DenseUnivariateRationalPolynomial object either by initializing a zero polynomial with or without its size, or from another DenseUnivariateRationalPolynomial object. Further, it supports some in-place operations, like integrate, reciprocal, homothetic, scaleTransform and taylorShift. One can also compute a bound for the positive real roots, isolate the real roots and refine the isolation interval of a given real root.
Inheritance diagram for DenseUnivariateRationalPolynomial:

## Public Member Functions

DenseUnivariateRationalPolynomial ()

DenseUnivariateRationalPolynomial (int s)

DenseUnivariateRationalPolynomial (Integer e)

DenseUnivariateRationalPolynomial (RationalNumber e)

DenseUnivariateRationalPolynomial (const DenseUnivariateRationalPolynomial &b)

~DenseUnivariateRationalPolynomial ()

int degree ()

mpq_class * coefficients (int k=0)

mpq_class coefficient (int k)

void setCoefficient (int k, mpq_class value)

void setCoefficient (int k, RationalNumber value)

void setCoefficient (int k, double value)

std::string variable ()

void setVariableName (std::string x)

DenseUnivariateRationalPolynomialoperator= (DenseUnivariateRationalPolynomial b)

bool operator!= (DenseUnivariateRationalPolynomial &b)

bool operator== (DenseUnivariateRationalPolynomial &b)

bool isZero ()

void zero ()

bool isOne ()

void one ()

bool isNegativeOne ()

void negativeOne ()

int isConstant ()

int content ()

DenseUnivariateRationalPolynomial operator^ (int e)

DenseUnivariateRationalPolynomialoperator^= (int e)

DenseUnivariateRationalPolynomial operator<< (int k)

DenseUnivariateRationalPolynomialoperator<<= (int k)

DenseUnivariateRationalPolynomial operator>> (int k)

DenseUnivariateRationalPolynomialoperator>>= (int k)

DenseUnivariateRationalPolynomial operator+ (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomialoperator+= (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomial operator+ (RationalNumber c)

DenseUnivariateRationalPolynomial operator+ (mpq_class c)

DenseUnivariateRationalPolynomialoperator+= (RationalNumber c)

DenseUnivariateRationalPolynomialoperator+= (mpq_class c)

DenseUnivariateRationalPolynomial operator- (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomialoperator-= (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomial operator- ()

void subtract (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomial operator- (RationalNumber c)

DenseUnivariateRationalPolynomial operator- (mpq_class c)

DenseUnivariateRationalPolynomialoperator-= (RationalNumber c)

DenseUnivariateRationalPolynomialoperator-= (mpq_class c)

DenseUnivariateRationalPolynomial operator* (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomialoperator*= (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomial operator* (RationalNumber e)

DenseUnivariateRationalPolynomial operator* (mpq_class e)

DenseUnivariateRationalPolynomial operator* (sfixn e)

DenseUnivariateRationalPolynomialoperator*= (RationalNumber e)

DenseUnivariateRationalPolynomialoperator*= (mpq_class e)

DenseUnivariateRationalPolynomialoperator*= (sfixn e)

DenseUnivariateRationalPolynomial operator/ (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomialoperator/= (DenseUnivariateRationalPolynomial b)

DenseUnivariateRationalPolynomial operator/ (RationalNumber e)

DenseUnivariateRationalPolynomial operator/ (mpq_class e)

DenseUnivariateRationalPolynomialoperator/= (RationalNumber e)

DenseUnivariateRationalPolynomialoperator/= (mpq_class e)

DenseUnivariateRationalPolynomial monicDivide (DenseUnivariateRationalPolynomial &b)

DenseUnivariateRationalPolynomial monicDivide (DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *rem)

DenseUnivariateRationalPolynomial lazyPseudoDivide (DenseUnivariateRationalPolynomial &b, mpq_class *c, mpq_class *d=NULL)

DenseUnivariateRationalPolynomial lazyPseudoDivide (DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *rem, mpq_class *c, mpq_class *d)

DenseUnivariateRationalPolynomial pseudoDivide (DenseUnivariateRationalPolynomial &b, mpq_class *d=NULL)

DenseUnivariateRationalPolynomial pseudoDivide (DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *rem, mpq_class *d)

DenseUnivariateRationalPolynomial halfExtendedEuclidean (DenseUnivariateRationalPolynomial b, DenseUnivariateRationalPolynomial *g)

void diophantinEquationSolve (DenseUnivariateRationalPolynomial a, DenseUnivariateRationalPolynomial b, DenseUnivariateRationalPolynomial *s, DenseUnivariateRationalPolynomial *t)

void differentiate (int k)

DenseUnivariateRationalPolynomial integrate ()

mpq_class evaluate (mpq_class x)

bool isTrailingCoefficientZero ()

DenseUnivariateRationalPolynomial gcd (DenseUnivariateRationalPolynomial q, int type=0)

std::vector
< DenseUnivariateRationalPolynomial
squareFree ()

bool divideByVariableIfCan ()

int numberOfSignChanges ()

void reciprocal ()

void homothetic (int k=1)

void scaleTransform (int k)

void negativeVariable ()

void negate ()

mpz_class rootBound ()

void taylorShift (int ts=-1)

Intervals positiveRealRootIsolate (mpq_class width, int ts=-1)

Intervals realRootIsolate (mpq_class width, int ts=-1)

void refineRoot (Interval *a, mpq_class width)

Intervals refineRoots (Intervals &a, mpq_class width)

Public Member Functions inherited from BPASUnivariatePolynomial
BPASUnivariatePolynomialoperator+ (DataType)

BPASUnivariatePolynomialoperator+= (DataType)

BPASUnivariatePolynomialoperator- (DataType)

BPASUnivariatePolynomialoperator-= (DataType)

BPASUnivariatePolynomialoperator* (DataType)

BPASUnivariatePolynomialoperator*= (DataType)

BPASUnivariatePolynomialoperator/ (DataType)

BPASUnivariatePolynomialoperator/= (DataType)

BPASUnivariatePolynomialoperator<< (int)

BPASUnivariatePolynomialoperator<<= (int)

BPASUnivariatePolynomialoperator>> (int)

BPASUnivariatePolynomialoperator>>= (int)

BPASUnivariatePolynomialmonicDivide (BPASUnivariatePolynomial &)

BPASUnivariatePolynomialmonicDivide (BPASUnivariatePolynomial &, BPASUnivariatePolynomial *)

BPASUnivariatePolynomiallazyPseudoDivide (BPASUnivariatePolynomial &, DataType *, DataType *)

BPASUnivariatePolynomiallazyPseudoDivide (BPASUnivariatePolynomial &, BPASUnivariatePolynomial *, DataType *, DataType *)

BPASUnivariatePolynomialpseudoDivide (BPASUnivariatePolynomial &, DataType *)

BPASUnivariatePolynomialpseudoDivide (BPASUnivariatePolynomial &, BPASUnivariatePolynomial *, DataType *)

DataType content ()

BPASUnivariatePolynomialgcd (BPASUnivariatePolynomial &)

std::vector
< BPASUnivariatePolynomial & >
squareFree ()

DataType coefficient (int)

void setCoefficient (int, DataType)

DataType evaluate (DataType)

Public Member Functions inherited from BPASPolynomial
BPASPolynomialoperator= (BPASPolynomial &)

BPASPolynomialoperator+ (BPASPolynomial &)

BPASPolynomialoperator+= (BPASPolynomial &)

BPASPolynomialoperator- (BPASPolynomial &)

BPASPolynomialoperator- ()

BPASPolynomialoperator-= (BPASPolynomial &)

BPASPolynomialoperator* (BPASPolynomial &)

BPASPolynomialoperator*= (BPASPolynomial &)

BPASPolynomialoperator/ (BPASPolynomial &)

BPASPolynomialoperator/= (BPASPolynomial &)

BPASPolynomialoperator^ (int)

bool operator== (BPASPolynomial &)

bool operator!= (BPASPolynomial &)

## Static Public Attributes

static int characteristic

static bool isPrimeField

static bool isComplexField

Static Public Attributes inherited from BPASRing
static int characteristic

static bool isPrimeField

static bool isComplexField

## Friends

DenseUnivariateRationalPolynomial operator+ (mpq_class c, DenseUnivariateRationalPolynomial p)

DenseUnivariateRationalPolynomial operator- (mpq_class c, DenseUnivariateRationalPolynomial p)

DenseUnivariateRationalPolynomial operator* (mpq_class c, DenseUnivariateRationalPolynomial p)

DenseUnivariateRationalPolynomial operator* (sfixn c, DenseUnivariateRationalPolynomial p)

DenseUnivariateRationalPolynomial operator/ (mpq_class c, DenseUnivariateRationalPolynomial p)

std::ostream & operator<< (std::ostream &out, DenseUnivariateRationalPolynomial b)

## Constructor & Destructor Documentation

 DenseUnivariateRationalPolynomial::DenseUnivariateRationalPolynomial ( )
inline

Construct a polynomial

Parameters
 d
 DenseUnivariateRationalPolynomial::DenseUnivariateRationalPolynomial ( int s )
inline

Construct a polynomial with degree

Parameters
 d,: Size of the polynomial
 DenseUnivariateRationalPolynomial::DenseUnivariateRationalPolynomial ( Integer e )
inline

Construct a polynomial with a coefficient

Parameters
 e,: The coefficient
 DenseUnivariateRationalPolynomial::DenseUnivariateRationalPolynomial ( const DenseUnivariateRationalPolynomial & b )
inline

Copy constructor

Parameters
 b,: A densed univariate rationl polynomial
 DenseUnivariateRationalPolynomial::~DenseUnivariateRationalPolynomial ( )
inline

Destroy the polynomial

Parameters

## Member Function Documentation

 void DenseUnivariateRationalPolynomial::add ( DenseUnivariateRationalPolynomial b )

Parameters
 b,: A univariate rational polynomial
 mpq_class DenseUnivariateRationalPolynomial::coefficient ( int k )
inline

Get a coefficient of the polynomial

Parameters
 k,: Offset
 mpq_class* DenseUnivariateRationalPolynomial::coefficients ( int k = `0` )
inline

Get coefficients of the polynomial, given start offset

Parameters
 k,: Offset
 int DenseUnivariateRationalPolynomial::content ( )
inline

Content of the polynomial

Parameters
 int DenseUnivariateRationalPolynomial::degree ( )
inlinevirtual

Get degree of the polynomial

Parameters

Implements BPASUnivariatePolynomial.

 void DenseUnivariateRationalPolynomial::differentiate ( int k )
virtual

Compute k-th differentiate

Parameters
 k,: k-th differentiate, k > 0

Implements BPASUnivariatePolynomial.

 void DenseUnivariateRationalPolynomial::diophantinEquationSolve ( DenseUnivariateRationalPolynomial a, DenseUnivariateRationalPolynomial b, DenseUnivariateRationalPolynomial * s, DenseUnivariateRationalPolynomial * t )

s*a + t*b = c, where c in the ideal (a,b)

Parameters
 a,: A univariate polynomial b: A univariate polynomial s,: Either s = 0 or degree(s) < degree(b) t
 bool DenseUnivariateRationalPolynomial::divideByVariableIfCan ( )

Divide by variable if it is zero

Parameters
 mpq_class DenseUnivariateRationalPolynomial::evaluate ( mpq_class x )

Evaluate f(x)

Parameters
 x,: Evaluation point
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::gcd ( DenseUnivariateRationalPolynomial q, int type = `0` )

GCD(p, q)

Parameters
 q,: The other polynomial
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::halfExtendedEuclidean ( DenseUnivariateRationalPolynomial b, DenseUnivariateRationalPolynomial * g )

s * a g (mod b), where g = gcd(a, b)

Parameters
 b,: A univariate polynomial g,: The GCD of a and b
 void DenseUnivariateRationalPolynomial::homothetic ( int k = `1` )

Homothetic operation

Parameters
 k > 0: 2^(k*d) * f(2^(-k)*x);
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::integrate ( )

Compute the integral with constant of integration 0

Parameters
 int DenseUnivariateRationalPolynomial::isConstant ( )
inlinevirtual

Is a constant

Parameters

Implements BPASRing.

 bool DenseUnivariateRationalPolynomial::isNegativeOne ( )
inlinevirtual

Is polynomial a constatn -1

Parameters

Implements BPASRing.

 bool DenseUnivariateRationalPolynomial::isOne ( )
inlinevirtual

Is polynomial a constatn 1

Parameters

Implements BPASRing.

 bool DenseUnivariateRationalPolynomial::isTrailingCoefficientZero ( )
virtual

Is the least signficant coefficient zero

Parameters

Implements BPASUnivariatePolynomial.

 bool DenseUnivariateRationalPolynomial::isZero ( )
inlinevirtual

Is zero polynomial

Parameters

Implements BPASRing.

 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::lazyPseudoDivide ( DenseUnivariateRationalPolynomial & b, mpq_class * c, mpq_class * d = `NULL` )

Lazy pseudo dividsion Return the quotient and itself becomes remainder e is the exact number of division steps

Parameters
 b,: The dividend polynomial c,: The leading coefficient of b to the power e d,: That to the power deg(a) - deg(b) + 1 - e
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::lazyPseudoDivide ( DenseUnivariateRationalPolynomial & b, DenseUnivariateRationalPolynomial * rem, mpq_class * c, mpq_class * d )

Lazy pseudo dividsion Return the quotient e is the exact number of division steps

Parameters
 b,: The divident polynomial rem,: The remainder polynomial c,: The leading coefficient of b to the power e d,: That to the power deg(a) - deg(b) + 1 - e
inline

Parameters
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::monicDivide ( DenseUnivariateRationalPolynomial & b )

Monic division Return quotient and itself become the remainder

Parameters
 b,: The dividend polynomial
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::monicDivide ( DenseUnivariateRationalPolynomial & b, DenseUnivariateRationalPolynomial * rem )

Monic division Return quotient

Parameters
 b,: The dividend polynomial rem,: The remainder polynomial
 void DenseUnivariateRationalPolynomial::negate ( )

Compute -f(x)

`@param`
 void DenseUnivariateRationalPolynomial::negativeOne ( )
inlinevirtual

Set polynomial to -1

Parameters

Implements BPASRing.

 void DenseUnivariateRationalPolynomial::negativeVariable ( )

Compute f(-x)

Parameters
 int DenseUnivariateRationalPolynomial::numberOfSignChanges ( )

Number of coefficient sign variation

Parameters
 void DenseUnivariateRationalPolynomial::one ( )
inlinevirtual

Set polynomial to 1

Parameters

Implements BPASRing.

 bool DenseUnivariateRationalPolynomial::operator!= ( DenseUnivariateRationalPolynomial & b )
inline

Parameters
 b,: A univariate rational polynoial
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator* ( DenseUnivariateRationalPolynomial b )

Multiply to another polynomial

Parameters
 b,: A univariate rational polynomial
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator* ( RationalNumber e )
inline

Parameters
 e,: A rational number
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator*= ( DenseUnivariateRationalPolynomial b )
inline

Parameters
 b,: A univariate rational polynomial
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator*= ( RationalNumber e )

Parameters
 e,: A rational number
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator*= ( sfixn e )

Parameters
 e,: A constant
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator+ ( DenseUnivariateRationalPolynomial b )

Parameters
 b,: A univariate rational polynomial
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator+ ( RationalNumber c )
inline

Parameters
 c,: A rational number
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator+= ( DenseUnivariateRationalPolynomial b )
inline

Parameters
 b,: A univariate rational polynomial
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator+= ( RationalNumber c )
inline

Parameters
 c,: A rational number
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator- ( DenseUnivariateRationalPolynomial b )

Subtract another polynomial

Parameters
 b,: A univariate rational polynomial
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator- ( )

Parameters
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator- ( RationalNumber c )
inline

Parameters
 c,: A rational number
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator-= ( DenseUnivariateRationalPolynomial b )
inline

Parameters
 b,: A univariate rational polynomial
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator-= ( RationalNumber c )
inline

Parameters
 c,: A rational number
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator/ ( DenseUnivariateRationalPolynomial b )
inline

Parameters
 b,: A univariate rational polynomial
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator/ ( RationalNumber e )
inline

Parameters
 e,: A rational number
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator/= ( DenseUnivariateRationalPolynomial b )

Parameters
 b,: A univariate rational polynomial
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator/= ( RationalNumber e )

Parameters
 e,: A rational number
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator<< ( int k )

Overload operator << replace by muplitying x^k

Parameters
 k,: The exponent of variable, k > 0
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator<<= ( int k )
inline

Overload operator <<= replace by muplitying x^k

Parameters
 k,: The exponent of variable, k > 0
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator= ( DenseUnivariateRationalPolynomial b )
inline

Parameters
 b,: A univariate rational polynoial
 bool DenseUnivariateRationalPolynomial::operator== ( DenseUnivariateRationalPolynomial & b )
inline

Parameters
 b,: A univariate rational polynoial
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator>> ( int k )

Overload operator >> replace by dividing x^k, and return the quotient

Parameters
 k,: The exponent of variable, k > 0
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator>>= ( int k )
inline

Overload operator >>= replace by dividing x^k, and return the quotient

Parameters
 k,: The exponent of variable, k > 0
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator^ ( int e )

Overload operator ^ replace xor operation by exponentiation

Parameters
 e,: The exponentiation, e > 0
 DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator^= ( int e )
inline

Overload operator ^= replace xor operation by exponentiation

Parameters
 e,: The exponentiation, e > 0
 Intervals DenseUnivariateRationalPolynomial::positiveRealRootIsolate ( mpq_class width, int ts = `-1` )
inline

Positive real root isolation for square-free polynomials

Parameters
 width,: Interval's right - left < width : Taylor Shift option: 0 - CMY; -1 - optimized
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::pseudoDivide ( DenseUnivariateRationalPolynomial & b, mpq_class * d = `NULL` )

Pseudo dividsion Return the quotient and itself becomes remainder

Parameters
 b,: The divident polynomial d,: The leading coefficient of b to the power deg(a) - deg(b) + 1
 DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::pseudoDivide ( DenseUnivariateRationalPolynomial & b, DenseUnivariateRationalPolynomial * rem, mpq_class * d )

Pseudo dividsion Return the quotient

Parameters
 b,: The divident polynomial rem,: The remainder polynomial d,: The leading coefficient of b to the power deg(a) - deg(b) + 1
 Intervals DenseUnivariateRationalPolynomial::realRootIsolate ( mpq_class width, int ts = `-1` )
inline

Real root isolation for square-free polynomials

Parameters
 width,: Interval's right - left < width : Taylor Shift option: 0 - CMY; -1 - optimized
 void DenseUnivariateRationalPolynomial::reciprocal ( )

Revert coefficients

Parameters
 void DenseUnivariateRationalPolynomial::refineRoot ( Interval * a, mpq_class width )
inline

Refine a root

Parameters
 a,: The root width,: Interval's right - left < width
 Intervals DenseUnivariateRationalPolynomial::refineRoots ( Intervals & a, mpq_class width )
inline

Refine the roots

a: The roots

Parameters
 width,: Interval's right - left < width
 mpz_class DenseUnivariateRationalPolynomial::rootBound ( )

Return an integer k such that any positive root alpha of the polynomial satisfies alpha < 2^k

Parameters
 void DenseUnivariateRationalPolynomial::scaleTransform ( int k )

Scale transform operation

Parameters
 k > 0: f(2^k*x)
 void DenseUnivariateRationalPolynomial::setCoefficient ( int k, mpq_class value )
inline

Set a coefficient of the polynomial

Parameters
 k,: Offset val,: Coefficient
 void DenseUnivariateRationalPolynomial::setVariableName ( std::string x )
inlinevirtual

Set variable's name

Parameters
 x,: Varable's name

Implements BPASUnivariatePolynomial.

 std::vector DenseUnivariateRationalPolynomial::squareFree ( )

Square free

Parameters
 void DenseUnivariateRationalPolynomial::subtract ( DenseUnivariateRationalPolynomial b )

Subtract another polynomial from itself

Parameters
 b,: A univariate rational polynomial
 void DenseUnivariateRationalPolynomial::taylorShift ( int ts = `-1` )

Taylor Shift operation by 1

Parameters
 ts,: Algorithm id
 std::string DenseUnivariateRationalPolynomial::variable ( )
inlinevirtual

Get variable's name

Parameters

Implements BPASUnivariatePolynomial.

 void DenseUnivariateRationalPolynomial::zero ( )
inlinevirtual

Zero polynomial

Parameters

Implements BPASRing.

## Friends And Related Function Documentation

 std::ostream& operator<< ( std::ostream & out, DenseUnivariateRationalPolynomial b )
friend