Basic Polynomial Algebra Subprograms (BPAS)
v. 1.791
|
A univariate polynomial with arbitrary BPASField coefficients represented densely. More...
#include <dupolynomial.h>
Public Member Functions | |
DenseUnivariatePolynomial () | |
Construct a polynomial. More... | |
DenseUnivariatePolynomial (int s) | |
Construct a polynomial with degree. More... | |
DenseUnivariatePolynomial (Field e) | |
DenseUnivariatePolynomial (const DenseUnivariatePolynomial< Field > &b) | |
Copy constructor. More... | |
~DenseUnivariatePolynomial () | |
Destroy the polynomial. More... | |
Integer | degree () const |
Get degree of the polynomial. More... | |
Field | leadingCoefficient () const |
Get the leading coefficient. More... | |
Field | trailingCoefficient () const |
Integer | numberOfTerms () const |
Field * | coefficients (int k=0) |
Get coefficients of the polynomial, given start offset. More... | |
Field | coefficient (int k) const |
Get a coefficient of the polynomial. More... | |
void | setCoefficient (int k, const Field &value) |
Set a coefficient of the polynomial. More... | |
Symbol | variable () const |
Get variable's name. More... | |
void | setVariableName (const Symbol &x) |
Set variable's name. More... | |
DenseUnivariatePolynomial< Field > & | operator= (const DenseUnivariatePolynomial< Field > &b) |
Overload operator =. More... | |
DenseUnivariatePolynomial< Field > & | operator= (const Field &f) |
bool | operator!= (const DenseUnivariatePolynomial< Field > &b) const |
Overload operator !=. More... | |
bool | operator== (const DenseUnivariatePolynomial< Field > &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... | |
DenseUnivariatePolynomial< Field > | unitCanonical (DenseUnivariatePolynomial< Field > *u, DenseUnivariatePolynomial< Field > *v) const |
Obtain the unit normal (a.k.a canonical associate) of an element. More... | |
Field | content () const |
Content of the polynomial. More... | |
DenseUnivariatePolynomial< Field > | primitivePart () const |
DenseUnivariatePolynomial< Field > | operator^ (long long int e) const |
Overload operator ^ replace xor operation by exponentiation. More... | |
DenseUnivariatePolynomial< Field > & | operator^= (long long int e) |
Overload operator ^= replace xor operation by exponentiation. More... | |
DenseUnivariatePolynomial< Field > | operator<< (int k) const |
Overload operator << replace by muplitying x^k. More... | |
DenseUnivariatePolynomial< Field > & | operator<<= (int k) |
Overload operator <<= replace by muplitying x^k. More... | |
DenseUnivariatePolynomial< Field > | operator>> (int k) const |
Overload operator >> replace by dividing x^k, and return the quotient. More... | |
DenseUnivariatePolynomial< Field > & | operator>>= (int k) |
Overload operator >>= replace by dividing x^k, and return the quotient. More... | |
DenseUnivariatePolynomial< Field > | operator+ (const DenseUnivariatePolynomial< Field > &b) const |
Overload operator +. More... | |
DenseUnivariatePolynomial< Field > & | operator+= (const DenseUnivariatePolynomial< Field > &b) |
Overload Operator +=. More... | |
void | add (const DenseUnivariatePolynomial< Field > &b) |
Add another polynomial to itself. More... | |
DenseUnivariatePolynomial< Field > | operator+ (const Field &c) const |
Overload Operator +. More... | |
DenseUnivariatePolynomial< Field > & | operator+= (const Field &c) |
Overload Operator +=. More... | |
DenseUnivariatePolynomial< Field > | operator- (const DenseUnivariatePolynomial< Field > &b) const |
Subtract another polynomial. More... | |
DenseUnivariatePolynomial< Field > & | operator-= (const DenseUnivariatePolynomial< Field > &b) |
Overload operator -=. More... | |
DenseUnivariatePolynomial< Field > | operator- () const |
Overload operator -, negate. More... | |
void | subtract (const DenseUnivariatePolynomial< Field > &b) |
Subtract another polynomial from itself. More... | |
DenseUnivariatePolynomial< Field > | operator- (const Field &c) const |
Overload operator -. More... | |
DenseUnivariatePolynomial< Field > & | operator-= (const Field &c) |
Overload operator -=. More... | |
bool | SRGFNcmp (mpz_class &p) |
Helper function to compare a given prime number with manually computed Generalized Fermat Numbers. More... | |
DenseUnivariatePolynomial< Field > | operator* (const DenseUnivariatePolynomial< Field > &b) const |
Multiply to another polynomial. More... | |
void | FFT (SmallPrimeField *field, int K, int e, SmallPrimeField &omega) |
void | FFT (BigPrimeField *field, int K, int e, BigPrimeField &omega) |
void | FFT (GeneralizedFermatPrimeField *field, int K, int e, GeneralizedFermatPrimeField &omega) |
void | IFFT (SmallPrimeField *field, int K, int e, SmallPrimeField &omega) |
void | IFFT (BigPrimeField *field, int K, int e, BigPrimeField &omega) |
void | IFFT (GeneralizedFermatPrimeField *field, int K, int e, GeneralizedFermatPrimeField &omega) |
DenseUnivariatePolynomial< Field > & | operator*= (const DenseUnivariatePolynomial< Field > &b) |
Overload operator *=. More... | |
DenseUnivariatePolynomial< Field > | operator* (const Field &e) const |
Overload operator *. More... | |
DenseUnivariatePolynomial< Field > & | operator*= (const Field &e) |
Overload operator *=. More... | |
DenseUnivariatePolynomial< Field > | operator/ (const DenseUnivariatePolynomial< Field > &b) const |
Overload operator / ExactDivision. More... | |
DenseUnivariatePolynomial< Field > & | operator/= (const DenseUnivariatePolynomial< Field > &b) |
Overload operator /= ExactDivision. More... | |
DenseUnivariatePolynomial< Field > | operator/ (const Field &e) const |
Overload operator /. More... | |
DenseUnivariatePolynomial< Field > & | operator/= (const Field &e) |
Overload operator /=. More... | |
DenseUnivariatePolynomial< Field > | monicDivide (const DenseUnivariatePolynomial< Field > &b) |
Monic division Return quotient and itself become the remainder. More... | |
DenseUnivariatePolynomial< Field > | monicDivide (const DenseUnivariatePolynomial< Field > &b, DenseUnivariatePolynomial< Field > *rem) const |
Monic division Return quotient. More... | |
DenseUnivariatePolynomial< Field > | lazyPseudoDivide (const DenseUnivariatePolynomial< Field > &b, Field *c, Field *d) |
Lazy pseudo dividsion Return the quotient and itself becomes remainder e is the exact number of division steps. More... | |
DenseUnivariatePolynomial< Field > | lazyPseudoDivide (const DenseUnivariatePolynomial< Field > &b, DenseUnivariatePolynomial< Field > *rem, Field *c, Field *d) const |
Lazy pseudo dividsion Return the quotient e is the exact number of division steps. More... | |
DenseUnivariatePolynomial< Field > | pseudoDivide (const DenseUnivariatePolynomial< Field > &b, Field *d=NULL) |
Pseudo dividsion Return the quotient and itself becomes remainder. More... | |
DenseUnivariatePolynomial< Field > | pseudoDivide (const DenseUnivariatePolynomial< Field > &b, DenseUnivariatePolynomial< Field > *rem, Field *d) const |
Pseudo dividsion Return the quotient. More... | |
DenseUnivariatePolynomial< Field > | halfExtendedEuclidean (const DenseUnivariatePolynomial< Field > &b, DenseUnivariatePolynomial< Field > *g) |
s * a g (mod b), where g = gcd(a, b) More... | |
void | diophantinEquationSolve (const DenseUnivariatePolynomial< Field > &a, const DenseUnivariatePolynomial< Field > &b, DenseUnivariatePolynomial< Field > *s, DenseUnivariatePolynomial< Field > *t) |
s*a + t*b = c, where c in the ideal (a,b) More... | |
void | differentiate (int k) |
Compute k-th differentiate. More... | |
void | differentiate () |
Differentiate this polynomial, setting itself to its derivative. | |
DenseUnivariatePolynomial< Field > | derivative (int k) const |
Obtain the kth derivative of this polynomial. More... | |
DenseUnivariatePolynomial< Field > | derivative () const |
Obtain the derivative of this polynomial. More... | |
DenseUnivariatePolynomial< Field > | integrate () const |
Compute the integral with constant of integration 0. More... | |
Field | evaluate (const Field &x) const |
Evaluate f(x) More... | |
bool | isConstantTermZero () const |
Is the least signficant coefficient zero. More... | |
DenseUnivariatePolynomial< Field > | gcd (const DenseUnivariatePolynomial< Field > &q, int type) const |
GCD(p, q) More... | |
DenseUnivariatePolynomial< Field > | gcd (const DenseUnivariatePolynomial< Field > &q) const |
Get GCD of *this and other. More... | |
Factors< DenseUnivariatePolynomial< Field > > | squareFree () const |
Square free. More... | |
bool | divideByVariableIfCan () |
Divide by variable if it is zero. More... | |
void | reciprocal () |
Number of coefficient sign variation. More... | |
void | homothetic (int k) |
Homothetic operation. More... | |
void | scaleTransform (int k) |
Scale transform operation. More... | |
void | negativeVariable () |
Compute f(-x) More... | |
void | negate () |
Compute -f(x) More... | |
void | print (std::ostream &out) const |
Overload stream operator <<. More... | |
ExpressionTree | convertToExpressionTree () const |
Convert this to an expression tree. More... | |
Integer | euclideanSize () const |
Euclidean domain methods. | |
DenseUnivariatePolynomial< Field > | euclideanDivision (const DenseUnivariatePolynomial< Field > &b, DenseUnivariatePolynomial< Field > *q=NULL) const |
Perform the eucldiean division of *this and b. More... | |
DenseUnivariatePolynomial< Field > | extendedEuclidean (const DenseUnivariatePolynomial< Field > &b, DenseUnivariatePolynomial< Field > *s=NULL, DenseUnivariatePolynomial< Field > *t=NULL) const |
Perform the extended euclidean division on *this and b. More... | |
DenseUnivariatePolynomial< Field > | quotient (const DenseUnivariatePolynomial< Field > &b) const |
Get the quotient of *this and b. More... | |
DenseUnivariatePolynomial< Field > | remainder (const DenseUnivariatePolynomial< Field > &b) const |
Get the remainder of *this and b. More... | |
DenseUnivariatePolynomial< Field > | operator% (const DenseUnivariatePolynomial< Field > &b) const |
Get the remainder of *this and b;. More... | |
DenseUnivariatePolynomial< Field > & | operator%= (const DenseUnivariatePolynomial< Field > &b) |
Assign *this to be the remainder of *this and b. More... | |
DenseUnivariatePolynomial< Field > | Reverse () const |
Reverse a polynomial (based on Modern Computer Algebra , Newton Iteration Chapter 9) More... | |
DenseUnivariatePolynomial< Field > | NewtonIterationInversion (int l) |
Does Newton Iteration to compute the Reverse Inverse of a polynomial (based on Modern Computer Algebra , Newton Iteration Chapter 9) More... | |
void | NewtonDivisionQuotient (DenseUnivariatePolynomial< Field > &b, DenseUnivariatePolynomial< Field > &q, DenseUnivariatePolynomial< Field > &r, int l) |
Fast Division (based on Modern Computer Algebra , Newton Iteration Chapter 9) More... | |
Public Attributes | |
mpz_class | characteristic |
Static Public Attributes | |
static mpz_class | p1 |
static mpz_class | p2 |
static mpz_class | p3 |
static mpz_class | p4 |
static mpz_class | p5 |
static mpz_class | p6 |
static mpz_class | p7 |
Friends | |
DenseUnivariatePolynomial< Field > | operator+ (Field c, DenseUnivariatePolynomial< Field > p) |
DenseUnivariatePolynomial< Field > | operator- (const Field &c, const DenseUnivariatePolynomial< Field > &p) |
DenseUnivariatePolynomial< Field > | operator* (const Field &c, const DenseUnivariatePolynomial< Field > &p) |
DenseUnivariatePolynomial< Field > | operator/ (const Field &c, const DenseUnivariatePolynomial< Field > &p) |
A univariate polynomial with arbitrary BPASField coefficients represented densely.
This class is templated by a Field which should be a BPASField.
|
inline |
Construct a polynomial.
d |
|
inline |
Construct a polynomial with degree.
d | Size of the polynomial |
|
inline |
Copy constructor.
b | A dense univariate rational polynomial |
|
inline |
Destroy the polynomial.
|
inline |
Add another polynomial to itself.
b | A univariate rational polynomial |
|
inlinevirtual |
Get a coefficient of the polynomial.
k | Offset |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inline |
Get coefficients of the polynomial, given start offset.
k | Offset |
|
inline |
Content of the polynomial.
|
inlinevirtual |
Convert this to an expression tree.
returns an expression tree describing *this.
Implements ExpressionTreeConvert.
|
inline |
Get degree of the polynomial.
|
inlinevirtual |
Obtain the kth derivative of this polynomial.
k | the number of times to differentiate. |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Obtain the derivative of this polynomial.
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Compute k-th differentiate.
k | k-th differentiate, k > 0 |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inline |
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 |
|
inline |
Divide by variable if it is zero.
|
inlinevirtual |
Perform the eucldiean division of *this and b.
Returns the remainder. If q is not NULL, then returns the quotient in q.
b | the divisor. | |
[out] | q | a pointer to store the quotient in. |
Implements BPASEuclideanDomain< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Evaluate f(x)
x | Evaluation point |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Perform the extended euclidean division on *this and b.
Returns the GCD. If s and t are not NULL, returns the bezout coefficients in them.
b | the divisor. | |
[out] | s | the bezout coefficient of this. |
[out] | t | the bezout coefficient of b. |
Implements BPASEuclideanDomain< DenseUnivariatePolynomial< Field > >.
|
inline |
GCD(p, q)
q | The other polynomial |
|
inlinevirtual |
Get GCD of *this and other.
other | the other element to get a gcd with. |
Implements BPASGCDDomain< DenseUnivariatePolynomial< Field > >.
|
inline |
s * a g (mod b), where g = gcd(a, b)
b | A univariate polynomial |
g | The GCD of a and b |
|
inline |
Homothetic operation.
k | > 0: 2^(k*d) * f(2^(-k)*x); |
|
inline |
Compute the integral with constant of integration 0.
|
inline |
Is a constant.
|
inline |
Is the least signficant coefficient zero.
|
inline |
Is polynomial a constatn -1.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
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< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
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< Field, DenseUnivariatePolynomial< Field > >.
|
inline |
Get the leading coefficient.
|
inlinevirtual |
Monic division Return quotient and itself become the remainder.
b | The dividend polynomial |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Monic division Return quotient.
b | The dividend polynomial |
rem | The remainder polynomial |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inline |
Compute -f(x)
|
inline |
Set polynomial to -1.
|
inline |
Compute f(-x)
|
inline |
Fast Division (based on Modern Computer Algebra , Newton Iteration Chapter 9)
b | divisor |
q | (out) qoutient |
r | (out) remainder |
fieldVal | prime field |
l | number of newton iteration |
|
inline |
Does Newton Iteration to compute the Reverse Inverse of a polynomial (based on Modern Computer Algebra , Newton Iteration Chapter 9)
l | number of newton iteration (n - m + 1) |
|
inlinevirtual |
|
inlinevirtual |
Overload operator !=.
b | A univariate rational polynoial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Get the remainder of *this and b;.
b | the divisor |
Implements BPASEuclideanDomain< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Assign *this to be the remainder of *this and b.
b | the divisor |
Implements BPASEuclideanDomain< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Multiply to another polynomial.
b | A univariate rational polynomial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inline |
Overload operator *.
e | A rational number |
|
inlinevirtual |
Overload operator *=.
b | A univariate rational polynomial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inline |
Overload operator *=.
e | A rational number |
|
inlinevirtual |
Overload operator +.
b | A univariate rational polynomial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inline |
Overload Operator +.
c | A rational number |
|
inlinevirtual |
Overload Operator +=.
b | A univariate rational polynomial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inline |
Overload Operator +=.
c | A rational number |
|
inlinevirtual |
Subtract another polynomial.
b | A univariate rational polynomial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
|
inline |
Overload operator -.
c | A rational number |
|
inlinevirtual |
Overload operator -=.
b | A univariate rational polynomial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inline |
Overload operator -=.
c | A rational number |
|
inlinevirtual |
Overload operator / ExactDivision.
b | A univariate rational polynomial |
Implements BPASIntegralDomain< DenseUnivariatePolynomial< Field > >.
|
inline |
Overload operator /.
e | A rational number |
|
inlinevirtual |
Overload operator /= ExactDivision.
b | A univariate rational polynomial |
Implements BPASIntegralDomain< DenseUnivariatePolynomial< Field > >.
|
inline |
Overload operator /=.
e | A rational number |
|
inlinevirtual |
Overload operator << replace by muplitying x^k.
k | The exponent of variable, k > 0 |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Overload operator <<= replace by muplitying x^k.
k | The exponent of variable, k > 0 |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Overload operator =.
b | A univariate rational polynoial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Overload operator ==.
b | A univariate rational polynoial |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Overload operator >> replace by dividing x^k, and return the quotient.
k | The exponent of variable, k > 0 |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Overload operator >>= replace by dividing x^k, and return the quotient.
k | The exponent of variable, k > 0 |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Overload operator ^ replace xor operation by exponentiation.
e | The exponentiation, e > 0 |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Overload operator ^= replace xor operation by exponentiation.
e | The exponentiation, e > 0 |
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Overload stream operator <<.
out | Stream object |
b | A univariate rational polynoial |
Reimplemented from BPASRing< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
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< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
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< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Get the quotient of *this and b.
b | the divisor |
Implements BPASEuclideanDomain< DenseUnivariatePolynomial< Field > >.
|
inline |
Number of coefficient sign variation.
Revert | coefficients |
|
inlinevirtual |
Get the remainder of *this and b.
b | the divisor |
Implements BPASEuclideanDomain< DenseUnivariatePolynomial< Field > >.
|
inline |
Reverse a polynomial (based on Modern Computer Algebra , Newton Iteration Chapter 9)
|
inline |
Scale transform operation.
k | > 0: f(2^k*x) |
|
inlinevirtual |
Set a coefficient of the polynomial.
k | Offset |
val | Coefficient |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Set variable's name.
x | Varable's name |
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
|
inline |
Helper function to compare a given prime number with manually computed Generalized Fermat Numbers.
p | prime number |
|
inline |
Subtract another polynomial from itself.
b | A univariate rational polynomial |
|
inlinevirtual |
Obtain the unit normal (a.k.a canonical associate) of an element.
If either parameters u, v, are non-NULL then the units are returned such that b = ua, v = u^-1. Where b is the unit normal of a, and is the returned value.
Implements BPASRing< DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |
Get variable's name.
Implements BPASUnivariatePolynomial< Field, DenseUnivariatePolynomial< Field > >.
|
inlinevirtual |