1 #ifndef _SMQPALTARRAY_H_ 2 #define _SMQPALTARRAY_H_ 4 #include "../Polynomial/BPASRecursivePolynomial.hpp" 5 #include "../Interval/interval.h" 6 #include "urpolynomial.h" 7 #include "../IntegerPolynomial/mzpolynomial.hpp" 8 #include "../RingPolynomial/upolynomial.h" 9 #include "SMQP_CppSupport-AA.hpp" 10 #include "SMQP_Support-AA.h" 11 #include "SMQP_Support_Test-AA.h" 12 #include "SMQP_Support_Recursive-AA.h" 14 #include "../ExpressionTree/ExpressionTree.hpp" 15 #include "../DataStructures/Factors.hpp" 16 #include "../TriangularSet/triangularset.hpp" 17 #include "../IntegerPolynomial/DUZP_Support.h" 18 #include "../ModularPolynomial/DUSP_Parallel.hpp" 19 #include "../Parser/bpas_parser.h" 53 if (type == 0 || type == 1 || type == 4) {
61 if (type == 0 || type == 1) {
74 mutable AltArr_t* poly;
93 void reorderVarsInPlace(
int varmap[]);
98 void expandVarsInPlace(
int vars,
Symbol* newvars,
int varmap[]);
114 std::vector<SLPRepresentation> slp;
259 return (*
this * leadInv);
376 void print(std::ostream& os)
const;
441 return this->subresultantInitialAtIdx(q, v, idx, d1, d2, lazyInfo);
794 std::vector<Symbol> vecSyms;
795 std::vector<RationalNumber> vecRats;
798 for (
int i = 0; i < n; ++i) {
799 vecSyms.push_back(syms[i]);
800 vecRats.push_back(xs[i]);
849 applyModuloSymmetricPrimPart_AA_inp(this->poly, i.get_mpz_t());
1022 mpq_set(t, r.get_mpq_t());
1100 void printSLP(std::ostream& out = std::cout)
const;
1123 int positiveRealRootIsolation(
Intervals* pIs,
Intervals& apIs, mpq_class width,
int ts=-1,
bool s=0,
bool check=1);
1133 void randomPolynomial(
int numvar,
int nterms,
unsigned long int coefBound, degree_t sparsity,
bool includeNeg);
1147 void randomPolynomial(std::vector<int> maxDegs,
unsigned long int coefBound,
float sparsity,
bool includeNeg);
1169 const std::vector<SparseMultivariateRationalPolynomial>& ts, std::vector<SparseMultivariateRationalPolynomial>* quoSet = NULL)
const;
1222 #endif //_SMQPLINKEDLIST_H_ bool isOne() const
Is this polynomial one.
A multivariate polynomial with Integer coefficients using a sparse representation.
Definition: mzpolynomial.hpp:75
A triangular set templated by a multivariate polynomial over a field.
Definition: triangularset.hpp:44
SparseMultivariateRationalPolynomial evaluate(int n, const Symbol *syms, const RationalNumber *xs) const
Evaluate f(x)
Definition: mrpolynomial.h:793
void differentiate(const Symbol &s)
Convert current object to its derivative.
Definition: mrpolynomial.h:728
A sparsely represented univariate polynomial over an arbitrary ring.
Definition: BigPrimeField.hpp:21
int mainDegree() const
Get the degree of the main variable.
SparseMultivariateIntegerPolynomial & operator+=(const SparseMultivariateIntegerPolynomial &b)
Add the polynomails a and b and return the sum.
SparseMultivariateIntegerPolynomial pseudoDivide(const SparseMultivariateIntegerPolynomial &b, SparseMultivariateIntegerPolynomial *quo=NULL, SparseMultivariateIntegerPolynomial *mult=NULL, bool lazy=0) const
Pseudo divide this by b.
SparseMultivariateIntegerPolynomial separant() const
Get the separant of this polynomial, that is, its derivative with respect to the main variable...
void print(std::ostream &os) const
Output the string representation of *this to the input ostream.
A multivariate polynomial with RationalNumber coefficients represented sparely.
Definition: mrpolynomial.h:71
SparseMultivariateRationalPolynomial derivative(const Symbol &s) const
Compute derivative.
Definition: mrpolynomial.h:745
Integer leadingCoefficient() const
Get the leading coefficient.
Symbol mainVariable() const
Get the main variable.
Definition: mrpolynomial.h:568
SparseMultivariateIntegerPolynomial & operator%=(const SparseMultivariateIntegerPolynomial &b)
Update *this by setting it to the remainder of *this divided by b.
bool isZero() const
Is this polynomial zero.
SparseMultivariateIntegerPolynomial operator[](int index) const
Get the polynomial term at index.
void randomPolynomial(int numvar, int nterms, unsigned long int coefBound, degree_t sparsity, bool includeNeg)
Change *this to be a random non-zero polynomial.
SparseMultivariateIntegerPolynomial & operator/=(const SparseMultivariateIntegerPolynomial &b)
Update *this by dividing by the specified polynomial.
int numberOfVariables() const
Get the number of variables in this polynomial.
SparseUnivariatePolynomial< SparseMultivariateIntegerPolynomial > convertToSUP(const Symbol &x) const
Convert to a SUP<SMQP> given the variable 'x'.
int isConstant() const
Determine if this polynomial encodes a constant.
std::vector< Symbol > ringVariables() const
Get variable names of all variables available to this polynomial, even those that have zero degree...
void integrate(const Symbol &s)
Convert current object to its derivative.
Definition: mrpolynomial.h:764
SparseMultivariateIntegerPolynomial evaluate(int n, const Symbol *syms, const Integer *xs) const
Evaluate f(x)
Definition: mzpolynomial.hpp:760
SparseMultivariateIntegerPolynomial tail() const
Get the tail of this polynomial.
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...
An ExpressionTree encompasses various forms of data that can be expressed generically as a binary tre...
Definition: ExpressionTree.hpp:17
SparseMultivariateIntegerPolynomial primitiveGCD(const SparseMultivariateIntegerPolynomial &b) const
Get the GCD between *this and b as a primitive polynomial.
void negate()
Negate all the coefficients of *this.
SparseMultivariateIntegerPolynomial & operator=(const SparseMultivariateIntegerPolynomial &b)
Assign this polynomail to equal the specified.
SparseMultivariateIntegerPolynomial operator-() const
Subtract the polynomial b from a and return the difference.
Data Structure for interval [a, b].
Definition: interval.h:11
SparseMultivariateIntegerPolynomial & operator*=(const SparseMultivariateIntegerPolynomial &b)
Multiply the polynomials a and b, returning their product.
SparseMultivariateIntegerPolynomial integral(const Symbol &s, int k) const
Return k-th integral.
SparseMultivariateIntegerPolynomial initial() const
Get the leading coefficient of *this with respect to the main variable.
void straightLineProgram()
SLP representation of the polynomial.
std::vector< Symbol > variables() const
Get variable names of variables with non-zero degree;.
void printSLP(std::ostream &out=std::cout) const
Print SLP representation.
void setCoefficient(int, const int *, const Integer &)
Set a coefficient, given the exponent of each variable.
SparseMultivariateIntegerPolynomial & operator^=(long long int e)
Update *this by exponentiating this to the input integer.
int numberOfRingVariables() const
Get the number of variables in this polynomial ring.
Definition: mrpolynomial.h:614
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.
A univariate polynomial with RationalNumber coefficients represented densely.
Definition: urpolynomial.h:16
bool isEqual(const SparseMultivariateIntegerPolynomial &b) const
Determine if *this is equal to b.
Integer leadingVariableDegree() const
Get the degree of this polynomial w.r.t the leading variable.
void differentiate(const Symbol &s, int k)
Convert current object to its k-th derivative.
Definition: mzpolynomial.hpp:662
Integer coefficient(int, const int *) const
Get a coefficient, given the exponent of each variable.
friend std::istream & operator>>(std::istream &in, SparseMultivariateIntegerPolynomial &p)
Parse a polynomial from the in stream.
A simple data structure for encapsulating a collection of Factor elements.
Definition: Factors.hpp:95
SparseMultivariateIntegerPolynomial deepCopy() const
Get a copy of this such that all underlying memory is NOT shared.
Definition: mrpolynomial.h:29
bool isNegativeOne() const
Is this polynomial negative one.
Integer trailingCoefficient() const
Get the trailing coefficient.
SparseMultivariateIntegerPolynomial operator/(const SparseMultivariateIntegerPolynomial &b) const
Divide *this by the specified polynomial.
SparseMultivariateIntegerPolynomial rank() const
Get the rank of this polynomial.
Integer content() const
Get the content with respect to all variables.
An arbitrary-precision Integer.
Definition: Integer.hpp:22
void fromString(const std::string &str)
Parse a polynomial from the string str and place it in *this.
RationalNumber coefficient(const std::vector< int > &v) const
Get the coefficient of this polynomial with respect to the monomial defined by exponent vector exps...
Definition: mrpolynomial.h:648
SparseMultivariateIntegerPolynomial operator*(const SparseMultivariateIntegerPolynomial &b) const
Multiply *this by the specified polynomail.
void integrate(const Symbol &s, int k)
Convert current object to its k-th integral.
Definition: mrpolynomial.h:755
std::vector< SparseMultivariateRationalPolynomial > subresultantInitialAtIdx(const SparseMultivariateRationalPolynomial &q, const Symbol &v, int idx=0, specSRC_AAZ **lazyInfo=NULL) const
Compute the initials of two successive subresultants: S_{i}, S_{i+1} s.t.
Definition: mrpolynomial.h:439
SparseMultivariateIntegerPolynomial squareFreePart() const
Computes the square free part of this polynomail.
void setCoefficient(const std::vector< int > &v, const RationalNumber &r)
Set the coefficient of this polynomial for the monomial defined by exponent vector exps to r...
Definition: mrpolynomial.h:657
SparseMultivariateIntegerPolynomial & operator-=(const SparseMultivariateIntegerPolynomial &b)
Update *this by subtracting the specified polynomial from it.
ExpressionTree convertToExpressionTree() const
Convert *this to an ExpressionTree.
SparseMultivariateIntegerPolynomial operator+(const SparseMultivariateIntegerPolynomial &b) const
Add two SMQP polynomials together, *this and the specified.
bool isConstantTermZero() const
Is the contant term zero.
void zero()
Set this polynomial to zero.
Integer numberOfTerms() const
Get the number of non-zero terms.
SparseMultivariateIntegerPolynomial derivative(const Symbol &s, int k) const
Return k-th derivative.
void setRingVariables(const std::vector< Symbol > &)
Set variables' names.
SparseMultivariateIntegerPolynomial leadingCoefficientInVariable(const Symbol &x, int *e=NULL) const
Get the leading coefficient w.r.t the input variable 'x'.
SparseMultivariateIntegerPolynomial head() const
Get the head of this polynomial.
Factors< SparseMultivariateIntegerPolynomial > factor() const
Factors this polynomial into irreducible factors.
SparseMultivariateIntegerPolynomial gcd(const SparseMultivariateIntegerPolynomial &b) const
Get GCD between *this and b.
void negativeOne()
Sets this polynomial to -1.
bool operator!=(const SparseMultivariateIntegerPolynomial &b) const
Determine if *this is not equal to the specified polynomial.
An encapsulation of a mathematical symbol.
Definition: Symbol.hpp:23
An arbitrary-precision rational number.
Definition: RationalNumber.hpp:24
void one()
Sets this polynomial to one.
An element of the SLP of a rational number polynomial.
Definition: mrpolynomial.h:26
SparseMultivariateIntegerPolynomial primitivePart() const
Get the primitive part with respect to all variables.
SparseMultivariateIntegerPolynomial operator%(const SparseMultivariateIntegerPolynomial &b) const
Get the remainder of *this divided by b.
RationalNumber inverse() const
Get the inverse of *this.
Definition: RationalNumber.hpp:388
SparseMultivariateRationalPolynomial unitCanonical(SparseMultivariateRationalPolynomial *u, SparseMultivariateRationalPolynomial *v) const
Obtain the unit normal (a.k.a canonical associate) of an element.
Definition: mrpolynomial.h:250
void integrate(const Symbol &s, int k)
Convert current object to its k-th integral.
Definition: mzpolynomial.hpp:698
Factors< SparseMultivariateIntegerPolynomial > squareFree() const
Compute squarefree factorization of *this with respect to all of its variables.
SparseMultivariateIntegerPolynomial operator^(long long int e) const
Exponentiate *this by the input exponent integer.
Interval lists for real roots of multivariate polynomials.
Definition: interval.h:35
Symbol leadingVariable() const
Get the leading variable, that is, the highest-order variable with positive degree of this polynomial...
Integer degree() const
Total degree.
SparseMultivariateRationalPolynomial integral(const Symbol &s) const
Compute integral.
Definition: mrpolynomial.h:783
void differentiate(const Symbol &s, int k)
Convert current object to its k-th derivative.
Definition: mrpolynomial.h:719
An abstract class defining the interface of a multivariate polynomial that can be viewed recursively...
Definition: BPASRecursivePolynomial.hpp:12
bool operator==(const SparseMultivariateIntegerPolynomial &b) const
Determine if *this is equal to the specified polynomial.