Basic Polynomial Algebra Subprograms (BPAS)
v. 1.791
|
A multivariate polynomial with RationalNumber coefficients represented sparely. More...
#include <mrpolynomial.h>
Public Member Functions | |
SparseMultivariateRationalPolynomial | subresultantGCD (const SparseMultivariateRationalPolynomial &q) const |
SparseMultivariateRationalPolynomial () | |
Construct a multivariate polynomial. More... | |
SparseMultivariateRationalPolynomial (int v) | |
Construct a multivariate polynomial with specific number of variables. More... | |
SparseMultivariateRationalPolynomial (const Symbol &x) | |
Construct with a variable name such that f(x) = x;. More... | |
SparseMultivariateRationalPolynomial (const std::string &str) | |
Construct a polynomial by parsing the string str. | |
SparseMultivariateRationalPolynomial (AltArr_t *aa, int vars, Symbol *varNames) | |
Construct an SMQP given the head Node*. More... | |
SparseMultivariateRationalPolynomial (const SparseMultivariateRationalPolynomial &b) | |
Copy Constructor. More... | |
SparseMultivariateRationalPolynomial (SparseMultivariateRationalPolynomial &&b) | |
Move Constructor. More... | |
SparseMultivariateRationalPolynomial (const SparseMultivariateIntegerPolynomial &b) | |
Create a SMZP from an SMQP. | |
SparseMultivariateRationalPolynomial (const Integer &r, int nvar=0) | |
Create a SMQP from an Integer. | |
SparseMultivariateRationalPolynomial (const RationalNumber &r, int nvar=0) | |
Create a SMQP from a RationalNumber. | |
SparseMultivariateRationalPolynomial (const DenseUnivariateRationalPolynomial &p) | |
Create a SMQP from a univariate rational polynomial. More... | |
SparseMultivariateRationalPolynomial (const SparseUnivariatePolynomial< SparseMultivariateRationalPolynomial > &s) | |
Construct from a SUP<SMQP> polynomial such that the resulting SMQP has main variable equal to the variable of s. More... | |
~SparseMultivariateRationalPolynomial () | |
Destroy the polynomial and underlying node memory. | |
bool | isZero () const |
Is this polynomial zero. More... | |
void | zero () |
Set this polynomial to zero. More... | |
bool | isOne () const |
Is this polynomial one. More... | |
void | one () |
Sets this polynomial to one. More... | |
bool | isNegativeOne () const |
Is this polynomial negative one. More... | |
void | negativeOne () |
Sets this polynomial to -1. More... | |
int | isConstant () const |
Determine if this polynomial encodes a constant. More... | |
SparseMultivariateRationalPolynomial | unitCanonical (SparseMultivariateRationalPolynomial *u, SparseMultivariateRationalPolynomial *v) const |
Obtain the unit normal (a.k.a canonical associate) of an element. More... | |
SparseMultivariateRationalPolynomial & | operator= (const SparseMultivariateRationalPolynomial &b) |
Assign this polynomail to equal the specified. | |
SparseMultivariateRationalPolynomial & | operator= (SparseMultivariateRationalPolynomial &&b) |
Movement assignment: move b to be this polynomail. | |
SparseMultivariateRationalPolynomial & | operator= (const RationalNumber &r) |
Assign this polynomial to be equal to the constant ring element. | |
SparseMultivariateRationalPolynomial | operator+ (const SparseMultivariateRationalPolynomial &b) const |
Add two SMQP polynomials together, *this and the specified. | |
SparseMultivariateRationalPolynomial | operator+ (SparseMultivariateRationalPolynomial &&b) const |
SparseMultivariateRationalPolynomial & | operator+= (const SparseMultivariateRationalPolynomial &b) |
Add the polynomails a and b and return the sum. More... | |
SparseMultivariateRationalPolynomial | operator- (const SparseMultivariateRationalPolynomial &b) const |
Subtract the specified polynomail from *this. | |
SparseMultivariateRationalPolynomial | operator- (SparseMultivariateRationalPolynomial &&b) const |
SparseMultivariateRationalPolynomial | operator- () const |
Subtract the polynomial b from a and return the difference. More... | |
SparseMultivariateRationalPolynomial & | operator-= (const SparseMultivariateRationalPolynomial &b) |
Update *this by subtracting the specified polynomial from it. | |
SparseMultivariateRationalPolynomial | operator* (const SparseMultivariateRationalPolynomial &b) const |
Multiply *this by the specified polynomail. | |
SparseMultivariateRationalPolynomial | operator* (SparseMultivariateRationalPolynomial &&b) const |
SparseMultivariateRationalPolynomial & | operator*= (const SparseMultivariateRationalPolynomial &b) |
Multiply the polynomials a and b, returning their product. More... | |
SparseMultivariateRationalPolynomial | operator/ (const SparseMultivariateRationalPolynomial &b) const |
Divide *this by the specified polynomial. | |
SparseMultivariateRationalPolynomial | operator/ (SparseMultivariateRationalPolynomial &&b) const |
SparseMultivariateRationalPolynomial & | operator/= (const SparseMultivariateRationalPolynomial &b) |
Update *this by dividing by the specified polynomial. | |
SparseMultivariateRationalPolynomial | operator^ (long long int e) const |
Exponentiate *this by the input exponent integer. More... | |
SparseMultivariateRationalPolynomial & | operator^= (long long int e) |
Update *this by exponentiating this to the input integer. More... | |
bool | operator== (const SparseMultivariateRationalPolynomial &b) const |
Determine if *this is equal to the specified polynomial. More... | |
bool | operator!= (const SparseMultivariateRationalPolynomial &b) const |
Determine if *this is not equal to the specified polynomial. More... | |
void | print (std::ostream &os) const |
Output the string representation of *this to the input ostream. | |
void | fromString (const std::string &str) |
Parse a polynomial from string str and place in *this. | |
std::vector< SparseMultivariateRationalPolynomial > | subresultantChain (const SparseMultivariateRationalPolynomial &q, const Symbol &v, bool filled=1) const |
Given a polynomial q, compute the subresultant chain between this and q, viewing both polynomial recursively with main variable v. More... | |
std::vector< SparseMultivariateRationalPolynomial > | subresultantChain (const SparseMultivariateRationalPolynomial &q, int filled=1) const |
Subresultant Chain with respect to the leaving variable of this. More... | |
std::vector< SparseMultivariateRationalPolynomial > | subresultantAtIdx (const SparseMultivariateRationalPolynomial &q, const Symbol &v, int idx=0, specSRC_AAZ **lazyInfo=NULL) const |
Given a polynomial q, compute the subresultant of index idx between this and q, viewing both polynomial recursively with main variable v. More... | |
std::vector< SparseMultivariateRationalPolynomial > | subresultantInitialAtIdx (const SparseMultivariateRationalPolynomial &q, const Symbol &v, int idx, Integer &mdegIdx, Integer &mdegIdx1, specSRC_AAZ **lazyInfo=NULL) const |
Compute the initials of two successive subresultants: S_{i}, S_{i+1} s.t. More... | |
std::vector< SparseMultivariateRationalPolynomial > | subresultantInitialAtIdx (const SparseMultivariateRationalPolynomial &q, const Symbol &v, int idx=0, specSRC_AAZ **lazyInfo=NULL) const |
Compute the initials of two successive subresultants: S_{i}, S_{i+1} s.t. More... | |
std::vector< std::vector< SparseMultivariateRationalPolynomial > > | exSubresultantChain (const SparseMultivariateRationalPolynomial &q, const Symbol &v) const |
Extended Subresultant Chain Return the list of subresultants with Besout Coefficients. | |
SparseMultivariateRationalPolynomial | resultant (const SparseMultivariateRationalPolynomial &q, const Symbol &v) const |
SparseMultivariateRationalPolynomial | gcd (const SparseMultivariateRationalPolynomial &b) const |
Get GCD between *this and b. | |
SparseMultivariateRationalPolynomial | primitiveGCD (const SparseMultivariateRationalPolynomial &b) const |
Get the GCD between *this and b as a primitive polynomial. | |
Factors< SparseMultivariateRationalPolynomial > | squareFree () const |
Compute squarefree factorization of *this with respect to all of its variables. | |
Factors< SparseMultivariateRationalPolynomial > | squareFree (const std::vector< Symbol > &vars) const |
Compute squarefree factorization of *this with respect to the list of variables, vars. | |
SparseMultivariateRationalPolynomial | squareFreePart () const |
Computes the square free part of this polynomail. More... | |
SparseMultivariateRationalPolynomial | squareFreePart (std::vector< Symbol > &vars) const |
Computes the square free part of this polynomail. More... | |
RationalNumber | content () const |
Get the content with respect to all variables. More... | |
SparseMultivariateRationalPolynomial | content (const std::vector< Symbol > &v) const |
Get the content of this polynomial with respect to the variables in the input vector v. More... | |
SparseMultivariateIntegerPolynomial | primitivePartSMZP () const |
Get the primitive part with respect to all variables, returned as an SMZP. More... | |
SparseMultivariateIntegerPolynomial | primitivePartSMZP (RationalNumber &content) const |
Get the primitive part with respect to all variables, returned as an SMZP. More... | |
SparseMultivariateRationalPolynomial | primitivePart () const |
Get the primitive part with respect to all variables. More... | |
SparseMultivariateRationalPolynomial | primitivePart (const Symbol &s) const |
Get the primitive part with respect to the variable s. More... | |
SparseMultivariateRationalPolynomial | primitivePart (RationalNumber &content) const |
Get the primitive part with respect to all variables. More... | |
SparseMultivariateRationalPolynomial | primitivePart (const std::vector< Symbol > &v) const |
Get the primitive part with respect to the variables in the vector v. More... | |
SparseMultivariateRationalPolynomial | primitivePart (const std::vector< Symbol > &v, SparseMultivariateRationalPolynomial &content) const |
Get the primitive part with respect to the variables in the vector v. More... | |
SparseMultivariateRationalPolynomial | mainPrimitivePart () const |
SparseMultivariateRationalPolynomial | mainPrimitivePart (SparseMultivariateRationalPolynomial &content) const |
SparseMultivariateRationalPolynomial | initial () const |
Get the leading coefficient of *this with respect to the main variable. More... | |
Symbol | mainVariable () const |
Get the main variable. More... | |
int | mainDegree () const |
Get the degree of the main variable. More... | |
SparseMultivariateRationalPolynomial | rank () const |
Get the rank of this polynomial. More... | |
SparseMultivariateRationalPolynomial | head () const |
Get the head of this polynomial. More... | |
SparseMultivariateRationalPolynomial | tail () const |
Get the tail of this polynomial. More... | |
SparseMultivariateRationalPolynomial | separant () const |
Get the separant of this polynomial, that is, its derivative with respect to the main variable. More... | |
int | numberOfVariables () const |
Get the number of variables in this polynomial. | |
int | numberOfRingVariables () const |
Get the number of variables in this polynomial ring. | |
Integer | numberOfTerms () const |
Get the number of non-zero terms. | |
Integer | degree () const |
Total degree. | |
Integer | degree (const Symbol &) const |
Get the degree of a variable. | |
RationalNumber | leadingCoefficient () const |
Get the leading coefficient. | |
RationalNumber | trailingCoefficient () const |
Get the trailing coefficient. | |
RationalNumber | coefficient (int, const int *) const |
Get a coefficient, given the exponent of each variable. | |
RationalNumber | coefficient (const std::vector< int > &v) const |
Get the coefficient of this polynomial with respect to the monomial defined by exponent vector exps. More... | |
void | setCoefficient (int, const int *, const RationalNumber &) |
Set a coefficient, given the exponent of each variable. | |
void | setCoefficient (const std::vector< int > &v, const RationalNumber &r) |
Set the coefficient of this polynomial for the monomial defined by exponent vector exps to r. More... | |
void | setRingVariables (const std::vector< Symbol > &) |
Set variables' names. More... | |
std::vector< Symbol > | ringVariables () const |
Get variable names of all variables available to this polynomial, even those that have zero degree. | |
std::vector< Symbol > | variables () const |
Get variable names of variables with non-zero degree;. | |
bool | isEqual (const SparseMultivariateRationalPolynomial &b) const |
Determine if *this is equal to b. More... | |
void | differentiate (const Symbol &s, int k) |
Convert current object to its k-th derivative. More... | |
void | differentiate (const Symbol &s) |
Convert current object to its derivative. More... | |
SparseMultivariateRationalPolynomial | derivative (const Symbol &s, int k) const |
Return k-th derivative. More... | |
SparseMultivariateRationalPolynomial | derivative (const Symbol &s) const |
Compute derivative. More... | |
void | integrate (const Symbol &s, int k) |
Convert current object to its k-th integral. More... | |
void | integrate (const Symbol &s) |
Convert current object to its derivative. More... | |
SparseMultivariateRationalPolynomial | integral (const Symbol &s, int k) const |
Return k-th integral. More... | |
SparseMultivariateRationalPolynomial | integral (const Symbol &s) const |
Compute integral. More... | |
SparseMultivariateRationalPolynomial | evaluate (int n, const Symbol *syms, const RationalNumber *xs) const |
Evaluate f(x) More... | |
SparseMultivariateRationalPolynomial | evaluate (const std::vector< Symbol > &vars, const std::vector< RationalNumber > &values) const |
Evaluate *this polynomial given the variables and their values in vars, and values. More... | |
bool | divide (const SparseMultivariateRationalPolynomial &b, SparseMultivariateRationalPolynomial &q, SparseMultivariateRationalPolynomial &r) const |
Divide this by polynomial b, returning the quotient and remainder in q and r, respectively. More... | |
SparseMultivariateRationalPolynomial | operator% (const SparseMultivariateRationalPolynomial &b) const |
Get the remainder of *this divided by b. | |
SparseMultivariateRationalPolynomial & | operator%= (const SparseMultivariateRationalPolynomial &b) |
Update *this by setting it to the remainder of *this divided by b. | |
SparseMultivariateRationalPolynomial | operator% (const Integer &i) const |
SparseMultivariateRationalPolynomial & | operator%= (const Integer &i) |
SparseMultivariateRationalPolynomial | pseudoDivide (const SparseMultivariateRationalPolynomial &b, SparseMultivariateRationalPolynomial *quo=NULL, SparseMultivariateRationalPolynomial *mult=NULL, bool lazy=0) const |
Pseudo divide this by b. More... | |
SparseMultivariateRationalPolynomial | pseudoDivideBySMZP (const SparseMultivariateRationalPolynomial &b, SparseMultivariateRationalPolynomial *quo=NULL, SparseMultivariateRationalPolynomial *mult=NULL, bool lazy=0) const |
Pseudo divide this by b. More... | |
SparseMultivariateRationalPolynomial | operator+ (const ratNum_t &r) const |
Add *this and a ratNum_t. | |
SparseMultivariateRationalPolynomial | operator+ (const RationalNumber &r) const |
Add *this and the RationalNumber r. | |
SparseMultivariateRationalPolynomial & | operator+= (const ratNum_t &r) |
Update *this by adding r. | |
SparseMultivariateRationalPolynomial & | operator+= (const RationalNumber &r) |
Update *this by adding the RationalNumber r to it. | |
SparseMultivariateRationalPolynomial | operator- (const ratNum_t &r) const |
Subtract the ratNum_t r from *this. | |
SparseMultivariateRationalPolynomial | operator- (const RationalNumber &r) const |
Subtract the RationalNumber r from *this. | |
SparseMultivariateRationalPolynomial & | operator-= (const ratNum_t &r) |
Update *this by subtracting ratNum_t r. | |
SparseMultivariateRationalPolynomial & | operator-= (const RationalNumber &r) |
Update *this by subtracting RationalNumber r. | |
SparseMultivariateRationalPolynomial | operator* (const ratNum_t &r) const |
Multiply *this by ratNum_t r. | |
SparseMultivariateRationalPolynomial | operator* (const RationalNumber &r) const |
Multiply *this by RationalNumber r. | |
SparseMultivariateRationalPolynomial & | operator*= (const ratNum_t &r) |
Update *this by multiplying by ratNum_t r. | |
SparseMultivariateRationalPolynomial & | operator*= (const RationalNumber &r) |
Update *this by multiplying by RationalNumber r. | |
SparseMultivariateRationalPolynomial | operator/ (const ratNum_t &r) const |
Divide *this by ratNum_t r. | |
SparseMultivariateRationalPolynomial | operator/ (const RationalNumber &r) const |
Divide *this by RationalNumber r. | |
SparseMultivariateRationalPolynomial & | operator/= (const ratNum_t &r) |
Update *this by dividing by ratNum_t r. | |
SparseMultivariateRationalPolynomial & | operator/= (const RationalNumber &r) |
Update *this by dividing by RationalNumber r. | |
SparseMultivariateRationalPolynomial | operator[] (int index) const |
Get the polynomial term at index. More... | |
Symbol | leadingVariable () const |
Get the leading variable, that is, the highest-order variable with positive degree of this polynomial. More... | |
Integer | leadingVariableDegree () const |
Get the degree of this polynomial w.r.t the leading variable. | |
bool | isConstantTermZero () const |
Is the contant term zero. | |
SparseMultivariateRationalPolynomial | leadingCoefficientInVariable (const Symbol &x, int *e=NULL) const |
Get the leading coefficient w.r.t the input variable 'x'. More... | |
SparseUnivariatePolynomial< SparseMultivariateRationalPolynomial > | convertToSUP (const Symbol &x) const |
Convert to a SUP<SMQP> given the variable 'x'. More... | |
void | negate () |
Negate all the coefficients of *this. More... | |
SparseMultivariateRationalPolynomial | deepCopy () const |
Get a copy of this such that all underlying memory is NOT shared. More... | |
Factors< SparseMultivariateRationalPolynomial > | factor () const |
Factors this polynomial into irreducible factors. More... | |
void | straightLineProgram () |
SLP representation of the polynomial. | |
void | printSLP (std::ostream &out=std::cout) const |
Print SLP representation. | |
int | positiveRealRootIsolation (Intervals *pIs, Intervals &apIs, mpq_class width, int ts=-1, bool s=0, bool check=1) |
Given one real root for x_1, .., x_{n-1}, isolate positive roots for x_n. More... | |
void | randomPolynomial (int numvar, int nterms, unsigned long int coefBound, degree_t sparsity, bool includeNeg) |
Change *this to be a random non-zero polynomial. More... | |
void | randomPolynomial (std::vector< int > maxDegs, unsigned long int coefBound, float sparsity, bool includeNeg) |
Change *this to be a random non-zero polynomial. More... | |
ExpressionTree | convertToExpressionTree () const |
Convert *this to an ExpressionTree. More... | |
SparseMultivariateRationalPolynomial | lexNormalForm (const std::vector< Symbol > &superNames, const std::vector< SparseMultivariateRationalPolynomial > &ts, std::vector< SparseMultivariateRationalPolynomial > *quoSet=NULL) const |
Normal Form (or Multi-Divisor Division (MDD)) Given the dividend, f, and a divisor-set of polynomials of size s, G[s] = {g_0, ..., g_{s-1}} to compute the reduce polynomial (remainder) r with respect to the G[s], Return (by reference) the remainder and the quotient set Q[s] = {q_0, ..., q_{s-1}}, such that f = q_0*g_0 + ... More... | |
SparseMultivariateRationalPolynomial | lexNormalizeDim0 (const std::vector< Symbol > &superNames, const std::vector< SparseMultivariateRationalPolynomial > &ts, SparseMultivariateRationalPolynomial *A) const |
SparseMultivariateRationalPolynomial | triangularSetNormalForm (const TriangularSet< RationalNumber, SparseMultivariateRationalPolynomial > &ts, std::vector< SparseMultivariateRationalPolynomial > *quoSet) const |
Multi-Divisor Division (MDD) where the divisor-set is a Triangular Set Given the dividend, f, and a divisor-set of polynomials of size s, G[s] = {g_0, ..., g_{s-1}} to compute the reduce polynomial (remainder) r with respect to the G[s], Return (by reference) the remainder and the quotient set Q[s] = {q_0, ..., q_{s-1}}. | |
SparseMultivariateRationalPolynomial | triangularSetPseudoDivide (const TriangularSet< RationalNumber, SparseMultivariateRationalPolynomial > &ts, std::vector< SparseMultivariateRationalPolynomial > *quoSet, SparseMultivariateRationalPolynomial *h) const |
Do the pseudo division of c by the triangular-set (divisor set) of B in the naive principle such that hPow*f = quoSet_0 * B_0 + ... More... | |
SparseMultivariateRationalPolynomial | triangularSetOnlyNormalForm (const TriangularSet< RationalNumber, SparseMultivariateRationalPolynomial > &ts) const |
Specialized Normal Form where the divisor-set is a Triangular Set Given the dividend, f, and a divisor-set of polynomials of size s, G[s] = {g_0, ..., g_{s-1}} to compute the reduce polynomial (remainder) r with respect to the G[s]. | |
Factors< SparseMultivariateRationalPolynomial > | Factoring (SparseMultivariateRationalPolynomial &a) |
Factors< SparseMultivariateRationalPolynomial > | AlgebricFactorization (SparseMultivariateRationalPolynomial &minimal, SparseMultivariateRationalPolynomial *polyTotalcontent) |
Static Public Member Functions | |
static SparseMultivariateRationalPolynomial | interpolate (const std::vector< std::vector< RationalNumber >> &points, const std::vector< RationalNumber > &vals) |
Find the interpolating polynomial for the points and values specified by each vector, respectively. More... | |
Public Attributes | |
std::vector< SLPRepresentation > | slp |
A multivariate polynomial with RationalNumber coefficients represented sparely.
Only non-zero coefficients are encoded.
SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial | ( | ) |
Construct a multivariate polynomial.
SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial | ( | int | v | ) |
Construct a multivariate polynomial with specific number of variables.
v | Number of variables |
SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial | ( | const Symbol & | x | ) |
Construct with a variable name such that f(x) = x;.
x | The variable name |
SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial | ( | AltArr_t * | aa, |
int | vars, | ||
Symbol * | varNames | ||
) |
Construct an SMQP given the head Node*.
The SMQP takes ownership of the Node list.
SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial | ( | const SparseMultivariateRationalPolynomial & | b | ) |
Copy Constructor.
Does not reuse underlying memory allocated by b.
b | A sparse multivariate polynomial |
SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial | ( | SparseMultivariateRationalPolynomial && | b | ) |
Move Constructor.
b: The r-value reference polynomial.
SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial | ( | const DenseUnivariateRationalPolynomial & | p | ) |
Create a SMQP from a univariate rational polynomial.
p | A SUQP polynomial. |
SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial | ( | const SparseUnivariatePolynomial< SparseMultivariateRationalPolynomial > & | s | ) |
Construct from a SUP<SMQP> polynomial such that the resulting SMQP has main variable equal to the variable of s.
s | The SUP<SMQP> polynomial |
|
inlinevirtual |
Get the coefficient of this polynomial with respect to the monomial defined by exponent vector exps.
The exponent vector should be defined over all variables in the polynomial ring.
exps | the exponent vector |
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
RationalNumber SparseMultivariateRationalPolynomial::content | ( | ) | const |
Get the content with respect to all variables.
That is, a single rational number. The content here is one such that this/content is an integer polynomial with content of 1.
Moreover, the content is one such that the leading coefficient of the corresponding primitive part is positive.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::content | ( | const std::vector< Symbol > & | v | ) | const |
Get the content of this polynomial with respect to the variables in the input vector v.
Moreover, the content is one such that the leading coefficient of the corresponding primitive part is positive.
ExpressionTree SparseMultivariateRationalPolynomial::convertToExpressionTree | ( | ) | const |
Convert *this to an ExpressionTree.
returns the new ExpressionTree.
SparseUnivariatePolynomial<SparseMultivariateRationalPolynomial> SparseMultivariateRationalPolynomial::convertToSUP | ( | const Symbol & | x | ) | const |
Convert to a SUP<SMQP> given the variable 'x'.
returns the SUP<SMQP>.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::deepCopy | ( | ) | const |
Get a copy of this such that all underlying memory is NOT shared.
Note, any following arithmetic operations on the returned result will result in possibly making the underlying memory shared again.
|
virtual |
Return k-th derivative.
s | Symbol to differentiate with respect to |
k | Order of the k-th derivative, k > 0 |
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
inlinevirtual |
Compute derivative.
s | Symbol to differentiate with respect to |
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
inlinevirtual |
Convert current object to its k-th derivative.
s | Symbol to differentiate with respect to |
k | Order of the derivative, k > 0 |
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
inlinevirtual |
Convert current object to its derivative.
s | Symbol to differentiate with respect to |
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
bool SparseMultivariateRationalPolynomial::divide | ( | const SparseMultivariateRationalPolynomial & | b, |
SparseMultivariateRationalPolynomial & | q, | ||
SparseMultivariateRationalPolynomial & | r | ||
) | const |
Divide this by polynomial b, returning the quotient and remainder in q and r, respectively.
returns a boolean indicating if the division was exact.
|
inlinevirtual |
Evaluate f(x)
syms | Array of Symbols to evaluate at corresponding xs |
xs | Evaluation points |
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
virtual |
Evaluate *this polynomial given the variables and their values in vars, and values.
vars must be a list of variables which are a (not necessarily proper) subset. vars and values should have matching indices. i.e. the values of vars[i] is values[i].
returns a new SMQP where all variables in vars have been evaluated using the values given.
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
Factors<SparseMultivariateRationalPolynomial> SparseMultivariateRationalPolynomial::factor | ( | ) | const |
|
virtual |
Get the head of this polynomial.
That is, the initial multiplied by the rank.
returns the head.
Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
virtual |
Get the leading coefficient of *this with respect to the main variable.
returns the initial.
Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::integral | ( | const Symbol & | s, |
int | k | ||
) | const |
|
inline |
Compute integral.
s | Symbol to differentiate with respect to |
|
inline |
Convert current object to its k-th integral.
s | Symbol to differentiate with respect to |
k | Order of the derivative, k > 0 |
|
inline |
Convert current object to its derivative.
s | Symbol to differentiate with respect to |
|
static |
Find the interpolating polynomial for the points and values specified by each vector, respectively.
The points vector is a vector of vectors, where each element of the outer vector represents a multi-dimensional point. Each multi-dimensional point should have the same number of dimensions and in the same order.
returns the interpolating polynomial.
int SparseMultivariateRationalPolynomial::isConstant | ( | ) | const |
Determine if this polynomial encodes a constant.
returns 0 if not a constant, 1 if a constant >= 0, -1 if a negative contstant.
bool SparseMultivariateRationalPolynomial::isEqual | ( | const SparseMultivariateRationalPolynomial & | b | ) | const |
Determine if *this is equal to b.
This takes into account the variable ordering on both poylnomials in such a way that the same polynomial under different variable orderings are NOT equal.
bool SparseMultivariateRationalPolynomial::isNegativeOne | ( | ) | const |
Is this polynomial negative one.
returns true iff this polynomial encodes -1.
bool SparseMultivariateRationalPolynomial::isOne | ( | ) | const |
Is this polynomial one.
return true iff this polynomial encodes 1.
bool SparseMultivariateRationalPolynomial::isZero | ( | ) | const |
Is this polynomial zero.
returns true iff this polynomial encodes 0.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::leadingCoefficientInVariable | ( | const Symbol & | x, |
int * | e = NULL |
||
) | const |
Get the leading coefficient w.r.t the input variable 'x'.
Returns the leading exponent as e.
returns the coefficient as a new SMQP.
Symbol SparseMultivariateRationalPolynomial::leadingVariable | ( | ) | const |
Get the leading variable, that is, the highest-order variable with positive degree of this polynomial.
returns the leading variable or the empty string if this polynomial has zero variables.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::lexNormalForm | ( | const std::vector< Symbol > & | superNames, |
const std::vector< SparseMultivariateRationalPolynomial > & | ts, | ||
std::vector< SparseMultivariateRationalPolynomial > * | quoSet = NULL |
||
) | const |
Normal Form (or Multi-Divisor Division (MDD)) Given the dividend, f, and a divisor-set of polynomials of size s, G[s] = {g_0, ..., g_{s-1}} to compute the reduce polynomial (remainder) r with respect to the G[s], Return (by reference) the remainder and the quotient set Q[s] = {q_0, ..., q_{s-1}}, such that f = q_0*g_0 + ...
|
virtual |
Get the degree of the main variable.
returns the degree.
Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
inlinevirtual |
Get the main variable.
That is, the highest-ordered variable with positive degree.
returns the main variable.
Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
void SparseMultivariateRationalPolynomial::negate | ( | ) |
Negate all the coefficients of *this.
Note, that due to the sharing nature of underling nodes, this may alter the Nodes of other SMQP.
void SparseMultivariateRationalPolynomial::negativeOne | ( | ) |
Sets this polynomial to -1.
Maintains existing variable ordering.
void SparseMultivariateRationalPolynomial::one | ( | ) |
Sets this polynomial to one.
Maintains existing variable ordering.
bool SparseMultivariateRationalPolynomial::operator!= | ( | const SparseMultivariateRationalPolynomial & | b | ) | const |
Determine if *this is not equal to the specified polynomial.
This takes into account the variable ordering on both poylnomials in such a way that the same polynomial under different variable orderings are NOT equal.
SparseMultivariateRationalPolynomial& SparseMultivariateRationalPolynomial::operator*= | ( | const SparseMultivariateRationalPolynomial & | b | ) |
Multiply the polynomials a and b, returning their product.
Update this by multiplying by the specified polynomail.
SparseMultivariateRationalPolynomial& SparseMultivariateRationalPolynomial::operator+= | ( | const SparseMultivariateRationalPolynomial & | b | ) |
Add the polynomails a and b and return the sum.
Update *this by adding the specified polynomail to it.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::operator- | ( | ) | const |
Subtract the polynomial b from a and return the difference.
Unary operation, return *this * -1.
bool SparseMultivariateRationalPolynomial::operator== | ( | const SparseMultivariateRationalPolynomial & | b | ) | const |
Determine if *this is equal to the specified polynomial.
This takes into account the variable ordering on both poylnomials in such a way that the same polynomial under different variable orderings are NOT equal.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::operator[] | ( | int | index | ) | const |
Get the polynomial term at index.
Returns 0 if index is beyond the number of terms in this polynomial.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::operator^ | ( | long long int | e | ) | const |
Exponentiate *this by the input exponent integer.
Treats negative exponents as positive.
SparseMultivariateRationalPolynomial& SparseMultivariateRationalPolynomial::operator^= | ( | long long int | e | ) |
Update *this by exponentiating this to the input integer.
Treats negative exponents as positive.
int SparseMultivariateRationalPolynomial::positiveRealRootIsolation | ( | Intervals * | pIs, |
Intervals & | apIs, | ||
mpq_class | width, | ||
int | ts = -1 , |
||
bool | s = 0 , |
||
bool | check = 1 |
||
) |
Given one real root for x_1, .., x_{n-1}, isolate positive roots for x_n.
mpIs | Roots of x_n (Output) |
apIs | A root of previous polynomials |
s | deal with 0: positive roots; 1: negative roots |
check | 1: check the leading or tail coefficient; 0: do not |
width | Interval's right - left < width |
ts | Taylor Shift option |
Return 1: Need to refine preious polynomials 0: Found positive real roots
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::primitivePart | ( | ) | const |
Get the primitive part with respect to all variables.
This is equivalent to this / content().
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::primitivePart | ( | const Symbol & | s | ) | const |
Get the primitive part with respect to the variable s.
This is equivalent to this / content(s).
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::primitivePart | ( | RationalNumber & | content | ) | const |
Get the primitive part with respect to all variables.
This is equivalent to this / content().
Simultaneously returns the rational number content in the parameter content.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::primitivePart | ( | const std::vector< Symbol > & | v | ) | const |
Get the primitive part with respect to the variables in the vector v.
returns the primitive part.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::primitivePart | ( | const std::vector< Symbol > & | v, |
SparseMultivariateRationalPolynomial & | content | ||
) | const |
Get the primitive part with respect to the variables in the vector v.
Returns the corresponding content in the content reference. returns the primitive part.
SparseMultivariateIntegerPolynomial SparseMultivariateRationalPolynomial::primitivePartSMZP | ( | ) | const |
Get the primitive part with respect to all variables, returned as an SMZP.
This is equivalent to this / content();
SparseMultivariateIntegerPolynomial SparseMultivariateRationalPolynomial::primitivePartSMZP | ( | RationalNumber & | content | ) | const |
Get the primitive part with respect to all variables, returned as an SMZP.
This is equivalent to this / content();
Simultaneously returns the rational number content in the parameter content.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::pseudoDivide | ( | const SparseMultivariateRationalPolynomial & | b, |
SparseMultivariateRationalPolynomial * | quo = NULL , |
||
SparseMultivariateRationalPolynomial * | mult = NULL , |
||
bool | lazy = 0 |
||
) | const |
Pseudo divide this by b.
The remainder is returned. if parameter quo is not null then the quotient is returned in quo. if parameter mult is not null then the multiplier is set to the initial of b raised to the power of degree(c, mvar(c)) - degree(b, mvar(c)) + 1.
returns the pseudo remainder.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::pseudoDivideBySMZP | ( | const SparseMultivariateRationalPolynomial & | b, |
SparseMultivariateRationalPolynomial * | quo = NULL , |
||
SparseMultivariateRationalPolynomial * | mult = NULL , |
||
bool | lazy = 0 |
||
) | const |
Pseudo divide this by b.
The remainder is returned. This function assumes that both this and b are primitive, and thus can be viewed as integer polynomials. The psuedo-division is then performed over the integers and the quotient and remainder returned also so they are primitive.
If parameter quo is not null then the quotient is returned in quo. If parameter mult is not null then the multiplier is set to the initial of b raised to the power of degree(c, mvar(c)) - degree(b, mvar(c)) + 1.
void SparseMultivariateRationalPolynomial::randomPolynomial | ( | int | numvar, |
int | nterms, | ||
unsigned long int | coefBound, | ||
degree_t | sparsity, | ||
bool | includeNeg | ||
) |
Change *this to be a random non-zero polynomial.
numvar: number of variables nterms: number of terms coefBound: limit on the number of bits encoding the coefficients. sparsity: succesive terms are at most sparsity away from each other includeNeg: a bool to say if coefs can be randomly negative or all positive
void SparseMultivariateRationalPolynomial::randomPolynomial | ( | std::vector< int > | maxDegs, |
unsigned long int | coefBound, | ||
float | sparsity, | ||
bool | includeNeg | ||
) |
Change *this to be a random non-zero polynomial.
The number of variables will be equal to the size of the maxDegs vector. The term whose monomial has exponents equal to those in maxDegs is guaranteed to exist in the resulting polynomial. A sparsity of 0 produces a dense polynomial. A sparsity of 1 produces only one term; one whose monomial has exponents equal to maxDegs.
coefBound: limit on the number of bits encoding the coefficients. sparsity: a percentage of zero-terms between term with maxDegs and the constant term. includeNeg: a bool to say if coefs can be randomly negative or all positive
|
virtual |
Get the rank of this polynomial.
That is, the main variable raised to the main degree.
returns the rank.
Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
virtual |
Get the separant of this polynomial, that is, its derivative with respect to the main variable.
Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
inlinevirtual |
Set the coefficient of this polynomial for the monomial defined by exponent vector exps to r.
The exponent vector should be defined over all variables in the polynomial ring.
exps | the exponent vector |
r | the ring element to set as coefficient. |
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
|
virtual |
Set variables' names.
This method can be used to shrink, expand, re-order, and re-name the variables of the polynomial ring in which this polynomial belongs.
Any symbol in the input vector that matches the current variables is considered a re-order. Non-matching symbols are considered a re-name and this renames is done in the order they appear by increasing index. For example: Q[x,y,z] -> Q[y,s,t] will have y reordered to be the first variable, x renamed to s, and z renamed to t.
If the size of the input vector is greater than the current number of variables then the polynomial ring is being expanded. Matching variables from this polynomial are re-ordered as they appear in the input vector. Current variables that have no match in the input vector are re-named in order of increasing index of unused variables from the input vector. For example: Q[x,y,z] -> Q[s,t,z,x] will have y named to s, t a new variable, and z and x re-ordered accordingly.
If the size of the input vector is less than the current number of variables then the polynomial ring is shrink to remove variables. Variables in the input vector that are also found to be in the current polynomial ring are matched and re-ordered as necessary.
It is invalid to remove a variable which is non-zero in this polynomial.
Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::squareFreePart | ( | ) | const |
Computes the square free part of this polynomail.
That is, the polynomial of this divided by all square factors. This is with respect to all variables.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::squareFreePart | ( | std::vector< Symbol > & | vars | ) | const |
Computes the square free part of this polynomail.
That is, the polynomial of this divided by all square factors. This is with respect to all variables.
std::vector<SparseMultivariateRationalPolynomial> SparseMultivariateRationalPolynomial::subresultantAtIdx | ( | const SparseMultivariateRationalPolynomial & | q, |
const Symbol & | v, | ||
int | idx = 0 , |
||
specSRC_AAZ ** | lazyInfo = NULL |
||
) | const |
Given a polynomial q, compute the subresultant of index idx between this and q, viewing both polynomial recursively with main variable v.
This function in fact computes the subresultant of index idx and idx+1 and so both are returned, unless idx+1 does not exist (e.g. idx = this->degree(v)).
Optionally, this function also returns the principleCoefs of the subresultants of index i to this->degree(v).
q | the other polynomial for which to compute the subresultant chain.subresultantInit |
v | the main variable to be used when computing the subresultant chain. |
std::vector<SparseMultivariateRationalPolynomial> SparseMultivariateRationalPolynomial::subresultantChain | ( | const SparseMultivariateRationalPolynomial & | q, |
const Symbol & | v, | ||
bool | filled = 1 |
||
) | const |
Given a polynomial q, compute the subresultant chain between this and q, viewing both polynomial recursively with main variable v.
q | the other polynomial for which to compute the subresultant chain. |
v | the main variable to be used when computing the subresultant chain. |
filled | if false, degenerative cases are not returned and so indices in the returned chain do not necessarily match subresultant degrees |
std::vector<SparseMultivariateRationalPolynomial> SparseMultivariateRationalPolynomial::subresultantChain | ( | const SparseMultivariateRationalPolynomial & | q, |
int | filled = 1 |
||
) | const |
Subresultant Chain with respect to the leaving variable of this.
Return the list of subresultants
std::vector<SparseMultivariateRationalPolynomial> SparseMultivariateRationalPolynomial::subresultantInitialAtIdx | ( | const SparseMultivariateRationalPolynomial & | q, |
const Symbol & | v, | ||
int | idx, | ||
Integer & | mdegIdx, | ||
Integer & | mdegIdx1, | ||
specSRC_AAZ ** | lazyInfo = NULL |
||
) | const |
Compute the initials of two successive subresultants: S_{i}, S_{i+1} s.t.
deg(S_{i}) <= idx and deg(S_{i+1} > idx. This returns init(S_{i},v) and init(S_{i+1}, v) as a vector. The degrees degree(S_{i},v) and degree(S_{i+1}, v) are returned in mdegIdx and mdegIdx1, respectively. These degrees can be used to determine if certain subresultants are defective, i.e. degree(S_{i}, v) != i.
|
inline |
Compute the initials of two successive subresultants: S_{i}, S_{i+1} s.t.
deg(S_{i}) <= idx and deg(S_{i+1} > idx. This returns init(S_{i},v) and init(S_{i+1}, v) as a vector.
|
virtual |
Get the tail of this polynomial.
That is, This - this.head().
returns the tail.
Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.
SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::triangularSetPseudoDivide | ( | const TriangularSet< RationalNumber, SparseMultivariateRationalPolynomial > & | ts, |
std::vector< SparseMultivariateRationalPolynomial > * | quoSet, | ||
SparseMultivariateRationalPolynomial * | h | ||
) | const |
Do the pseudo division of c by the triangular-set (divisor set) of B in the naive principle such that hPow*f = quoSet_0 * B_0 + ...
|
inline |
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.
void SparseMultivariateRationalPolynomial::zero | ( | ) |
Set this polynomial to zero.
Maintains existing variable ordering.
|
friend |
Parse polynomial from in stream.
Exactly one line is parsed.