1 #ifndef _SMZPALTARRAY_H_ 2 #define _SMZPALTARRAY_H_ 4 #include "../Ring/Integer.hpp" 5 #include "../Polynomial/BPASRecursivePolynomial.hpp" 6 #include "uzpolynomial.h" 7 #include "../RingPolynomial/upolynomial.h" 8 #include "../RationalNumberPolynomial/mrpolynomial.h" 9 #include "SMZP_CppSupport.hpp" 10 #include "SMZP_Support.h" 11 #include "SMZP_Support_Test.h" 12 #include "SMZP_Support_Recursive.h" 14 #include "../ExpressionTree/ExpressionTree.hpp" 15 #include "../DataStructures/Factors.hpp" 17 #if defined(WITH_BLAD) && WITH_BLAD 18 #include "../BLADInterface/bladinterface.h" 21 #if defined(WITH_MAPLE) && WITH_MAPLE 22 #include "../MapleInterface/MapleInterfaceStream.hpp" 57 if (type == 0 || type == 1 || type == 4) {
65 if (type == 0 || type == 1) {
78 mutable AltArrZ_t* poly;
85 friend class MapleInterface;
107 void reorderVarsInPlace(
int varmap[]);
112 void expandVarsInPlace(
int vars,
Symbol* newvars,
int varmap[]);
129 std::vector<SLPZRepresentation> slp;
242 bool isNegativeOne()
const;
253 int isConstant()
const;
265 if (mpz_cmp_si(this->poly->elems->coef, 0l) < 0) {
399 void print(std::ostream& os)
const;
409 void fromString(
const std::string& str);
507 return leadingVariable();
515 int mainDegree()
const;
547 int numberOfVariables()
const;
553 return ringVariables().size();
574 Integer leadingCoefficient()
const;
579 void setLeadingCoefficient(
const Integer& it);
584 Integer trailingCoefficient()
const;
589 Integer coefficient(
int,
const int*)
const;
592 return coefficient(v.size(), v.data());
598 void setCoefficient(
int,
const int*,
const Integer&);
601 setCoefficient(v.size(), v.data(), r);
632 void setRingVariables (
const std::vector<Symbol>&);
638 std::vector<Symbol> ringVariables()
const;
643 std::vector<Symbol> variables()
const;
663 *
this = this->derivative(s, k);
672 this->differentiate(s,1);
689 return this->derivative(s,1);
699 *
this = this->integral(s, k);
708 this->integrate(s,1);
743 return this->integral(s,1);
761 std::vector<Symbol> vecSyms;
762 std::vector<Integer> vecRats;
765 for (
int i = 0; i < n; ++i) {
766 vecSyms.push_back(syms[i]);
767 vecRats.push_back(xs[i]);
769 return evaluate(vecSyms, vecRats);
845 return (*
this + mpz_class(r));
854 return (*
this + r.get_mpz());
868 return (*
this += mpz_class(r));
888 *
this += r.get_mpz();
896 return (*
this - mpz_class(r));
908 return (*
this - r.get_mpz());
922 return (*
this -= mpz_class(r));
942 *
this -= r.get_mpz();
950 return (*
this * mpz_class(r));
962 return (*
this * r.get_mpz());
976 return (*
this *= mpz_class(r));
995 *
this *= r.get_mpz();
1003 return (*
this / mpz_class(r));
1015 return (*
this / r.get_mpz());
1027 return (*
this /= mpz_class(r));
1035 mpz_set(t, r.get_mpz_t());
1049 *
this /= r.get_mpz();
1064 Symbol leadingVariable()
const;
1069 Integer leadingVariableDegree()
const;
1074 bool isConstantTermZero()
const;
1115 void straightLineProgram();
1120 void printSLP(std::ostream& out = std::cout)
const;
1130 void randomPolynomial(
int numvar,
int nterms,
unsigned long int coefBound, degree_t sparsity,
bool includeNeg);
1144 void randomPolynomial(std::vector<int> maxDegs,
unsigned long int coefBound,
float sparsity,
bool includeNeg);
1158 #endif //_SMQPLINKEDLIST_H_ A multivariate polynomial with Integer coefficients using a sparse representation.
Definition: mzpolynomial.hpp:75
A sparsely represented univariate polynomial over an arbitrary ring.
Definition: BigPrimeField.hpp:21
A multivariate polynomial with RationalNumber coefficients represented sparely.
Definition: mrpolynomial.h:71
int numberOfRingVariables() const
Get the number of variables in this polynomial ring.
Definition: mzpolynomial.hpp:552
Definition: mzpolynomial.hpp:33
SparseMultivariateIntegerPolynomial evaluate(int n, const Symbol *syms, const Integer *xs) const
Evaluate f(x)
Definition: mzpolynomial.hpp:760
An ExpressionTree encompasses various forms of data that can be expressed generically as a binary tre...
Definition: ExpressionTree.hpp:17
Data Structure for interval [a, b].
Definition: interval.h:11
SparseMultivariateIntegerPolynomial unitCanonical(SparseMultivariateIntegerPolynomial *u, SparseMultivariateIntegerPolynomial *v) const
Obtain the unit normal (a.k.a canonical associate) of an element.
Definition: mzpolynomial.hpp:260
A univariate polynomial with Integer coefficients using a dense representation.
Definition: uzpolynomial.h:14
Symbol mainVariable() const
Get the main variable.
Definition: mzpolynomial.hpp:506
Integer coefficient(const std::vector< int > &v) const
Get the coefficient of this polynomial with respect to the monomial defined by exponent vector exps...
Definition: mzpolynomial.hpp:591
SparseMultivariateIntegerPolynomial integral(const Symbol &s) const
Compute integral.
Definition: mzpolynomial.hpp:742
void differentiate(const Symbol &s, int k)
Convert current object to its k-th derivative.
Definition: mzpolynomial.hpp:662
A simple data structure for encapsulating a collection of Factor elements.
Definition: Factors.hpp:95
void setCoefficient(const std::vector< int > &v, const Integer &r)
Set the coefficient of this polynomial for the monomial defined by exponent vector exps to r...
Definition: mzpolynomial.hpp:600
An arbitrary-precision Integer.
Definition: Integer.hpp:22
An encapsulation of a mathematical symbol.
Definition: Symbol.hpp:23
An arbitrary-precision rational number.
Definition: RationalNumber.hpp:24
An element of the SLP of an integer polynomial.
Definition: mzpolynomial.hpp:30
void one()
Sets this polynomial to one.
void integrate(const Symbol &s)
Convert current object to its derivative.
Definition: mzpolynomial.hpp:707
SparseMultivariateIntegerPolynomial derivative(const Symbol &s) const
Compute derivative.
Definition: mzpolynomial.hpp:688
void integrate(const Symbol &s, int k)
Convert current object to its k-th integral.
Definition: mzpolynomial.hpp:698
void differentiate(const Symbol &s)
Convert current object to its derivative.
Definition: mzpolynomial.hpp:671
An abstract class defining the interface of a multivariate polynomial that can be viewed recursively...
Definition: BPASRecursivePolynomial.hpp:12