Basic Polynomial Algebra Subprograms (BPAS)
v. 1.791
|
A univariate polynomial with RationalNumber coefficients represented densely. More...
#include <urpolynomial.h>
Public Member Functions | |
DenseUnivariateRationalPolynomial () | |
Construct a polynomial. More... | |
DenseUnivariateRationalPolynomial (int s) | |
Construct a polynomial with degree. More... | |
DenseUnivariateRationalPolynomial (const Integer &e) | |
Construct a polynomial with a coefficient. More... | |
DenseUnivariateRationalPolynomial (const RationalNumber &e) | |
DenseUnivariateRationalPolynomial (const DenseUnivariateRationalPolynomial &b) | |
Copy constructor. More... | |
~DenseUnivariateRationalPolynomial () | |
Destroy the polynomial. More... | |
Integer | degree () const |
Get degree of the polynomial. More... | |
RationalNumber | leadingCoefficient () const |
Get the leading coefficient. More... | |
RationalNumber | trailingCoefficient () const |
Integer | numberOfTerms () const |
mpq_class * | coefficients (int k=0) const |
Get coefficients of the polynomial, given start offset. More... | |
RationalNumber | coefficient (int k) const |
Get a coefficient of the polynomial. More... | |
void | setCoefficient (int k, const RationalNumber &value) |
Set a coefficient of the polynomial. More... | |
void | setCoefficient (int k, double value) |
Symbol | variable () const |
Get variable's name. More... | |
void | setVariableName (const Symbol &x) |
Set variable's name. More... | |
DenseUnivariateRationalPolynomial | unitCanonical (DenseUnivariateRationalPolynomial *u=NULL, DenseUnivariateRationalPolynomial *v=NULL) const |
DenseUnivariateRationalPolynomial & | operator= (const DenseUnivariateRationalPolynomial &b) |
Overload operator =. More... | |
DenseUnivariateRationalPolynomial & | operator= (const RationalNumber &r) |
bool | operator!= (const DenseUnivariateRationalPolynomial &b) const |
Overload operator !=. More... | |
bool | operator== (const DenseUnivariateRationalPolynomial &b) const |
Overload operator ==. More... | |
bool | isZero () const |
Is zero polynomial. More... | |
void | zero () |
Zero polynomial. More... | |
bool | isOne () const |
Is polynomial a constatn 1. More... | |
void | one () |
Set polynomial to 1. More... | |
bool | isNegativeOne () const |
Is polynomial a constatn -1. More... | |
void | negativeOne () |
Set polynomial to -1. More... | |
int | isConstant () const |
Is a constant. More... | |
RationalNumber | content () const |
Content of the polynomial. More... | |
DenseUnivariateRationalPolynomial | primitivePart () const |
DenseUnivariateRationalPolynomial | operator^ (long long int e) const |
Overload operator ^ replace xor operation by exponentiation. More... | |
DenseUnivariateRationalPolynomial & | operator^= (long long int e) |
Overload operator ^= replace xor operation by exponentiation. More... | |
DenseUnivariateRationalPolynomial | operator<< (int k) const |
Overload operator << replace by muplitying x^k. More... | |
DenseUnivariateRationalPolynomial & | operator<<= (int k) |
Overload operator <<= replace by muplitying x^k. More... | |
DenseUnivariateRationalPolynomial | operator>> (int k) const |
Overload operator >> replace by dividing x^k, and return the quotient. More... | |
DenseUnivariateRationalPolynomial & | operator>>= (int k) |
Overload operator >>= replace by dividing x^k, and return the quotient. More... | |
DenseUnivariateRationalPolynomial | operator+ (const DenseUnivariateRationalPolynomial &b) const |
Overload operator +. More... | |
DenseUnivariateRationalPolynomial & | operator+= (const DenseUnivariateRationalPolynomial &b) |
Overload Operator +=. More... | |
void | add (const DenseUnivariateRationalPolynomial &b) |
Add another polynomial to itself. More... | |
DenseUnivariateRationalPolynomial | operator+ (const RationalNumber &c) const |
Overload Operator +. More... | |
DenseUnivariateRationalPolynomial | operator+ (const mpq_class &c) const |
DenseUnivariateRationalPolynomial & | operator+= (const RationalNumber &c) |
Overload Operator +=. More... | |
DenseUnivariateRationalPolynomial & | operator+= (const mpq_class &c) |
DenseUnivariateRationalPolynomial | operator- (const DenseUnivariateRationalPolynomial &b) const |
Subtract another polynomial. More... | |
DenseUnivariateRationalPolynomial & | operator-= (const DenseUnivariateRationalPolynomial &b) |
Overload operator -=. More... | |
DenseUnivariateRationalPolynomial | operator- () const |
Overload operator -, negate. More... | |
void | subtract (const DenseUnivariateRationalPolynomial &b) |
Subtract another polynomial from itself. More... | |
DenseUnivariateRationalPolynomial | operator- (const RationalNumber &c) const |
Overload operator -. More... | |
DenseUnivariateRationalPolynomial | operator- (const mpq_class &c) const |
DenseUnivariateRationalPolynomial & | operator-= (const RationalNumber &c) |
Overload operator -=. More... | |
DenseUnivariateRationalPolynomial & | operator-= (const mpq_class &c) |
DenseUnivariateRationalPolynomial | operator* (const DenseUnivariateRationalPolynomial &b) const |
Multiply to another polynomial. More... | |
DenseUnivariateRationalPolynomial & | operator*= (const DenseUnivariateRationalPolynomial &b) |
Overload operator *=. More... | |
DenseUnivariateRationalPolynomial | operator* (const RationalNumber &e) const |
Overload operator *. More... | |
DenseUnivariateRationalPolynomial | operator* (const mpq_class &e) const |
DenseUnivariateRationalPolynomial | operator* (const sfixn &e) const |
DenseUnivariateRationalPolynomial & | operator*= (const RationalNumber &e) |
Overload operator *=. More... | |
DenseUnivariateRationalPolynomial & | operator*= (const mpq_class &e) |
DenseUnivariateRationalPolynomial & | operator*= (const sfixn &e) |
Overload operator *=. More... | |
DenseUnivariateRationalPolynomial | operator/ (const DenseUnivariateRationalPolynomial &b) const |
Overload operator / ExactDivision. More... | |
DenseUnivariateRationalPolynomial & | operator/= (const DenseUnivariateRationalPolynomial &b) |
Overload operator /= ExactDivision. More... | |
DenseUnivariateRationalPolynomial | operator% (const DenseUnivariateRationalPolynomial &b) const |
DenseUnivariateRationalPolynomial & | operator%= (const DenseUnivariateRationalPolynomial &b) |
DenseUnivariateRationalPolynomial | operator/ (const RationalNumber &e) const |
Overload operator /. More... | |
DenseUnivariateRationalPolynomial | operator/ (const mpq_class &e) const |
DenseUnivariateRationalPolynomial & | operator/= (const RationalNumber &e) |
Overload operator /=. More... | |
DenseUnivariateRationalPolynomial & | operator/= (const mpq_class &e) |
DenseUnivariateRationalPolynomial | monicDivide (const DenseUnivariateRationalPolynomial &b) |
Monic division Return quotient and itself become the remainder. More... | |
DenseUnivariateRationalPolynomial | monicDivide (const DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *rem) const |
Monic division Return quotient. More... | |
DenseUnivariateRationalPolynomial | lazyPseudoDivide (const DenseUnivariateRationalPolynomial &b, RationalNumber *c, RationalNumber *d=NULL) |
Lazy pseudo dividsion Return the quotient and itself becomes remainder e is the exact number of division steps. More... | |
DenseUnivariateRationalPolynomial | lazyPseudoDivide (const DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *rem, RationalNumber *c, RationalNumber *d) const |
Lazy pseudo dividsion Return the quotient e is the exact number of division steps. More... | |
DenseUnivariateRationalPolynomial | pseudoDivide (const DenseUnivariateRationalPolynomial &b, RationalNumber *d=NULL) |
Pseudo dividsion Return the quotient and itself becomes remainder. More... | |
DenseUnivariateRationalPolynomial | pseudoDivide (const DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *rem, RationalNumber *d) const |
Pseudo dividsion Return the quotient. More... | |
DenseUnivariateRationalPolynomial | halfExtendedEuclidean (const DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *g) const |
s * a g (mod b), where g = gcd(a, b) More... | |
void | diophantinEquationSolve (const DenseUnivariateRationalPolynomial &a, const DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *s, DenseUnivariateRationalPolynomial *t) const |
s*a + t*b = c, where c in the ideal (a,b) More... | |
void | differentiate (int k) |
Convert current object to its k-th derivative. More... | |
void | differentiate () |
Convert current object to its derivative. More... | |
DenseUnivariateRationalPolynomial | derivative (int k) const |
Return k-th derivative. More... | |
DenseUnivariateRationalPolynomial | derivative () const |
Compute derivative. More... | |
void | integrate () |
Compute the integral with constant of integration 0. More... | |
DenseUnivariateRationalPolynomial | integral () const |
Compute integral with constant of integration 0. More... | |
RationalNumber | evaluate (const RationalNumber &x) const |
Evaluate f(x) More... | |
Integer | evaluate (const Integer &x) const |
Evaluate f(x) More... | |
template<class LargerRing > | |
LargerRing | evaluate (const LargerRing &x) const |
Evaluate f(x) More... | |
bool | isConstantTermZero () const |
Is the least signficant coefficient zero. More... | |
DenseUnivariateRationalPolynomial | gcd (const DenseUnivariateRationalPolynomial &q, int type) const |
GCD(p, q) More... | |
DenseUnivariateRationalPolynomial | gcd (const DenseUnivariateRationalPolynomial &q) const |
Factors< DenseUnivariateRationalPolynomial > | squareFree () const |
Square free. More... | |
bool | divideByVariableIfCan () |
Divide by variable if it is zero. More... | |
int | numberOfSignChanges () |
Number of coefficient sign variation. More... | |
void | reciprocal () |
Revert coefficients. More... | |
void | homothetic (int k=1) |
Homothetic operation. More... | |
void | scaleTransform (int k) |
Scale transform operation. More... | |
void | negativeVariable () |
Compute f(-x) More... | |
void | negate () |
Compute -f(x) More... | |
mpz_class | rootBound () |
Return an integer k such that any positive root alpha of the polynomial satisfies alpha < 2^k. More... | |
void | taylorShift (int ts=-1) |
Taylor Shift operation by 1. More... | |
Intervals | positiveRealRootIsolate (mpq_class width, int ts=-1) |
Positive real root isolation for square-free polynomials. More... | |
void | positiveRealRootIsolate (mpq_class width, Intervals pIs, int ts=-1) |
Intervals | realRootIsolate (mpq_class width, int ts=-1) |
Real root isolation for square-free polynomials. More... | |
void | refineRoot (Interval *a, mpq_class width) |
Refine a root. More... | |
Intervals | refineRoots (Intervals &a, mpq_class width) |
Refine the roots. More... | |
void | print (std::ostream &out) const |
Overload stream operator <<. More... | |
ExpressionTree | convertToExpressionTree () const |
Integer | euclideanSize () const |
BPASEuclideanDomain methods. | |
DenseUnivariateRationalPolynomial | euclideanDivision (const DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *q=NULL) const |
DenseUnivariateRationalPolynomial | extendedEuclidean (const DenseUnivariateRationalPolynomial &b, DenseUnivariateRationalPolynomial *s=NULL, DenseUnivariateRationalPolynomial *t=NULL) const |
DenseUnivariateRationalPolynomial | quotient (const DenseUnivariateRationalPolynomial &b) const |
DenseUnivariateRationalPolynomial | remainder (const DenseUnivariateRationalPolynomial &b) const |
Friends | |
DenseUnivariateRationalPolynomial | operator+ (const mpq_class &c, const DenseUnivariateRationalPolynomial &p) |
DenseUnivariateRationalPolynomial | operator- (const mpq_class &c, const DenseUnivariateRationalPolynomial &p) |
DenseUnivariateRationalPolynomial | operator* (const mpq_class &c, const DenseUnivariateRationalPolynomial &p) |
DenseUnivariateRationalPolynomial | operator* (const sfixn &c, const DenseUnivariateRationalPolynomial &p) |
DenseUnivariateRationalPolynomial | operator/ (const mpq_class &c, const DenseUnivariateRationalPolynomial &p) |
A univariate polynomial with RationalNumber coefficients represented densely.
|
inline |
Construct a polynomial.
d |
|
inline |
Construct a polynomial with degree.
d | Size of the polynomial |
|
inline |
Construct a polynomial with a coefficient.
e | The coefficient |
|
inline |
Copy constructor.
b | A densed univariate rationl polynomial |
|
inline |
Destroy the polynomial.
void DenseUnivariateRationalPolynomial::add | ( | const DenseUnivariateRationalPolynomial & | b | ) |
Add another polynomial to itself.
b | A univariate rational polynomial |
|
inlinevirtual |
Get a coefficient of the polynomial.
k | Offset |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inline |
Get coefficients of the polynomial, given start offset.
k | Offset |
|
inline |
Content of the polynomial.
|
inline |
Get degree of the polynomial.
|
inlinevirtual |
Return k-th derivative.
k | k-th derivative, k > 0 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inlinevirtual |
Compute derivative.
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
virtual |
Convert current object to its k-th derivative.
k | Order of the derivative, k > 0 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inlinevirtual |
Convert current object to its derivative.
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
void DenseUnivariateRationalPolynomial::diophantinEquationSolve | ( | const DenseUnivariateRationalPolynomial & | a, |
const DenseUnivariateRationalPolynomial & | b, | ||
DenseUnivariateRationalPolynomial * | s, | ||
DenseUnivariateRationalPolynomial * | t | ||
) | const |
s*a + t*b = c, where c in the ideal (a,b)
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.
|
virtual |
Evaluate f(x)
x | Rational evaluation point |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
Evaluate f(x)
x | Evaluation point |
|
inline |
Evaluate f(x)
x | Evaluation point in a larger ring, i.e. a ring in which the rationals can be embedded |
DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::gcd | ( | const DenseUnivariateRationalPolynomial & | q, |
int | type | ||
) | const |
GCD(p, q)
q | The other polynomial |
DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::halfExtendedEuclidean | ( | const DenseUnivariateRationalPolynomial & | b, |
DenseUnivariateRationalPolynomial * | g | ||
) | const |
s * a g (mod b), where g = gcd(a, b)
b | A univariate polynomial |
g | The GCD of a and b |
void DenseUnivariateRationalPolynomial::homothetic | ( | int | k = 1 | ) |
Homothetic operation.
k | > 0: 2^(k*d) * f(2^(-k)*x); |
|
inline |
Compute integral with constant of integration 0.
void DenseUnivariateRationalPolynomial::integrate | ( | ) |
Compute the integral with constant of integration 0.
Convert | current object to its integral with constant of integration 0 |
|
inline |
Is a constant.
bool DenseUnivariateRationalPolynomial::isConstantTermZero | ( | ) | const |
Is the least signficant coefficient zero.
|
inline |
Is polynomial a constatn -1.
|
inline |
Is polynomial a constatn 1.
|
inline |
Is zero polynomial.
|
virtual |
Lazy pseudo dividsion Return the quotient and itself becomes remainder e is the exact number of division steps.
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 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
virtual |
Lazy pseudo dividsion Return the quotient e is the exact number of division steps.
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 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inline |
Get the leading coefficient.
|
virtual |
Monic division Return quotient and itself become the remainder.
b | The dividend polynomial |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
virtual |
Monic division Return quotient.
b | The dividend polynomial |
rem | The remainder polynomial |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
void DenseUnivariateRationalPolynomial::negate | ( | ) |
Compute -f(x)
|
inline |
Set polynomial to -1.
void DenseUnivariateRationalPolynomial::negativeVariable | ( | ) |
Compute f(-x)
int DenseUnivariateRationalPolynomial::numberOfSignChanges | ( | ) |
Number of coefficient sign variation.
|
inline |
Set polynomial to 1.
|
inline |
Overload operator !=.
b | A univariate rational polynoial |
DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator* | ( | const DenseUnivariateRationalPolynomial & | b | ) | const |
Multiply to another polynomial.
b | A univariate rational polynomial |
|
inline |
Overload operator *.
e | A rational number |
|
inline |
Overload operator *=.
b | A univariate rational polynomial |
DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator*= | ( | const RationalNumber & | e | ) |
Overload operator *=.
e | A rational number |
DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator*= | ( | const sfixn & | e | ) |
Overload operator *=.
e | A constant |
DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator+ | ( | const DenseUnivariateRationalPolynomial & | b | ) | const |
Overload operator +.
b | A univariate rational polynomial |
|
inline |
Overload Operator +.
c | A rational number |
|
inline |
Overload Operator +=.
b | A univariate rational polynomial |
|
inline |
Overload Operator +=.
c | A rational number |
DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator- | ( | const DenseUnivariateRationalPolynomial & | b | ) | const |
Subtract another polynomial.
b | A univariate rational polynomial |
DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator- | ( | ) | const |
Overload operator -, negate.
|
inline |
Overload operator -.
c | A rational number |
|
inline |
Overload operator -=.
b | A univariate rational polynomial |
|
inline |
Overload operator -=.
c | A rational number |
|
inline |
Overload operator / ExactDivision.
b | A univariate rational polynomial |
|
inline |
Overload operator /.
e | A rational number |
DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator/= | ( | const DenseUnivariateRationalPolynomial & | b | ) |
Overload operator /= ExactDivision.
b | A univariate rational polynomial |
DenseUnivariateRationalPolynomial& DenseUnivariateRationalPolynomial::operator/= | ( | const RationalNumber & | e | ) |
Overload operator /=.
e | A rational number |
|
virtual |
Overload operator << replace by muplitying x^k.
k | The exponent of variable, k > 0 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inlinevirtual |
Overload operator <<= replace by muplitying x^k.
k | The exponent of variable, k > 0 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inline |
Overload operator =.
b | A univariate rational polynoial |
|
inline |
Overload operator ==.
b | A univariate rational polynoial |
|
virtual |
Overload operator >> replace by dividing x^k, and return the quotient.
k | The exponent of variable, k > 0 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inlinevirtual |
Overload operator >>= replace by dividing x^k, and return the quotient.
k | The exponent of variable, k > 0 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
DenseUnivariateRationalPolynomial DenseUnivariateRationalPolynomial::operator^ | ( | long long int | e | ) | const |
Overload operator ^ replace xor operation by exponentiation.
e | The exponentiation, e > 0 |
|
inline |
Overload operator ^= replace xor operation by exponentiation.
e | The exponentiation, e > 0 |
|
inline |
Positive real root isolation for square-free polynomials.
width | Interval's right - left < width : Taylor Shift option: 0 - CMY; -1 - optimized |
void DenseUnivariateRationalPolynomial::print | ( | std::ostream & | out | ) | const |
Overload stream operator <<.
out | Stream object |
b | A univariate rational polynoial |
|
virtual |
Pseudo dividsion Return the quotient and itself becomes remainder.
b | The divident polynomial |
d | The leading coefficient of b to the power deg(a) - deg(b) + 1 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
virtual |
Pseudo dividsion Return the quotient.
b | The divident polynomial |
rem | The remainder polynomial |
d | The leading coefficient of b to the power deg(a) - deg(b) + 1 |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inline |
Real root isolation for square-free polynomials.
width | Interval's right - left < width : Taylor Shift option: 0 - CMY; -1 - optimized |
void DenseUnivariateRationalPolynomial::reciprocal | ( | ) |
Revert coefficients.
|
inline |
Refine a root.
a | The root |
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.
void DenseUnivariateRationalPolynomial::scaleTransform | ( | int | k | ) |
Scale transform operation.
k | > 0: f(2^k*x) |
|
inlinevirtual |
Set a coefficient of the polynomial.
k | Offset |
val | Coefficient |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inlinevirtual |
Set variable's name.
x | Varable's name |
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
Factors<DenseUnivariateRationalPolynomial> DenseUnivariateRationalPolynomial::squareFree | ( | ) | const |
Square free.
void DenseUnivariateRationalPolynomial::subtract | ( | const DenseUnivariateRationalPolynomial & | b | ) |
Subtract another polynomial from itself.
b | A univariate rational polynomial |
void DenseUnivariateRationalPolynomial::taylorShift | ( | int | ts = -1 | ) |
Taylor Shift operation by 1.
ts | Algorithm id |
|
inlinevirtual |
Get variable's name.
Implements BPASUnivariatePolynomial< RationalNumber, DenseUnivariateRationalPolynomial >.
|
inline |
Zero polynomial.