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);
504 return leadingVariable();
512 int mainDegree()
const;
544 int numberOfVariables()
const;
550 return ringVariables().size();
571 Integer leadingCoefficient()
const;
576 void setLeadingCoefficient(
const Integer& it);
581 Integer trailingCoefficient()
const;
586 Integer coefficient(
int,
const int*)
const;
589 return coefficient(v.size(), v.data());
595 void setCoefficient(
int,
const int*,
const Integer&);
598 setCoefficient(v.size(), v.data(), r);
629 void setRingVariables (
const std::vector<Symbol>&);
635 std::vector<Symbol> ringVariables()
const;
640 std::vector<Symbol> variables()
const;
660 *
this = this->derivative(s, k);
669 this->differentiate(s,1);
686 return this->derivative(s,1);
696 *
this = this->integral(s, k);
705 this->integrate(s,1);
740 return this->integral(s,1);
758 std::vector<Symbol> vecSyms;
759 std::vector<Integer> vecRats;
762 for (
int i = 0; i < n; ++i) {
763 vecSyms.push_back(syms[i]);
764 vecRats.push_back(xs[i]);
766 return evaluate(vecSyms, vecRats);
842 return (*
this + mpz_class(r));
851 return (*
this + r.get_mpz());
865 return (*
this += mpz_class(r));
885 *
this += r.get_mpz();
893 return (*
this - mpz_class(r));
905 return (*
this - r.get_mpz());
919 return (*
this -= mpz_class(r));
939 *
this -= r.get_mpz();
947 return (*
this * mpz_class(r));
959 return (*
this * r.get_mpz());
973 return (*
this *= mpz_class(r));
992 *
this *= r.get_mpz();
1000 return (*
this / mpz_class(r));
1012 return (*
this / r.get_mpz());
1024 return (*
this /= mpz_class(r));
1032 mpz_set(t, r.get_mpz_t());
1046 *
this /= r.get_mpz();
1061 Symbol leadingVariable()
const;
1066 Integer leadingVariableDegree()
const;
1071 bool isConstantTermZero()
const;
1112 void straightLineProgram();
1117 void printSLP(std::ostream& out = std::cout)
const;
1127 void randomPolynomial(
int numvar,
int nterms,
unsigned long int coefBound, degree_t sparsity,
bool includeNeg);
1141 void randomPolynomial(std::vector<int> maxDegs,
unsigned long int coefBound,
float sparsity,
bool includeNeg);
1155 #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:70
int numberOfRingVariables() const
Get the number of variables in this polynomial ring.
Definition: mzpolynomial.hpp:549
Definition: mzpolynomial.hpp:33
SparseMultivariateIntegerPolynomial evaluate(int n, const Symbol *syms, const Integer *xs) const
Evaluate f(x)
Definition: mzpolynomial.hpp:757
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:503
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:588
SparseMultivariateIntegerPolynomial integral(const Symbol &s) const
Compute integral.
Definition: mzpolynomial.hpp:739
void differentiate(const Symbol &s, int k)
Convert current object to its k-th derivative.
Definition: mzpolynomial.hpp:659
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:597
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:704
SparseMultivariateIntegerPolynomial derivative(const Symbol &s) const
Compute derivative.
Definition: mzpolynomial.hpp:685
void integrate(const Symbol &s, int k)
Convert current object to its k-th integral.
Definition: mzpolynomial.hpp:695
void differentiate(const Symbol &s)
Convert current object to its derivative.
Definition: mzpolynomial.hpp:668
An abstract class defining the interface of a multivariate polynomial that can be viewed recursively...
Definition: BPASRecursivePolynomial.hpp:12