Basic Polynomial Algebra Subprograms (BPAS)
v. 1.791
|
A triangular set templated by a multivariate polynomial over a field. More...
#include <triangularset.hpp>
Public Member Functions | |
TriangularSet () | |
Default constructor: creates an empty triangular set of variable size with empty list of transcendentals. More... | |
TriangularSet (const std::vector< Symbol > &xs) | |
Construct an empty triangular set of fixed size in the s decreasingly ordered variables given by xs with empty list of transcendentals. More... | |
TriangularSet (const std::vector< Symbol > &xs, const std::vector< Symbol > &ts) | |
Construct an empty triangular set of fixed size in the s decreasingly ordered variables given by xs and list of transcendentals given by ts. More... | |
TriangularSet (const RecursivePoly &p) | |
Construct a variable triangular set containing p, such that the variables of p are treated as (potentially algebraic) variables, with empty list of transcendentals. More... | |
TriangularSet (const RecursivePoly &p, const std::vector< Symbol > &ts) | |
Construct a variable triangular set containing p, such that the variables in ts are treated as transcendental, while any remaining variables of p are treated as (potentially algebraic) variables. More... | |
TriangularSet (const TriangularSet< Field, RecursivePoly > &a) | |
Copy constructor. More... | |
TriangularSet (TriangularSet< Field, RecursivePoly > &&a) | |
Copy constructor. More... | |
TriangularSet (const std::vector< Symbol > &&vs, const std::vector< Symbol > &&avs, const std::vector< Symbol > &&tvs, const std::vector< RecursivePoly > &&ts, TriangularSetMode tsm, const mpz_class &c) | |
Move constructor. More... | |
~TriangularSet () | |
Deconstructor. More... | |
bool | isEmpty () const |
Copy an object derived from abstract BPASTriangularSet class to type of current object. More... | |
bool | isConstantPolynomial (const RecursivePoly &p) const |
Tests if the polynomial is constant relative to the TriangularSet, i.e., whether it is and element of the Field or its only variables are transcendental. More... | |
TriangularSet< Field, RecursivePoly > & | operator= (const TriangularSet< Field, RecursivePoly > &a) |
Assignment operator =. More... | |
BPASTriangularSet< Field, RecursivePoly > & | operator= (const BPASTriangularSet< Field, RecursivePoly > &a) override |
Assignment operator =. More... | |
TriangularSet< Field, RecursivePoly > & | operator= (TriangularSet< Field, RecursivePoly > &&a) |
Move assignment operator =. More... | |
BPASTriangularSet< Field, RecursivePoly > & | operator= (BPASTriangularSet< Field, RecursivePoly > &&a) override |
Move assignment operator =. More... | |
TriangularSet< Field, RecursivePoly > | operator+ (const RecursivePoly &p) |
Add operator +. More... | |
TriangularSet< Field, RecursivePoly > & | operator+= (const RecursivePoly &p) |
Add assignment operator +=. More... | |
bool | operator== (const TriangularSet< Field, RecursivePoly > &a) const |
Identity operator ==. More... | |
bool | operator!= (const TriangularSet< Field, RecursivePoly > &a) const |
Negated identity operator !=. More... | |
int | numberOfVariables () const |
Get the number of variables. More... | |
int | size () const |
Get the size of the triangular set. More... | |
int | numberOfAlgebraicVariables () const |
Get the number of algebraic variables. More... | |
int | numberOfTranscendentalVariables () const |
Get the number of transcendental variables. More... | |
std::vector< Symbol > | variables () const |
Get the variable names in decreasing order. More... | |
std::vector< Symbol > | mainVariables () const |
Get the algebraic variables. More... | |
std::vector< Symbol > | transcendentalVariables () const |
Get the transcendentalVariables variables. More... | |
std::vector< Symbol > | allVariables () const |
Get the list of variables followed by the transcendental variables. More... | |
bool | isAlgebraic (const Symbol &s) const |
Determine if the input variable s is algebraic, i.e., if the triangular set contains a polynomial with s its as leading variable. More... | |
bool | isStronglyNormalized () const |
Return true if the triangular set is strongly normalized, i.e., the initals of all polynomials are in the Field; return false otherwise. More... | |
std::vector< RecursivePoly > | polynomials () const |
Get the vector of polynoials in the triangular set. More... | |
int | dimension () const |
Return the dimension of the triangular set (understood in terms of the space of (potentially algebraic) variables). More... | |
int | dimensionLower (Symbol v) const |
Return the dimension of the triangular set lower(v) (understood in terms of the space of (potentially algebraic) variables). More... | |
int | codimension () const |
Return the codimension of the triangular set (understood in terms of the space of (potentially algebraic) variables). More... | |
bool | canComputeInDimensionZero (const RecursivePoly &p, bool excludeMainVariable=false) const |
Test to determine whether the triangular set can be treated as zero dimensional, i.e., whether the triangular set becomes zero dimensional when all non-algebraic variables are removed and whether the polynomial p contains only algebraic variables. More... | |
bool | isZeroDimensionalMathematically () const |
Test to determine if only algebraic variables (aside from transcendentals) appear in the polynomials of the triangular set. More... | |
RecursivePoly | select (const Symbol &s) const |
Select a polynomial given the leading variable; if no such polynomial, 0 is returned. More... | |
void | makePrimitive () |
Replace each polynomial of the triangular set with its primitive part. More... | |
void | lower (const Symbol &s, BPASTriangularSet< Field, RecursivePoly > &ts) const |
Returns the triangular set consisting of polynomials with main variable strictly less than s. More... | |
void | upper (const Symbol &s, BPASTriangularSet< Field, RecursivePoly > &ts) const |
Returns the triangular set consisting of polynomials with main variable strictly greater than s. More... | |
void | cutChain (const TriangularSet< Field, RecursivePoly > &T, const Symbol &v, TriangularSet< Field, RecursivePoly > &Tlv, RecursivePoly &Tv, TriangularSet< Field, RecursivePoly > &Tgv) const |
Cut an input triangular set at the symbol v, returning the subchain below v, the polynomial with main variable v and the subchain above v. More... | |
void | cutChain (const Symbol &v, RecursivePoly &Tv, TriangularSet< Field, RecursivePoly > &Tgv) const |
Cut the current object at the symbol v, returning the polynomial with main variable v and the subchain above v. More... | |
void | cutChain (const Symbol &v, TriangularSet< Field, RecursivePoly > &Tlv, RecursivePoly &Tv) const |
Cut the current object at the symbol v, returning the subchain below v and the polynomial with main variable v. More... | |
RecursivePoly | pseudoDivide (const RecursivePoly &p, std::vector< RecursivePoly > *quo=NULL, RecursivePoly *c=NULL) const |
Pseudo division: return the pseudo-remainder, the pseudo-quotients and c such that c*p = ∑(q_i T_i) + r. More... | |
RecursivePoly | normalForm (const RecursivePoly &p, std::vector< RecursivePoly > *Q=NULL) const |
Return the normalForm of the input polynomial modulo the triangular set in the sense of Groebner basis. More... | |
RecursivePoly | reduce (const RecursivePoly &p) const |
Reduce the input polynomial modulo the triangular set. More... | |
RecursivePoly | reduce (const RecursivePoly &p, RecursivePoly &c, bool takeMainPrimitivePart=false, bool onlyInDimZero=false) const |
returns r such that c*r = p modulo sat(T) such that c has no algebraic variables, and c is returned as an input parameter. More... | |
RecursivePoly | randomTriangularSetPolynomial (std::vector< Symbol > variables, int algVar, std::vector< Symbol > transcendentalVariables, int nTerms, unsigned long int coefBound, int pSparsity, bool includeNeg) |
Generate a random triangular set polynomial based on its number of terms. More... | |
RecursivePoly | randomTriangularSetPolynomial (std::vector< Symbol > variables, int algVar, std::vector< Symbol > transcendentalVariables, std::vector< int > maxDegs, unsigned long int coefBound, double pSparsity, bool includeNeg) |
Generate a random triangular set polynomial based on its maximum degrees in its variables. More... | |
void | randomTriangularSet (int nVars, int nAlgVars, int nTrcVars, int nTerms, unsigned long int coefBound, int pSparsity, bool includeNeg) |
Generate a random triangular set based on the number of terms of its polynomials. More... | |
void | randomStronglyNormalizedTriangularSet (int nVars, int nAlgVars, int nTrcVars, int nTerms, unsigned long int coefBound, int pSparsity, bool includeNeg) |
Generate a random strongly normalized triangular set based on the number of terms in its polynomials. More... | |
void | display () |
Display the triangular set. More... | |
ExpressionTree | convertToExpressionTree () const |
Convert a triangular set to an expression tree (array of its polynomials). More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const TriangularSet< Field, RecursivePoly > &a) |
Overload stream operator << for triangular sets. More... | |
A triangular set templated by a multivariate polynomial over a field.
The field should be a BPASField and the multivariate polynomial should be recursively viewed, as in BPASRecursivelyViewedPolynomial.
TriangularSet< Field, RecursivePoly >::TriangularSet | ( | ) |
Default constructor: creates an empty triangular set of variable size with empty list of transcendentals.
TriangularSet< Field, RecursivePoly >::TriangularSet | ( | const std::vector< Symbol > & | xs | ) |
Construct an empty triangular set of fixed size in the s decreasingly ordered variables given by xs with empty list of transcendentals.
xs | The variable names |
TriangularSet< Field, RecursivePoly >::TriangularSet | ( | const std::vector< Symbol > & | xs, |
const std::vector< Symbol > & | ts | ||
) |
Construct an empty triangular set of fixed size in the s decreasingly ordered variables given by xs and list of transcendentals given by ts.
xs | The variable names |
ts | The transcendental variable names |
TriangularSet< Field, RecursivePoly >::TriangularSet | ( | const RecursivePoly & | p | ) |
Construct a variable triangular set containing p, such that the variables of p are treated as (potentially algebraic) variables, with empty list of transcendentals.
p | The recursively viewed polynomial to add |
TriangularSet< Field, RecursivePoly >::TriangularSet | ( | const RecursivePoly & | p, |
const std::vector< Symbol > & | ts | ||
) |
Construct a variable triangular set containing p, such that the variables in ts are treated as transcendental, while any remaining variables of p are treated as (potentially algebraic) variables.
p | The recursively viewed polynomial to add |
ts | The transcendental variable names |
TriangularSet< Field, RecursivePoly >::TriangularSet | ( | const TriangularSet< Field, RecursivePoly > & | a | ) |
Copy constructor.
a | A triangular set |
TriangularSet< Field, RecursivePoly >::TriangularSet | ( | TriangularSet< Field, RecursivePoly > && | a | ) |
Copy constructor.
a | A regular chain Copy constructor |
a | A zero dimensional regular chain Move constructor. |
a | An r-value triangular set |
TriangularSet< Field, RecursivePoly >::TriangularSet | ( | const std::vector< Symbol > && | vs, |
const std::vector< Symbol > && | avs, | ||
const std::vector< Symbol > && | tvs, | ||
const std::vector< RecursivePoly > && | ts, | ||
TriangularSetMode | tsm, | ||
const mpz_class & | c | ||
) |
Move constructor.
a | An r-value regular chain Move constructor |
a | An r-value zero dimensional regular chain Computational constructor: creates a triangular set given all the data. |
vs | rvalue reference to variables of the triangular set |
avs | rvalue reference to algebraic variables of the triangular set |
tvs | rvalue reference to transcendental variables of the triangular set |
polys | rvalue reference to polynomials of the triangular set |
tsm | whether the triangular set is variable or fixed |
c | characteristic of the triangular set |
TriangularSet< Field, RecursivePoly >::~TriangularSet | ( | ) |
Deconstructor.
std::vector<Symbol> TriangularSet< Field, RecursivePoly >::allVariables | ( | ) | const |
Get the list of variables followed by the transcendental variables.
bool TriangularSet< Field, RecursivePoly >::canComputeInDimensionZero | ( | const RecursivePoly & | p, |
bool | excludeMainVariable = false |
||
) | const |
Test to determine whether the triangular set can be treated as zero dimensional, i.e., whether the triangular set becomes zero dimensional when all non-algebraic variables are removed and whether the polynomial p contains only algebraic variables.
p | a recursively viewed polynomial |
p | (optional) flag to exclude the main variable of p when determining whether it contains only algebraic variables (default false) |
|
inline |
Return the codimension of the triangular set (understood in terms of the space of (potentially algebraic) variables).
|
inline |
Convert a triangular set to an expression tree (array of its polynomials).
void TriangularSet< Field, RecursivePoly >::cutChain | ( | const TriangularSet< Field, RecursivePoly > & | T, |
const Symbol & | v, | ||
TriangularSet< Field, RecursivePoly > & | Tlv, | ||
RecursivePoly & | Tv, | ||
TriangularSet< Field, RecursivePoly > & | Tgv | ||
) | const |
Cut an input triangular set at the symbol v, returning the subchain below v, the polynomial with main variable v and the subchain above v.
T | a triangular set |
v | a symbol |
Tlv | the subchain of T below v |
Tv | the recursively viewed polynomial with main variable v, if it exists |
Tgv | the subchain of T above v |
void TriangularSet< Field, RecursivePoly >::cutChain | ( | const Symbol & | v, |
RecursivePoly & | Tv, | ||
TriangularSet< Field, RecursivePoly > & | Tgv | ||
) | const |
Cut the current object at the symbol v, returning the polynomial with main variable v and the subchain above v.
v | a symbol |
Tv | the recursively viewed polynomial with main variable v, if it exists |
Tgv | the subchain of the current object above v |
void TriangularSet< Field, RecursivePoly >::cutChain | ( | const Symbol & | v, |
TriangularSet< Field, RecursivePoly > & | Tlv, | ||
RecursivePoly & | Tv | ||
) | const |
Cut the current object at the symbol v, returning the subchain below v and the polynomial with main variable v.
v | a symbol |
Tlv | the subchain of the current object below v |
Tv | the recursively viewed polynomial with main variable v, if it exists |
|
inline |
Return the dimension of the triangular set (understood in terms of the space of (potentially algebraic) variables).
|
inline |
Return the dimension of the triangular set lower(v) (understood in terms of the space of (potentially algebraic) variables).
void TriangularSet< Field, RecursivePoly >::display | ( | ) |
Display the triangular set.
|
inline |
Determine if the input variable s is algebraic, i.e., if the triangular set contains a polynomial with s its as leading variable.
s | the input variable |
bool TriangularSet< Field, RecursivePoly >::isConstantPolynomial | ( | const RecursivePoly & | p | ) | const |
Tests if the polynomial is constant relative to the TriangularSet, i.e., whether it is and element of the Field or its only variables are transcendental.
p | a recursively viewed polynomial |
bool TriangularSet< Field, RecursivePoly >::isEmpty | ( | ) | const |
Copy an object derived from abstract BPASTriangularSet class to type of current object.
ts | triangular set to copy Tests if the TriangularSet is empty. |
|
inline |
Return true if the triangular set is strongly normalized, i.e., the initals of all polynomials are in the Field; return false otherwise.
bool TriangularSet< Field, RecursivePoly >::isZeroDimensionalMathematically | ( | ) | const |
Test to determine if only algebraic variables (aside from transcendentals) appear in the polynomials of the triangular set.
|
virtual |
Returns the triangular set consisting of polynomials with main variable strictly less than s.
s | symbol of the main variable of specified element of the triangular set |
ts | The returned triangular set |
Implements BPASTriangularSet< Field, RecursivePoly >.
|
inline |
Get the algebraic variables.
void TriangularSet< Field, RecursivePoly >::makePrimitive | ( | ) |
Replace each polynomial of the triangular set with its primitive part.
|
virtual |
Return the normalForm of the input polynomial modulo the triangular set in the sense of Groebner basis.
p | innput recursively viewed polynomial |
Q | (optional) the array of quotient |
Implements BPASTriangularSet< Field, RecursivePoly >.
|
inline |
Get the number of algebraic variables.
|
inline |
Get the number of transcendental variables.
|
inlinevirtual |
bool TriangularSet< Field, RecursivePoly >::operator!= | ( | const TriangularSet< Field, RecursivePoly > & | a | ) | const |
Negated identity operator !=.
a | A triangular set |
TriangularSet<Field,RecursivePoly> TriangularSet< Field, RecursivePoly >::operator+ | ( | const RecursivePoly & | p | ) |
Add operator +.
Adds a polynomial to a triangular set and returns a new triangular set.
p | A recursively viewed polynomial |
TriangularSet<Field,RecursivePoly>& TriangularSet< Field, RecursivePoly >::operator+= | ( | const RecursivePoly & | p | ) |
Add assignment operator +=.
Adds a polynomial to a triangular set.
p | A recursively viewed polynomial |
TriangularSet<Field,RecursivePoly>& TriangularSet< Field, RecursivePoly >::operator= | ( | const TriangularSet< Field, RecursivePoly > & | a | ) |
Assignment operator =.
a | A triangular set |
|
overridevirtual |
Assignment operator =.
a | A triangular set |
Implements BPASTriangularSet< Field, RecursivePoly >.
TriangularSet<Field,RecursivePoly>& TriangularSet< Field, RecursivePoly >::operator= | ( | TriangularSet< Field, RecursivePoly > && | a | ) |
Move assignment operator =.
a | A triangular set |
|
overridevirtual |
Move assignment operator =.
a | A triangular set |
Implements BPASTriangularSet< Field, RecursivePoly >.
bool TriangularSet< Field, RecursivePoly >::operator== | ( | const TriangularSet< Field, RecursivePoly > & | a | ) | const |
Identity operator ==.
a | A triangular set |
|
inline |
Get the vector of polynoials in the triangular set.
|
virtual |
Pseudo division: return the pseudo-remainder, the pseudo-quotients and c such that c*p = ∑(q_i T_i) + r.
p | an input recursively viewed polynomial |
quo | (optional) the array of quotients |
c | (optional) the constant multiplied to the input polynomial |
Implements BPASTriangularSet< Field, RecursivePoly >.
void TriangularSet< Field, RecursivePoly >::randomStronglyNormalizedTriangularSet | ( | int | nVars, |
int | nAlgVars, | ||
int | nTrcVars, | ||
int | nTerms, | ||
unsigned long int | coefBound, | ||
int | pSparsity, | ||
bool | includeNeg | ||
) |
Generate a random strongly normalized triangular set based on the number of terms in its polynomials.
nVars | number of variables |
nAlgVars | number of algebraic variables |
nTrcVars | number of transcendental variables |
nTerms | number of terms in the polynomial |
coefBound | maximum size of the coefficients |
pSparsity | sparsity of the polynomial |
includeNeg | whether to include negative coefficients |
void TriangularSet< Field, RecursivePoly >::randomTriangularSet | ( | int | nVars, |
int | nAlgVars, | ||
int | nTrcVars, | ||
int | nTerms, | ||
unsigned long int | coefBound, | ||
int | pSparsity, | ||
bool | includeNeg | ||
) |
Generate a random triangular set based on the number of terms of its polynomials.
nVars | number of variables |
nAlgVars | number of algebraic variables |
nTrcVars | number of transcendental variables |
nTerms | number of terms in the polynomial |
coefBound | maximum size of the coefficients |
pSparsity | sparsity of the polynomial |
includeNeg | whether to include negative coefficients |
RecursivePoly TriangularSet< Field, RecursivePoly >::randomTriangularSetPolynomial | ( | std::vector< Symbol > | variables, |
int | algVar, | ||
std::vector< Symbol > | transcendentalVariables, | ||
int | nTerms, | ||
unsigned long int | coefBound, | ||
int | pSparsity, | ||
bool | includeNeg | ||
) |
Generate a random triangular set polynomial based on its number of terms.
variables | variables of the triangular set |
algVar | index of the algebraic variable |
transcendentalVariables | transcendental variables of the triangular set |
nTerms | number of terms in the polynomial |
coefBound | maximum size of the coefficients |
pSparsity | sparsity of the polynomial |
includeNeg | whether to include negative coefficients |
RecursivePoly TriangularSet< Field, RecursivePoly >::randomTriangularSetPolynomial | ( | std::vector< Symbol > | variables, |
int | algVar, | ||
std::vector< Symbol > | transcendentalVariables, | ||
std::vector< int > | maxDegs, | ||
unsigned long int | coefBound, | ||
double | pSparsity, | ||
bool | includeNeg | ||
) |
Generate a random triangular set polynomial based on its maximum degrees in its variables.
variables | variables of the triangular set |
algVar | index of the algebraic variable |
transcendentalVariables | transcendental variables of the triangular set |
maxDegs | vector of maximum degrees among the set of variables |
coefBound | maximum size of the coefficients |
pSparsity | proportional sparsity of the polynomial |
includeNeg | whether to include negative coefficients |
RecursivePoly TriangularSet< Field, RecursivePoly >::reduce | ( | const RecursivePoly & | p | ) | const |
Reduce the input polynomial modulo the triangular set.
p | input recursively viewed polynomial |
RecursivePoly TriangularSet< Field, RecursivePoly >::reduce | ( | const RecursivePoly & | p, |
RecursivePoly & | c, | ||
bool | takeMainPrimitivePart = false , |
||
bool | onlyInDimZero = false |
||
) | const |
returns r such that c*r = p modulo sat(T) such that c has no algebraic variables, and c is returned as an input parameter.
p | input recursively viewed polynomial |
c | returned value of the content of p modulo sat(T) |
usePrimitiveFactorization | (optional) whether to use primitive factorization to compute c (default true) |
onlyInDimZero | (optional) only perform the reduction if the canComputeInDimensionZero(p) is true (default false) |
|
virtual |
Select a polynomial given the leading variable; if no such polynomial, 0 is returned.
x | The leading variable name |
Implements BPASTriangularSet< Field, RecursivePoly >.
|
inline |
Get the size of the triangular set.
|
inline |
Get the transcendentalVariables variables.
|
virtual |
Returns the triangular set consisting of polynomials with main variable strictly greater than s.
s | symbol of the main variable of specified element of the triangular set |
ts | The returned triangular set |
Implements BPASTriangularSet< Field, RecursivePoly >.
|
inlinevirtual |
Get the variable names in decreasing order.
Implements BPASTriangularSet< Field, RecursivePoly >.
|
friend |
Overload stream operator << for triangular sets.
out | Stream object |
a | A triangular set |