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

A multivariate polynomial with Integer coefficients using a sparse representation. More...

#include <mzpolynomial.hpp>

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

Public Member Functions

SparseMultivariateIntegerPolynomial subresultantGCD (const SparseMultivariateIntegerPolynomial &q) const
 
std::vector< SparseMultivariateIntegerPolynomialsubresultantChain (const SparseMultivariateIntegerPolynomial &q, int filled=0) const
 
SparseMultivariateIntegerPolynomial resultant (const SparseMultivariateIntegerPolynomial &q) const
 
 SparseMultivariateIntegerPolynomial ()
 Construct a multivariate polynomial. More...
 
 SparseMultivariateIntegerPolynomial (int v)
 Construct a multivariate polynomial with specific number of variables. More...
 
 SparseMultivariateIntegerPolynomial (const Symbol &x)
 htop More...
 
 SparseMultivariateIntegerPolynomial (const std::string &str)
 Construct a polynomial by parsing the string str.
 
 SparseMultivariateIntegerPolynomial (const SparseMultivariateIntegerPolynomial &b)
 Copy Constructor. More...
 
 SparseMultivariateIntegerPolynomial (SparseMultivariateIntegerPolynomial &&b)
 Move Constructor. More...
 
 SparseMultivariateIntegerPolynomial (const SparseMultivariateRationalPolynomial &b)
 Create a SMZP from an SMQP.
 
 SparseMultivariateIntegerPolynomial (const Integer &r, int nvar=0)
 Create a SMZP from an Integer.
 
 SparseMultivariateIntegerPolynomial (const RationalNumber &r, int nvar=0)
 Create a SMZP from a RationalNumber.
 
 SparseMultivariateIntegerPolynomial (const DenseUnivariateIntegerPolynomial &p)
 Create a SMZP from a univariate rational polynomial. More...
 
 SparseMultivariateIntegerPolynomial (const SparseUnivariatePolynomial< SparseMultivariateIntegerPolynomial > &s)
 Construct from a SUP<SMZP> polynomial such that the resulting SMZP has main variable equal to the variable of s. More...
 
 ~SparseMultivariateIntegerPolynomial ()
 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...
 
SparseMultivariateIntegerPolynomial unitCanonical (SparseMultivariateIntegerPolynomial *u, SparseMultivariateIntegerPolynomial *v) const
 Obtain the unit normal (a.k.a canonical associate) of an element. More...
 
SparseMultivariateIntegerPolynomialoperator= (const SparseMultivariateIntegerPolynomial &b)
 Assign this polynomail to equal the specified.
 
SparseMultivariateIntegerPolynomialoperator= (SparseMultivariateIntegerPolynomial &&b)
 Movement assignment: move b to be this polynomail.
 
SparseMultivariateIntegerPolynomialoperator= (const Integer &r)
 Assign this polynomial to be equal to the constant ring element.
 
SparseMultivariateIntegerPolynomial operator+ (const SparseMultivariateIntegerPolynomial &b) const
 Add two SMQP polynomials together, *this and the specified.
 
SparseMultivariateIntegerPolynomial operator+ (SparseMultivariateIntegerPolynomial &&b) const
 
SparseMultivariateIntegerPolynomialoperator+= (const SparseMultivariateIntegerPolynomial &b)
 Add the polynomails a and b and return the sum. More...
 
SparseMultivariateIntegerPolynomial operator- (const SparseMultivariateIntegerPolynomial &b) const
 Subtract the specified polynomail from *this.
 
SparseMultivariateIntegerPolynomial operator- (SparseMultivariateIntegerPolynomial &&b) const
 
SparseMultivariateIntegerPolynomial operator- () const
 Subtract the polynomial b from a and return the difference. More...
 
SparseMultivariateIntegerPolynomialoperator-= (const SparseMultivariateIntegerPolynomial &b)
 Update *this by subtracting the specified polynomial from it.
 
SparseMultivariateIntegerPolynomial operator* (const SparseMultivariateIntegerPolynomial &b) const
 Multiply *this by the specified polynomail.
 
SparseMultivariateIntegerPolynomial operator* (SparseMultivariateIntegerPolynomial &&b) const
 
SparseMultivariateIntegerPolynomialoperator*= (const SparseMultivariateIntegerPolynomial &b)
 Multiply the polynomials a and b, returning their product. More...
 
SparseMultivariateIntegerPolynomial operator/ (const SparseMultivariateIntegerPolynomial &b) const
 Divide *this by the specified polynomial.
 
SparseMultivariateIntegerPolynomial operator/ (SparseMultivariateIntegerPolynomial &&b) const
 
SparseMultivariateIntegerPolynomialoperator/= (const SparseMultivariateIntegerPolynomial &b)
 Update *this by dividing by the specified polynomial.
 
SparseMultivariateIntegerPolynomial operator^ (long long int e) const
 Exponentiate *this by the input exponent integer. More...
 
SparseMultivariateIntegerPolynomialoperator^= (long long int e)
 Update *this by exponentiating this to the input integer. More...
 
bool operator== (const SparseMultivariateIntegerPolynomial &b) const
 Determine if *this is equal to the specified polynomial. More...
 
bool operator!= (const SparseMultivariateIntegerPolynomial &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 the string str and place it in *this.
 
SparseMultivariateIntegerPolynomial gcd (const SparseMultivariateIntegerPolynomial &b) const
 Get GCD between *this and b.
 
SparseMultivariateIntegerPolynomial primitiveGCD (const SparseMultivariateIntegerPolynomial &b) const
 Get the GCD between *this and b as a primitive polynomial.
 
Factors< SparseMultivariateIntegerPolynomialsquareFree () const
 Compute squarefree factorization of *this with respect to all of its variables.
 
Factors< SparseMultivariateIntegerPolynomialsquareFree (const std::vector< Symbol > &vars) const
 Compute squarefree factorization of *this with respect to the list of variables, vars.
 
SparseMultivariateIntegerPolynomial squareFreePart () const
 Computes the square free part of this polynomail. More...
 
SparseMultivariateIntegerPolynomial squareFreePart (std::vector< Symbol > &vars) const
 Computes the square free part of this polynomail. More...
 
Integer content () const
 Get the content with respect to all variables. More...
 
SparseMultivariateIntegerPolynomial 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 primitivePart () const
 Get the primitive part with respect to all variables. More...
 
SparseMultivariateIntegerPolynomial primitivePart (Integer &content) const
 Get the primitive part with respect to all variables. More...
 
SparseMultivariateIntegerPolynomial primitivePart (const std::vector< Symbol > &v) const
 Get the primitive part with respect to the variables in the vector v. More...
 
SparseMultivariateIntegerPolynomial primitivePart (const std::vector< Symbol > &v, SparseMultivariateIntegerPolynomial &content) const
 Get the primitive part with respect to the variables in the vector v. More...
 
SparseMultivariateIntegerPolynomial 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...
 
SparseMultivariateIntegerPolynomial rank () const
 Get the rank of this polynomial. More...
 
SparseMultivariateIntegerPolynomial head () const
 Get the head of this polynomial. More...
 
SparseMultivariateIntegerPolynomial tail () const
 Get the tail of this polynomial. More...
 
SparseMultivariateIntegerPolynomial 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.
 
Integer leadingCoefficient () const
 Get the leading coefficient.
 
void setLeadingCoefficient (const Integer &it)
 Set the leading coefficient.
 
Integer trailingCoefficient () const
 Get the trailing coefficient.
 
Integer coefficient (int, const int *) const
 Get a coefficient, given the exponent of each variable.
 
Integer coefficient (const std::vector< int > &v) const
 
void setCoefficient (int, const int *, const Integer &)
 Set a coefficient, given the exponent of each variable.
 
void setCoefficient (const std::vector< int > &v, const Integer &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 SparseMultivariateIntegerPolynomial &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...
 
SparseMultivariateIntegerPolynomial derivative (const Symbol &s, int k) const
 Return k-th derivative. More...
 
SparseMultivariateIntegerPolynomial 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...
 
SparseMultivariateIntegerPolynomial integral (const Symbol &s, int k) const
 Return k-th integral. More...
 
SparseMultivariateRationalPolynomial rationalIntegral (const Symbol &s, int k) const
 Return k-th integral. More...
 
SparseMultivariateIntegerPolynomial integral (const Symbol &s) const
 Compute integral. More...
 
SparseMultivariateRationalPolynomial rationalIntegral (const Symbol &s) const
 Return the integral of this, with respect to Symbol s, as a rational number polynomial. More...
 
SparseMultivariateIntegerPolynomial evaluate (int n, const Symbol *syms, const Integer *xs) const
 Evaluate f(x) More...
 
SparseMultivariateIntegerPolynomial evaluate (const std::vector< Symbol > &vars, const std::vector< Integer > &values) const
 Evaluate *this polynomial given the variables and their values in vars, and values. More...
 
bool divide (const SparseMultivariateIntegerPolynomial &b, SparseMultivariateIntegerPolynomial &q, SparseMultivariateIntegerPolynomial &r) const
 Divide this by polynomial b, returning the quotient and remainder in q and r, respectively. More...
 
bool rationalDivide (const SparseMultivariateIntegerPolynomial &b, SparseMultivariateRationalPolynomial &q, SparseMultivariateRationalPolynomial &r) const
 Divide this by polynomial b, return the quotient and remainder in q and r as rational number polynomials. More...
 
SparseMultivariateIntegerPolynomial operator% (const SparseMultivariateIntegerPolynomial &b) const
 Get the remainder of *this divided by b.
 
SparseMultivariateIntegerPolynomialoperator%= (const SparseMultivariateIntegerPolynomial &b)
 Update *this by setting it to the remainder of *this divided by b.
 
SparseMultivariateIntegerPolynomial pseudoDivide (const SparseMultivariateIntegerPolynomial &b, SparseMultivariateIntegerPolynomial *quo=NULL, SparseMultivariateIntegerPolynomial *mult=NULL, bool lazy=0) const
 Pseudo divide this by b. More...
 
SparseMultivariateIntegerPolynomial operator+ (const mpz_t r) const
 Add *this and a mpz_t.
 
SparseMultivariateIntegerPolynomial operator+ (const mpz_class &r) const
 Add *this and the mpz_class r.
 
SparseMultivariateIntegerPolynomial operator+ (const Integer &r) const
 
SparseMultivariateIntegerPolynomialoperator+= (const mpz_t r)
 Update *this by adding r.
 
SparseMultivariateIntegerPolynomialoperator+= (const mpz_class &r)
 Update *this by adding the mpz_class r to it.
 
SparseMultivariateIntegerPolynomialoperator+= (const Integer &r)
 Update *this by adding the Integer r to it.
 
SparseMultivariateIntegerPolynomial operator- (const mpz_t r) const
 Subtract the mpz_t r from *this.
 
SparseMultivariateIntegerPolynomial operator- (const mpz_class &r) const
 Subtract the mpz_class r from *this.
 
SparseMultivariateIntegerPolynomial operator- (const Integer &r) const
 Subtract the Integer r from *this.
 
SparseMultivariateIntegerPolynomialoperator-= (const mpz_t r)
 Update *this by subtracting mpz_t r.
 
SparseMultivariateIntegerPolynomialoperator-= (const mpz_class &r)
 Update *this by subtracting mpz_class r.
 
SparseMultivariateIntegerPolynomialoperator-= (const Integer &r)
 Update *this by subtracting Integer r.
 
SparseMultivariateIntegerPolynomial operator* (const mpz_t r) const
 Multiply *this by mpz_t r.
 
SparseMultivariateIntegerPolynomial operator* (const mpz_class &r) const
 Multiply *this by mpz_class r.
 
SparseMultivariateIntegerPolynomial operator* (const Integer &r) const
 Multiply *this by Integer r.
 
SparseMultivariateIntegerPolynomialoperator*= (const mpz_t r)
 Update *this by multiplying by mpz_t r.
 
SparseMultivariateIntegerPolynomialoperator*= (const mpz_class &r)
 Update *this by multiplying by mpz_class r.
 
SparseMultivariateIntegerPolynomialoperator*= (const Integer &r)
 Update *this by multiplying by Integer r.
 
SparseMultivariateIntegerPolynomial operator/ (const mpz_t r) const
 Divide *this by mpz_t r.
 
SparseMultivariateIntegerPolynomial operator/ (const mpz_class &r) const
 Divide *this by mpz_class r.
 
SparseMultivariateIntegerPolynomial operator/ (const Integer &r) const
 Divide *this by Integer r.
 
SparseMultivariateIntegerPolynomialoperator/= (const mpz_t r)
 Update *this by dividing by mpz_t r.
 
SparseMultivariateIntegerPolynomialoperator/= (const mpz_class &r)
 Update *this by dividing by mpz_class r.
 
SparseMultivariateIntegerPolynomialoperator/= (const Integer &r)
 Update *this by dividing by Integer r.
 
SparseMultivariateIntegerPolynomial 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.
 
SparseMultivariateIntegerPolynomial leadingCoefficientInVariable (const Symbol &x, int *e=NULL) const
 Get the leading coefficient w.r.t the input variable 'x'. More...
 
SparseUnivariatePolynomial< SparseMultivariateIntegerPolynomialconvertToSUP (const Symbol &x) const
 Convert to a SUP<SMQP> given the variable 'x'. More...
 
void negate ()
 Negate all the coefficients of *this. More...
 
SparseMultivariateIntegerPolynomial deepCopy () const
 Get a copy of this such that all underlying memory is NOT shared. More...
 
Factors< SparseMultivariateIntegerPolynomialfactor () 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.
 
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...
 

Static Public Member Functions

static SparseMultivariateIntegerPolynomial interpolate (const std::vector< std::vector< Integer >> &points, const std::vector< Integer > &vals)
 Find the interpolating polynomial for the integer points and values specified by each vector, respectively. More...
 
static SparseMultivariateIntegerPolynomial interpolate (const std::vector< std::vector< RationalNumber >> &points, const std::vector< RationalNumber > &vals)
 Find the interpolating polynomial for the rational number points and values specified by each vector, respectively. More...
 

Public Attributes

std::vector< SLPZRepresentationslp
 

Static Public Attributes

static mpz_class characteristic
 
static RingProperties properties
 

Friends

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

Detailed Description

A multivariate polynomial with Integer coefficients using a sparse representation.

Only non-zero coefficients are encoded.

Constructor & Destructor Documentation

◆ SparseMultivariateIntegerPolynomial() [1/7]

SparseMultivariateIntegerPolynomial::SparseMultivariateIntegerPolynomial ( )

Construct a multivariate polynomial.

◆ SparseMultivariateIntegerPolynomial() [2/7]

SparseMultivariateIntegerPolynomial::SparseMultivariateIntegerPolynomial ( int  v)

Construct a multivariate polynomial with specific number of variables.

Parameters
vNumber of variables

◆ SparseMultivariateIntegerPolynomial() [3/7]

SparseMultivariateIntegerPolynomial::SparseMultivariateIntegerPolynomial ( const Symbol x)

htop

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

Parameters
xThe variable name

◆ SparseMultivariateIntegerPolynomial() [4/7]

SparseMultivariateIntegerPolynomial::SparseMultivariateIntegerPolynomial ( const SparseMultivariateIntegerPolynomial b)

Copy Constructor.

Does not reuse underlying memory allocated by b.

Parameters
bA sparse multivariate polynomial

◆ SparseMultivariateIntegerPolynomial() [5/7]

SparseMultivariateIntegerPolynomial::SparseMultivariateIntegerPolynomial ( SparseMultivariateIntegerPolynomial &&  b)

Move Constructor.

b: The r-value reference polynomial.

◆ SparseMultivariateIntegerPolynomial() [6/7]

SparseMultivariateIntegerPolynomial::SparseMultivariateIntegerPolynomial ( const DenseUnivariateIntegerPolynomial p)

Create a SMZP from a univariate rational polynomial.

Parameters
pA SUZP polynomial.

◆ SparseMultivariateIntegerPolynomial() [7/7]

SparseMultivariateIntegerPolynomial::SparseMultivariateIntegerPolynomial ( const SparseUnivariatePolynomial< SparseMultivariateIntegerPolynomial > &  s)

Construct from a SUP<SMZP> polynomial such that the resulting SMZP has main variable equal to the variable of s.

Parameters
sThe SUP<SMZP> polynomial

Member Function Documentation

◆ content() [1/2]

Integer SparseMultivariateIntegerPolynomial::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]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::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 SparseMultivariateIntegerPolynomial::convertToExpressionTree ( ) const

Convert *this to an ExpressionTree.

returns the new ExpressionTree.

◆ convertToSUP()

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

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

returns the SUP<SMQP>.

◆ deepCopy()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::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]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::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< Integer, SparseMultivariateIntegerPolynomial >.

◆ derivative() [2/2]

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

Compute derivative.

Parameters
sSymbol to differentiate with respect to

Implements BPASMultivariatePolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ differentiate() [1/2]

void SparseMultivariateIntegerPolynomial::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< Integer, SparseMultivariateIntegerPolynomial >.

◆ differentiate() [2/2]

void SparseMultivariateIntegerPolynomial::differentiate ( const Symbol s)
inlinevirtual

Convert current object to its derivative.

Parameters
sSymbol to differentiate with respect to

Implements BPASMultivariatePolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ divide()

bool SparseMultivariateIntegerPolynomial::divide ( const SparseMultivariateIntegerPolynomial b,
SparseMultivariateIntegerPolynomial q,
SparseMultivariateIntegerPolynomial 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]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::evaluate ( int  n,
const Symbol syms,
const Integer xs 
) const
inlinevirtual

Evaluate f(x)

Parameters
symsArray of Symbols to evaluate at corresponding xs
xsEvaluation points

Implements BPASMultivariatePolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ evaluate() [2/2]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::evaluate ( const std::vector< Symbol > &  vars,
const std::vector< Integer > &  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< Integer, SparseMultivariateIntegerPolynomial >.

◆ factor()

Factors<SparseMultivariateIntegerPolynomial> SparseMultivariateIntegerPolynomial::factor ( ) const

Factors this polynomial into irreducible factors.

The Factors may include a common numerical (integer) factor. See also, Factors.

◆ head()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::head ( ) const
virtual

Get the head of this polynomial.

That is, the initial multiplied by the rank.

returns the head.

Implements BPASRecursivelyViewedPolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ initial()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::initial ( ) const
virtual

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

returns the initial.

Implements BPASRecursivelyViewedPolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ integral() [1/2]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::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.

If the integral of this polynomial cannot be represented as an integer polynomial then an error occurs. See rationalIntegral().

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

◆ integral() [2/2]

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

Compute integral.

Parameters
sSymbol to differentiate with respect to

◆ integrate() [1/2]

void SparseMultivariateIntegerPolynomial::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 SparseMultivariateIntegerPolynomial::integrate ( const Symbol s)
inline

Convert current object to its derivative.

Parameters
sSymbol to differentiate with respect to

◆ interpolate() [1/2]

static SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::interpolate ( const std::vector< std::vector< Integer >> &  points,
const std::vector< Integer > &  vals 
)
static

Find the interpolating polynomial for the integer 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.

An error will occur if the resulting interpolating polynomial cannot be represented as an integer polynomial.

returns the interpolating polynomial.

◆ interpolate() [2/2]

static SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::interpolate ( const std::vector< std::vector< RationalNumber >> &  points,
const std::vector< RationalNumber > &  vals 
)
static

Find the interpolating polynomial for the rational number 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.

An error will occur if the resulting interpolating polynomial cannot be represented as an integer polynomial.

returns the interpolating polynomial.

◆ isConstant()

int SparseMultivariateIntegerPolynomial::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 SparseMultivariateIntegerPolynomial::isEqual ( const SparseMultivariateIntegerPolynomial 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 SparseMultivariateIntegerPolynomial::isNegativeOne ( ) const

Is this polynomial negative one.

returns true iff this polynomial encodes -1.

◆ isOne()

bool SparseMultivariateIntegerPolynomial::isOne ( ) const

Is this polynomial one.

return true iff this polynomial encodes 1.

◆ isZero()

bool SparseMultivariateIntegerPolynomial::isZero ( ) const

Is this polynomial zero.

returns true iff this polynomial encodes 0.

◆ leadingCoefficientInVariable()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::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 SparseMultivariateIntegerPolynomial::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.

◆ mainDegree()

int SparseMultivariateIntegerPolynomial::mainDegree ( ) const
virtual

Get the degree of the main variable.

returns the degree.

Implements BPASRecursivelyViewedPolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ mainVariable()

Symbol SparseMultivariateIntegerPolynomial::mainVariable ( ) const
inlinevirtual

Get the main variable.

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

returns the main variable.

Implements BPASRecursivelyViewedPolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ negate()

void SparseMultivariateIntegerPolynomial::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 SparseMultivariateIntegerPolynomial::negativeOne ( )

Sets this polynomial to -1.

Maintains existing variable ordering.

◆ one()

void SparseMultivariateIntegerPolynomial::one ( )

Sets this polynomial to one.

Maintains existing variable ordering.

◆ operator!=()

bool SparseMultivariateIntegerPolynomial::operator!= ( const SparseMultivariateIntegerPolynomial 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*=()

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

Multiply the polynomials a and b, returning their product.

Update this by multiplying by the specified polynomail.

◆ operator+=()

SparseMultivariateIntegerPolynomial& SparseMultivariateIntegerPolynomial::operator+= ( const SparseMultivariateIntegerPolynomial b)

Add the polynomails a and b and return the sum.

Update *this by adding the specified polynomail to it.

◆ operator-()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::operator- ( ) const

Subtract the polynomial b from a and return the difference.

Unary operation, return *this * -1.

◆ operator==()

bool SparseMultivariateIntegerPolynomial::operator== ( const SparseMultivariateIntegerPolynomial 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[]()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::operator[] ( int  index) const

Get the polynomial term at index.

Returns 0 if index is beyond the number of terms in this polynomial.

◆ operator^()

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

Exponentiate *this by the input exponent integer.

Treats negative exponents as positive.

◆ operator^=()

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

Update *this by exponentiating this to the input integer.

Treats negative exponents as positive.

◆ primitivePart() [1/4]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::primitivePart ( ) const

Get the primitive part with respect to all variables.

This is equivalent to this / content().

◆ primitivePart() [2/4]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::primitivePart ( Integer 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() [3/4]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::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() [4/4]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::primitivePart ( const std::vector< Symbol > &  v,
SparseMultivariateIntegerPolynomial 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()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::pseudoDivide ( const SparseMultivariateIntegerPolynomial b,
SparseMultivariateIntegerPolynomial quo = NULL,
SparseMultivariateIntegerPolynomial 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 SparseMultivariateIntegerPolynomial::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 SparseMultivariateIntegerPolynomial::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()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::rank ( ) const
virtual

Get the rank of this polynomial.

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

returns the rank.

Implements BPASRecursivelyViewedPolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ rationalDivide()

bool SparseMultivariateIntegerPolynomial::rationalDivide ( const SparseMultivariateIntegerPolynomial b,
SparseMultivariateRationalPolynomial q,
SparseMultivariateRationalPolynomial r 
) const

Divide this by polynomial b, return the quotient and remainder in q and r as rational number polynomials.

This differs from the normal divide function where divisibility of coefficients does not matter as the result belongs to the polynomial ring over the rational numbers.

returns a boolean indicating if the division was exact.

◆ rationalIntegral() [1/2]

SparseMultivariateRationalPolynomial SparseMultivariateIntegerPolynomial::rationalIntegral ( 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.

This method returns a rational number polynomial and therefore works regardless of the coefficients of this polynomial.

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

◆ rationalIntegral() [2/2]

SparseMultivariateRationalPolynomial SparseMultivariateIntegerPolynomial::rationalIntegral ( const Symbol s) const

Return the integral of this, with respect to Symbol s, as a rational number polynomial.

Parameters
sthe symbol to integrate with respect to returns the integral

◆ setRingVariables()

void SparseMultivariateIntegerPolynomial::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< Integer, SparseMultivariateIntegerPolynomial >.

◆ squareFreePart() [1/2]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::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]

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::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()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::tail ( ) const
virtual

Get the tail of this polynomial.

That is, This - this.head().

returns the tail.

Implements BPASRecursivelyViewedPolynomial< Integer, SparseMultivariateIntegerPolynomial >.

◆ unitCanonical()

SparseMultivariateIntegerPolynomial SparseMultivariateIntegerPolynomial::unitCanonical ( SparseMultivariateIntegerPolynomial u,
SparseMultivariateIntegerPolynomial 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 SparseMultivariateIntegerPolynomial::zero ( )

Set this polynomial to zero.

Maintains existing variable ordering.

Friends And Related Function Documentation

◆ operator>>

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

Parse a polynomial from the in stream.

Exactly one line is parsed.


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