Basic Polynomial Algebra Subprograms (BPAS)  v. 1.548
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
SparseMultivariateRationalPolynomial Class Reference

A multivariate polynomial with RationalNumber coefficients represented sparely. More...

#include <mrpolynomial.h>

Simplified semantic inheritance diagram for SparseMultivariateRationalPolynomial:
- Full inheritance diagram for SparseMultivariateRationalPolynomial:
[legend]

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 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...
 
SparseMultivariateRationalPolynomialoperator= (const SparseMultivariateRationalPolynomial &b)
 Assign this polynomail to equal the specified.
 
SparseMultivariateRationalPolynomialoperator= (SparseMultivariateRationalPolynomial &&b)
 Movement assignment: move b to be this polynomail.
 
SparseMultivariateRationalPolynomialoperator= (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
 
SparseMultivariateRationalPolynomialoperator+= (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...
 
SparseMultivariateRationalPolynomialoperator-= (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
 
SparseMultivariateRationalPolynomialoperator*= (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
 
SparseMultivariateRationalPolynomialoperator/= (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...
 
SparseMultivariateRationalPolynomialoperator^= (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< SparseMultivariateRationalPolynomialsubresultantChain (const SparseMultivariateRationalPolynomial &q, int filled=0) const
 
SparseMultivariateRationalPolynomial resultant (const SparseMultivariateRationalPolynomial &q) 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< SparseMultivariateRationalPolynomialsquareFree () const
 Compute squarefree factorization of *this with respect to all of its variables.
 
Factors< SparseMultivariateRationalPolynomialsquareFree (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...
 
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
 
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
 
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)
 
void setRingVariables (const std::vector< Symbol > &)
 Set variables' names. More...
 
std::vector< SymbolringVariables () const
 Get variable names of all variables available to this polynomial, even those that have zero degree.
 
std::vector< Symbolvariables () 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.
 
SparseMultivariateRationalPolynomialoperator%= (const SparseMultivariateRationalPolynomial &b)
 Update *this by setting it to the remainder of *this divided by b.
 
SparseMultivariateRationalPolynomial pseudoDivide (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.
 
SparseMultivariateRationalPolynomialoperator+= (const ratNum_t &r)
 Update *this by adding r.
 
SparseMultivariateRationalPolynomialoperator+= (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.
 
SparseMultivariateRationalPolynomialoperator-= (const ratNum_t &r)
 Update *this by subtracting ratNum_t r.
 
SparseMultivariateRationalPolynomialoperator-= (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.
 
SparseMultivariateRationalPolynomialoperator*= (const ratNum_t &r)
 Update *this by multiplying by ratNum_t r.
 
SparseMultivariateRationalPolynomialoperator*= (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.
 
SparseMultivariateRationalPolynomialoperator/= (const ratNum_t &r)
 Update *this by dividing by ratNum_t r.
 
SparseMultivariateRationalPolynomialoperator/= (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.
 
degree_t leadingVariableDegree_tmp () const
 
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< SparseMultivariateRationalPolynomialconvertToSUP (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...
 
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 Algorithm in lexicographical polynomial ordering. More...
 
SparseMultivariateRationalPolynomial triangularSetNormalForm (const TriangularSet< RationalNumber, SparseMultivariateRationalPolynomial > &ts, std::vector< SparseMultivariateRationalPolynomial > *quoSet) const
 Normal Form Algorithm for triangularSet. More...
 
SparseMultivariateRationalPolynomial triangularSetPseudoDivide (const TriangularSet< RationalNumber, SparseMultivariateRationalPolynomial > &ts, std::vector< SparseMultivariateRationalPolynomial > *quoSet, SparseMultivariateRationalPolynomial *h) const
 Multi-Divisor Pseudo Division Algorithm in lexicographical polynomial ordering. More...
 

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< SLPRepresentationslp
 

Static Public Attributes

static mpz_class characteristic
 
static RingProperties properties
 

Friends

class SparseMultivariateIntegerPolynomial
 
std::istream & operator>> (std::istream &in, SparseMultivariateRationalPolynomial &p)
 Parse polynomial from in stream. More...
 
SparseMultivariateRationalPolynomial operator+ (const ratNum_t &r, const SparseMultivariateRationalPolynomial &b)
 Add ratNum_t r and SMQP b.
 
SparseMultivariateRationalPolynomial operator+ (const RationalNumber &r, const SparseMultivariateRationalPolynomial &b)
 Add RationalNumber r and SMQP b.
 
SparseMultivariateRationalPolynomial operator- (const ratNum_t &r, const SparseMultivariateRationalPolynomial &b)
 Subtract SMQP b from ratNum_t r.
 
SparseMultivariateRationalPolynomial operator- (const RationalNumber &r, const SparseMultivariateRationalPolynomial &b)
 Subtract SMQP b from ratNum_t r.
 
SparseMultivariateRationalPolynomial operator* (const ratNum_t &r, const SparseMultivariateRationalPolynomial &b)
 Multiply ratNum_t r and SMQP b.
 
SparseMultivariateRationalPolynomial operator* (const RationalNumber &r, const SparseMultivariateRationalPolynomial &b)
 Multiply RationalNumber r and SMQP b.
 
SparseMultivariateRationalPolynomial operator/ (const ratNum_t &r, const SparseMultivariateRationalPolynomial &b)
 Divide ratNum_t r by SMQP b.
 
SparseMultivariateRationalPolynomial operator/ (const RationalNumber &r, const SparseMultivariateRationalPolynomial &b)
 Divide RationalNumber r by SMQP b.
 

Detailed Description

A multivariate polynomial with RationalNumber coefficients represented sparely.

Only non-zero coefficients are encoded.

Constructor & Destructor Documentation

◆ SparseMultivariateRationalPolynomial() [1/8]

SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial ( )

Construct a multivariate polynomial.

◆ SparseMultivariateRationalPolynomial() [2/8]

SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial ( int  v)

Construct a multivariate polynomial with specific number of variables.

Parameters
vNumber of variables

◆ SparseMultivariateRationalPolynomial() [3/8]

SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial ( const Symbol x)

Construct with a variable name such that f(x) = x;.

Parameters
xThe variable name

◆ SparseMultivariateRationalPolynomial() [4/8]

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() [5/8]

SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial ( const SparseMultivariateRationalPolynomial b)

Copy Constructor.

Does not reuse underlying memory allocated by b.

Parameters
bA sparse multivariate polynomial

◆ SparseMultivariateRationalPolynomial() [6/8]

SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial ( SparseMultivariateRationalPolynomial &&  b)

Move Constructor.

b: The r-value reference polynomial.

◆ SparseMultivariateRationalPolynomial() [7/8]

SparseMultivariateRationalPolynomial::SparseMultivariateRationalPolynomial ( const DenseUnivariateRationalPolynomial p)

Create a SMQP from a univariate rational polynomial.

Parameters
pA SUQP polynomial.

◆ SparseMultivariateRationalPolynomial() [8/8]

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.

Parameters
sThe SUP<SMQP> polynomial

Member Function Documentation

◆ content() [1/2]

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.

◆ content() [2/2]

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.

◆ convertToExpressionTree()

ExpressionTree SparseMultivariateRationalPolynomial::convertToExpressionTree ( ) const

Convert *this to an ExpressionTree.

returns the new ExpressionTree.

◆ convertToSUP()

SparseUnivariatePolynomial<SparseMultivariateRationalPolynomial> SparseMultivariateRationalPolynomial::convertToSUP ( const Symbol x) const

Convert to a SUP<SMQP> given the variable 'x'.

returns the SUP<SMQP>.

◆ deepCopy()

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.

◆ derivative() [1/2]

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::derivative ( const Symbol s,
int  k 
) const
virtual

Return k-th derivative.

Parameters
sSymbol to differentiate with respect to
kOrder of the k-th derivative, k > 0

Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ derivative() [2/2]

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::derivative ( const Symbol s) const
inlinevirtual

Compute derivative.

Parameters
sSymbol to differentiate with respect to

Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ differentiate() [1/2]

void SparseMultivariateRationalPolynomial::differentiate ( const Symbol s,
int  k 
)
inlinevirtual

Convert current object to its k-th derivative.

Parameters
sSymbol to differentiate with respect to
kOrder of the derivative, k > 0

Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ differentiate() [2/2]

void SparseMultivariateRationalPolynomial::differentiate ( const Symbol s)
inlinevirtual

Convert current object to its derivative.

Parameters
sSymbol to differentiate with respect to

Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ divide()

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.

◆ evaluate() [1/2]

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::evaluate ( int  n,
const Symbol syms,
const RationalNumber xs 
) const
inlinevirtual

Evaluate f(x)

Parameters
symsArray of Symbols to evaluate at corresponding xs
xsEvaluation points

Implements BPASMultivariatePolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ evaluate() [2/2]

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::evaluate ( const std::vector< Symbol > &  vars,
const std::vector< RationalNumber > &  values 
) const
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 >.

◆ head()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::head ( ) const
virtual

Get the head of this polynomial.

That is, the initial multiplied by the rank.

returns the head.

Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ initial()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::initial ( ) const
virtual

Get the leading coefficient of *this with respect to the main variable.

returns the initial.

Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ integral() [1/2]

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::integral ( const Symbol s,
int  k 
) const

Return k-th integral.

If Symbol s is not a symbol contained in this polynomial then it becomes the main variable of the result and integration proceeds as expected.

Parameters
sSymbol to differentiate with respect to
kOrder of the k-th derivative, k > 0

◆ integral() [2/2]

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::integral ( const Symbol s) const
inline

Compute integral.

Parameters
sSymbol to differentiate with respect to

◆ integrate() [1/2]

void SparseMultivariateRationalPolynomial::integrate ( const Symbol s,
int  k 
)
inline

Convert current object to its k-th integral.

Parameters
sSymbol to differentiate with respect to
kOrder of the derivative, k > 0

◆ integrate() [2/2]

void SparseMultivariateRationalPolynomial::integrate ( const Symbol s)
inline

Convert current object to its derivative.

Parameters
sSymbol to differentiate with respect to

◆ interpolate()

static SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::interpolate ( const std::vector< std::vector< RationalNumber >> &  points,
const std::vector< RationalNumber > &  vals 
)
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.

◆ isConstant()

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.

◆ isEqual()

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.

◆ isNegativeOne()

bool SparseMultivariateRationalPolynomial::isNegativeOne ( ) const

Is this polynomial negative one.

returns true iff this polynomial encodes -1.

◆ isOne()

bool SparseMultivariateRationalPolynomial::isOne ( ) const

Is this polynomial one.

return true iff this polynomial encodes 1.

◆ isZero()

bool SparseMultivariateRationalPolynomial::isZero ( ) const

Is this polynomial zero.

returns true iff this polynomial encodes 0.

◆ leadingCoefficientInVariable()

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.

◆ leadingVariable()

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.

◆ lexNormalForm()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::lexNormalForm ( const std::vector< Symbol > &  superNames,
const std::vector< SparseMultivariateRationalPolynomial > &  ts,
std::vector< SparseMultivariateRationalPolynomial > *  quoSet = NULL 
) const

Normal Form Algorithm in lexicographical polynomial ordering.

Parameters
[in]superNamesThe vector of variable names in order
[in]tsThe triangular-set
[out]rThe remainder
[out]quoSetThe quotient-set This algorithm runs by f and ts[s], and NULL quoSet[s] where s is the size of triangular-set, Computes r, quoSet[0], ... and quoSet[s] such that f = quoSet[0]*ts[0] + ... + quoSet[s-1]*ts[s-1] + r.

◆ mainDegree()

int SparseMultivariateRationalPolynomial::mainDegree ( ) const
virtual

Get the degree of the main variable.

returns the degree.

Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ mainVariable()

Symbol SparseMultivariateRationalPolynomial::mainVariable ( ) const
inlinevirtual

Get the main variable.

That is, the highest-ordered variable with positive degree.

returns the main variable.

Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ negate()

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.

◆ negativeOne()

void SparseMultivariateRationalPolynomial::negativeOne ( )

Sets this polynomial to -1.

Maintains existing variable ordering.

◆ one()

void SparseMultivariateRationalPolynomial::one ( )

Sets this polynomial to one.

Maintains existing variable ordering.

◆ operator!=()

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.

◆ operator*=()

SparseMultivariateRationalPolynomial& SparseMultivariateRationalPolynomial::operator*= ( const SparseMultivariateRationalPolynomial b)

Multiply the polynomials a and b, returning their product.

Update this by multiplying by the specified polynomail.

◆ operator+=()

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.

◆ operator-()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::operator- ( ) const

Subtract the polynomial b from a and return the difference.

Unary operation, return *this * -1.

◆ operator==()

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.

◆ operator[]()

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.

◆ operator^()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::operator^ ( long long int  e) const

Exponentiate *this by the input exponent integer.

Treats negative exponents as positive.

◆ operator^=()

SparseMultivariateRationalPolynomial& SparseMultivariateRationalPolynomial::operator^= ( long long int  e)

Update *this by exponentiating this to the input integer.

Treats negative exponents as positive.

◆ positiveRealRootIsolation()

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.

Parameters
mpIsRoots of x_n (Output)
apIsA root of previous polynomials
sdeal with 0: positive roots; 1: negative roots
check1: check the leading or tail coefficient; 0: do not
widthInterval's right - left < width
tsTaylor Shift option

Return 1: Need to refine preious polynomials 0: Found positive real roots

◆ primitivePart() [1/5]

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::primitivePart ( ) const

Get the primitive part with respect to all variables.

This is equivalent to this / content().

◆ primitivePart() [2/5]

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::primitivePart ( const Symbol s) const

Get the primitive part with respect to the variable s.

This is equivalent to this / content(s).

◆ primitivePart() [3/5]

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.

◆ primitivePart() [4/5]

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.

◆ primitivePart() [5/5]

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.

◆ pseudoDivide()

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.

◆ randomPolynomial() [1/2]

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

◆ randomPolynomial() [2/2]

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

◆ rank()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::rank ( ) const
virtual

Get the rank of this polynomial.

That is, the main variable raised to the main degree.

returns the rank.

Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ setRingVariables()

void SparseMultivariateRationalPolynomial::setRingVariables ( const std::vector< Symbol > &  )
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 >.

◆ squareFreePart() [1/2]

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.

◆ squareFreePart() [2/2]

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.

◆ tail()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::tail ( ) const
virtual

Get the tail of this polynomial.

That is, This - this.head().

returns the tail.

Implements BPASRecursivelyViewedPolynomial< RationalNumber, SparseMultivariateRationalPolynomial >.

◆ triangularSetNormalForm()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::triangularSetNormalForm ( const TriangularSet< RationalNumber, SparseMultivariateRationalPolynomial > &  ts,
std::vector< SparseMultivariateRationalPolynomial > *  quoSet 
) const

Normal Form Algorithm for triangularSet.

Parameters
[in]superNamesThe vector of variable names in order
[in]tsThe triangular-set
[out]rThe remainder
[out]quoSetThe quotient-set This algorithm runs by f and ts[s], and NULL quoSet[s] where s is the size of triangular-set, Computes r, quoSet[0], ... and quoSet[s] such that f = quoSet[0]*ts[0] + ... + quoSet[s-1]*ts[s-1] + r.

◆ triangularSetPseudoDivide()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::triangularSetPseudoDivide ( const TriangularSet< RationalNumber, SparseMultivariateRationalPolynomial > &  ts,
std::vector< SparseMultivariateRationalPolynomial > *  quoSet,
SparseMultivariateRationalPolynomial h 
) const

Multi-Divisor Pseudo Division Algorithm in lexicographical polynomial ordering.

Parameters
[in]superNamesThe vector of variable names in order
[in]tsThe triangular-set
[out]rThe remainder
[out]hThe initial
[out]quoSetThe quotient-set This algorithm runs by f and ts[s], and NULL quoSet[s] where s is the size of triangular-set, Computes r, h, quoSet[0], ... and quoSet[s] such that h*f = quoSet[0]*ts[0] + ... + quoSet[s-1]*ts[s-1] + r.

◆ unitCanonical()

SparseMultivariateRationalPolynomial SparseMultivariateRationalPolynomial::unitCanonical ( SparseMultivariateRationalPolynomial u,
SparseMultivariateRationalPolynomial v 
) const
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.

◆ zero()

void SparseMultivariateRationalPolynomial::zero ( )

Set this polynomial to zero.

Maintains existing variable ordering.

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  in,
SparseMultivariateRationalPolynomial p 
)
friend

Parse polynomial from in stream.

Exactly one line is parsed.


The documentation for this class was generated from the following file: