Basic Polynomial Algebra Subprograms (BPAS)  v. 1.652
uzpolynomial.h
1 #ifndef _UZPOLYNOMIAL_H_
2 #define _UZPOLYNOMIAL_H_
3
4
5 #include "../polynomial.h"
6 #include "modpoly.h"
7
8 /**
9  * A univariate polynomial with Integer coefficients using a dense representation.
10  * This representation stores all possible coefficients, up to a maximum degree,
11  * even if they are zero.
12  */
13 class DenseUnivariateIntegerPolynomial : public BPASUnivariatePolynomial<Integer,DenseUnivariateIntegerPolynomial> {
14  private:
15  Symbol name; // Variable name
16  int curd; // Current degree
17  int n; // Maximum size of the polynomial
18  mpz_class* coef; // Coefficients
19
20  inline void zeros() {
21  for (int i = 0; i < n; ++i)
22  coef[i] = 0;
23  }
24
25  bool isEqual(const DenseUnivariateIntegerPolynomial& q) const;
26  void pomopo(const mpz_class c, const mpz_class t, const DenseUnivariateIntegerPolynomial& b);
27  void resetDegree();
30  ;
32
33  public:
34  static mpz_class characteristic;
35  // static bool isPrimeField;
36  // static bool isSmallPrimeField;
37  // static bool isComplexField;
38  /**
39  * Construct a polynomial
40  *
41  * @param d
42  **/
43  DenseUnivariateIntegerPolynomial () : curd(0), n(1), name("%") {
44  coef = new mpz_class[1];
45  coef[0] = 0;
46  }
47  /**
48  * Construct a polynomial with degree
49  *
50  * @param d: Size of the polynomial
51  **/
53  if (s < 1) { s = 1; }
54  n = s;
55  coef = new mpz_class[n];
56  curd = 0;
57  //coef[0] = 0;
58  zeros();
59  name = "%";
60  }
61
62  /**
63  * Construct a polynomial with a coeffient
64  * @param e: The coefficient
65  **/
66  DenseUnivariateIntegerPolynomial (const Integer& e) : curd(0), n(1), name("%") {
67  coef = new mpz_class[1];
68  coef[0] = e.get_mpz();
69  }
70  DenseUnivariateIntegerPolynomial (const RationalNumber& e) : curd(0), n(1), name("%") {
71  if (e.get_den() == 1) {
72  coef = new mpz_class[1];
73  coef[0] = e.get_num().get_mpz();
74  }
75  else {
76  std::cout << "BPAS error, try to construct a rational number in DUZP." << std::endl;
77  exit(1);
78  }
79  }
80  /**
81  * Copy constructor
82  *
83  * @param b: A densed univariate rationl polynomial
84  **/
85  DenseUnivariateIntegerPolynomial(const DenseUnivariateIntegerPolynomial& b) : curd(b.curd), name(b.name) {
86  n = curd + 1;
87  coef = new mpz_class[n];
88  std::copy(b.coef, b.coef+n, coef);
89  }
90  /**
91  * Destroy the polynomial
92  *
93  * @param
94  **/
96  delete [] coef;
97  }
98
99  /**
100  * Get degree of the polynomial
101  *
102  * @param
103  **/
104  inline Integer degree() const {
105  return curd;
106  }
107
108  /**
109  * Get the leading coefficient
110  *
111  * @param
112  **/
113  inline Integer leadingCoefficient() const {
114  return coef[curd];
115  }
116
117  inline Integer trailingCoefficient() const {
118  for(int i = 0; i <= curd; ++i) {
119  if (coef[i] != 0) {
120  return coef[i];
121  }
122  }
123  return 0;
124  }
125
126  inline Integer numberOfTerms() const {
127  size_t c = 0;
128  for (size_t i = 0; i <= curd; ++i) {
129  ++c;
130  }
131  return c;
132  }
133
134  /**
135  * Get coefficients of the polynomial, given start offset
136  *
137  * @param k: Offset
138  **/
139  inline mpz_class* coefficients(int k=0) const {
140 #ifdef BPASDEBUG
141  if (k < 0 || k >= n)
142  std::cout << "BPAS: warning, try to access a non-exist coefficient " << k << " from DUZP(" << n << ")." << std::endl;
143 #endif
144  return &coef[k];
145  }
146  /**
147  * Get a coefficient of the polynomial
148  *
149  * @param k: Offset
150  **/
151  inline Integer coefficient(int k) const {
152  if (k < 0 || k >= n) {
153  mpz_class z(0);
154  return Integer(z);
155  }
156  return Integer(coef[k]);
157  }
158  /**
159  * Set a coefficient of the polynomial
160  *
161  * @param k: Offset
162  * @param val: Coefficient
163  **/
164  inline void setCoefficient(int k, const mpz_class value) {
165  if (k >= n || k < 0) {
166  std::cout << "BPAS: error, DUZP(" << n << ") but trying to access " << k << "." << std::endl;
167  exit(1);
168  }
169  coef[k] = value;
170  if (k > curd && value != 0)
171  curd = k;
172  resetDegree();
173  }
174  inline void setCoefficient(int k, const Integer& value) {
175  setCoefficient(k, value.get_mpz());
176  }
177  inline void setCoefficient(int k, const int value) {
178  setCoefficient(k, mpz_class(value));
179  }
180
181
182  /**
183  * Set a coefficient of the polynomial
184  *
185  * @param k: Degree of the term of which you are setting the coefficient
186  * @param val: Coefficient value
187  **/
188  inline void setCoefficient(Integer k, const Integer& value);
189
190  /**
191  * Get variable's name
192  *
193  * @param
194  **/
195  inline Symbol variable() const {
196  return name;
197  }
198  /**
199  * Set variable's name
200  *
201  * @param x: Varable's name
202  **/
203  inline void setVariableName (const Symbol& x) {
204  name = x;
205  }
206  /**
208  *
209  * @param b: A univariate integer polynoial
210  **/
212  if (this != &b) {
213  if (n) { delete [] coef; n = 0; }
214  name = b.name;
215  curd = b.curd;
216  n = curd + 1;
217  coef = new mpz_class[n];
218  std::copy(b.coef, b.coef+n, coef);
219  }
220  return *this;
221  }
222
225  return *this;
226  }
227
228  /**
230  *
231  * @param b: A univariate integer polynoial
232  **/
233  inline bool operator!= (const DenseUnivariateIntegerPolynomial& b) const {
234  return !(isEqual(b));
235  }
236
237  /**
239  *
240  * @param b: A univariate integer polynoial
241  **/
242  inline bool operator== (const DenseUnivariateIntegerPolynomial& b) const {
243  return isEqual(b);
244  }
245
246  /**
247  * Is zero polynomial
248  *
249  * @param
250  **/
251  inline bool isZero () const {
252  if (!curd)
253  return (coef[0] == 0);
254  return 0;
255  }
256
257  /**
258  * Zero polynomial
259  *
260  * @param
261  **/
262  inline void zero() {
263  curd = 0;
264  zeros();
265  }
266
267  /**
268  * Is polynomial a constatn 1
269  *
270  * @param
271  **/
272  inline bool isOne() const {
273  if (!curd)
274  return (coef[0] == 1);
275  return 0;
276  }
277
278  /**
279  * Set polynomial to 1
280  *
281  * @param
282  **/
283  inline void one() {
284  curd = 0;
285  coef[0] = 1;
286  for (int i = 1; i < n; ++i)
287  coef[i] = 0;
288  }
289
290  /**
291  * Is polynomial a constatn -1
292  *
293  * @param
294  **/
295  inline bool isNegativeOne() const {
296  if (!curd)
297  return (coef[0] == -1);
298  return 0;
299  }
300
301  /**
302  * Set polynomial to -1
303  *
304  * @param
305  **/
306  inline void negativeOne() {
307  curd = 0;
308  coef[0] = -1;
309  for (int i = 1; i < n; ++i)
310  coef[i] = 0;
311  }
312
313  /**
314  * Is a constant
315  *
316  * @param
317  **/
318  inline int isConstant() const {
319  if (curd) { return 0; }
320  else if (coef[0] >= 0) { return 1; }
321  else { return -1; }
322  }
323
324  /**
325  * Obtain the unit normal (a.k.a canonical associate) of an element.
326  * If either parameters u, v, are non-NULL then the units are returned such that
327  * b = ua, v = u^-1. Where b is the unit normal of a, and is the returned value.
328  */
331  Integer unit, uInv;
333  if (unit != 1) {
334  if (u != NULL) {
335  *u = unit;
336  }
337  if (v != NULL) {
338  *v = uInv;
339  }
340
341  return *this * unit;
342
343  }
344
345  if (u != NULL) {
346  *u = Integer(1);
347  }
348  if (v != NULL) {
349  *v = Integer(1);
350  }
351  return *this;
352  }
353
354
355
356  /**
357  * Content of the polynomial
358  *
359  * @param
360  **/
361  inline Integer content() const {
362  mpz_class c = coef[0];
363  for (int i = 1; i <= curd; ++i) {
364  if (coef[i] != 0) {
365  mpz_gcd(c.get_mpz_t(), c.get_mpz_t(), coef[i].get_mpz_t());
366  if (c == 1)
367  break;
368  }
369  }
370  return Integer(c);
371  }
372
373  inline DenseUnivariateIntegerPolynomial primitivePart() const {
374  //TODO
375  std::cerr << "BPAS ERROR: DUZP::primitivePart NOT YET IMPLEMENTED" << std::endl;
376  return *this;
377  }
378
379  /**
380  * Is the least signficant coefficient zero
381  *
382  * @param
383  **/
384  inline bool isConstantTermZero() const {
385  return (coef[0] == 0);
386  }
387
388  /**
390  * replace xor operation by exponentiation
391  *
392  * @param e: The exponentiation, e > 0
393  **/
394  DenseUnivariateIntegerPolynomial operator^ (long long int e) const;
395
396  /**
398  * replace xor operation by exponentiation
399  *
400  * @param e: The exponentiation, e > 0
401  **/
403  *this = *this ^ e;
404  return *this;
405  }
406
407  /**
409  * replace by muplitying x^k
410  *
411  * @param k: The exponent of variable, k > 0
412  **/
414
415  /**
417  * replace by muplitying x^k
418  *
419  * @param k: The exponent of variable, k > 0
420  **/
422  *this = *this << k;
423  return *this;
424  }
425
426  /**
428  * replace by dividing x^k, and
429  * return the quotient
430  *
431  * @param k: The exponent of variable, k > 0
432  **/
434
435  /**
437  * replace by dividing x^k, and
438  * return the quotient
439  *
440  * @param k: The exponent of variable, k > 0
441  **/
443  *this = *this >> k;
444  return *this;
445  }
446
447  /**
449  *
450  * @param b: A univariate integer polynomial
451  **/
453
454  /**
456  *
457  * @param b: A univariate integer polynomial
458  **/
460  if (curd >= b.curd)
462  else
463  *this = *this + b;
464  return *this;
465  }
466
467  /**
468  * Add another polynomial to itself
469  *
470  * @param b: A univariate integer polynomial
471  **/
473
474  /**
476  *
477  * @param c: An integer
478  **/
481  return (r += c);
482  }
483
484  inline DenseUnivariateIntegerPolynomial operator+ (const mpz_class& c) const {
486  return (r += c);
487  }
488
489  inline DenseUnivariateIntegerPolynomial operator+ (int c) const {
491  return (r += c);
492  }
493
494  /**
496  *
497  * @param c: An integer
498  **/
500  coef[0] += c.get_mpz();
501  return *this;
502  }
503
504  inline DenseUnivariateIntegerPolynomial& operator+= (const mpz_class& c) {
505  coef[0] += c;
506  return *this;
507  }
508
510  coef[0] += c;
511  return *this;
512  }
513
514  inline friend DenseUnivariateIntegerPolynomial operator+ (const mpz_class& c, const DenseUnivariateIntegerPolynomial& p) {
515  return (p + c);
516  }
517
519  return (p + c);
520  }
521
522  /**
523  * Subtract another polynomial
524  *
525  * @param b: A univariate integer polynomial
526  */
528
529  /**
531  *
532  * @param b: A univariate integer polynomial
533  **/
535  if (curd >= b.curd)
536  subtract(b);
537  else
538  *this = *this - b;
539  return *this;
540  }
541
542  /**
543  * Overload operator -, negate
544  *
545  * @param
546  **/
548
549  /**
550  * Compute -f(x)
551  *
552  * @param
553  **/
554  inline void negate() {
555  for (int i = 0; i <= curd; ++i) {
556  coef[i] = -coef[i];
557  }
558  }
559
560  /**
561  * Subtract another polynomial from itself
562  *
563  * @param b: A univariate integer polynomial
564  **/
566
567  /**
569  *
570  * @param c: An integer
571  **/
574  return (r -= c);
575  }
576
577  inline DenseUnivariateIntegerPolynomial operator- (const mpz_class& c) const {
579  return (r -= c);
580  }
581
582  inline DenseUnivariateIntegerPolynomial operator- (int c) const {
584  return (r -= c);
585  }
586
587  /**
589  *
590  * @param c: An integer
591  **/
593  coef[0] -= c.get_mpz();
594  return *this;
595  }
596
597  inline DenseUnivariateIntegerPolynomial& operator-= (const mpz_class& c) {
598  coef[0] -= c;
599  return *this;
600  }
601
603  coef[0] -= c;
604  return *this;
605  }
606
607  inline friend DenseUnivariateIntegerPolynomial operator- (const mpz_class& c, const DenseUnivariateIntegerPolynomial& p) {
608  return (-p + c);
609  }
610
612  return (-p + c);
613  }
614
615  /**
616  * Multiply to another polynomial
617  *
618  * @param b: A univariate integer polynomial
619  **/
621
622  /**
624  *
625  * @param b: A univariate integer polynomial
626  **/
628  *this = *this * b;
629  return *this;
630  }
631
632  /**
634  *
635  * @param e: An integer
636  **/
639  return (r *= e);
640  }
641
642  inline DenseUnivariateIntegerPolynomial operator* (const mpz_class& e) const {
644  return (r *= e);
645  }
646
647  inline DenseUnivariateIntegerPolynomial operator* (int e) const {
649  return (r *= e);
650  }
651
652  /**
654  *
655  * @param e: An integer
656  **/
658  mpz_class c = e.get_mpz();
659  *this *= c;
660  return *this;
661  }
662
663  inline DenseUnivariateIntegerPolynomial& operator*= (const mpz_class& e) {
664  if (e != 0 && e != 1) {
665  for (int i = 0; i <= curd; ++i)
666  coef[i] *= e;
667  }
668  else if (e == 0) { zero(); }
669  return *this;
670  }
671
672  /**
674  *
675  * @param e: A constant
676  **/
678  if (e != 0 && e != 1) {
679  for (int i = 0; i <= curd; ++i)
680  coef[i] *= e;
681  }
682  else if (e == 0) { zero(); }
683  return *this;
684  }
685
686  inline friend DenseUnivariateIntegerPolynomial operator* (const mpz_class& e, const DenseUnivariateIntegerPolynomial& p) {
687  return (p * e);
688  }
689
691  return (p * e);
692  }
693
694  /**
696  * ExactDivision
697  *
698  * @param b: A univariate integer polynomial
699  **/
702  return (rem /= b);
703  }
704
705  /**
707  * ExactDivision
708  *
709  * @param b: A univariate integer polynomial
710  **/
712
713  /**
715  *
716  * @param e: An integer
717  **/
720  return (r /= e);
721  }
722
723  inline DenseUnivariateIntegerPolynomial operator/ (const mpz_class& e) const {
725  return (r /= e);
726  }
727
728  inline DenseUnivariateIntegerPolynomial operator/ (int e) const {
730  return (r /= e);
731  }
732
733  /**
735  *
736  * @param e: An integer
737  **/
739  mpz_class c = e.get_mpz();
740  return (*this /= c);
741  }
742
743  DenseUnivariateIntegerPolynomial& operator/= (const mpz_class& e);
744
746  return (*this /= mpz_class(e));
747  }
748
750
751  /**
752  * Monic division
753  * Return quotient and itself become the remainder
754  *
755  * @param b: The dividend polynomial
756  **/
758
759  /**
760  * Monic division
761  * Return quotient
762  *
763  * @param b: The dividend polynomial
764  * @param rem: The remainder polynomial
765  **/
767  *rem = *this;
768  return rem->monicDivide(b);
769  }
770
771  /**
772  * Lazy pseudo dividsion
773  * Return the quotient and itself becomes remainder
774  * e is the exact number of division steps
775  *
776  * @param b: The dividend polynomial
777  * @param c: The leading coefficient of b to the power e
778  * @param d: That to the power deg(a) - deg(b) + 1 - e
779  **/
781
782  /**
783  * Lazy pseudo dividsion
784  * Return the quotient
785  * e is the exact number of division steps
786  *
787  * @param b: The divident polynomial
788  * @param rem: The remainder polynomial
789  * @param c: The leading coefficient of b to the power e
790  * @param d: That to the power deg(a) - deg(b) + 1 - e
791  **/
793  *rem = *this;
794  return rem->lazyPseudoDivide(b, c, d);
795  }
796
797  /**
798  * Pseudo dividsion
799  * Return the quotient and itself becomes remainder
800  *
801  * @param b: The divident polynomial
802  * @param d: The leading coefficient of b
803  * to the power deg(a) - deg(b) + 1
804  **/
806
807  /**
808  * Pseudo dividsion
809  * Return the quotient
810  *
811  * @param b: The divident polynomial
812  * @param rem: The remainder polynomial
813  * @param d: The leading coefficient of b
814  * to the power deg(a) - deg(b) + 1
815  **/
817
818  /**
819  * GCD(p, q)
820  *
821  * @param q: The other polynomial
822  **/
824
826  return gcd(q, 0);
827  }
828
829  /**
830  * Convert current object to its k-th derivative
831  *
832  * @param k: Order of the derivative, k > 0
833  **/
834  void differentiate(int k);
835
836  /**
837  * Convert current object to its derivative
838  *
839  **/
840  inline void differentiate() {
841  this->differentiate(1);
842  }
843
844  /**
845  * Return k-th derivative
846  *
847  * @param k: Order of the k-th derivative, k > 0
848  **/
851  a.differentiate(k);
852  return a;
853  }
854
855  /**
856  * Compute derivative
857  *
858  **/
860  return this->derivative(1);
861  }
862
863  /**
864  * Convert current object to its integral with constant of integration 0
865  *
866  **/
867  void integrate();
868
869  /**
870  * Compute integral with constant of integration 0
871  *
872  **/
875  a.integrate();
876  return a;
877  }
878
879  /**
880  /**
881  * Evaluate f(x)
882  *
883  * @param x: Evaluation point
884  **/
885  // THIS FUNCTION IS DEPRECATED
886  // mpz_class evaluate(const mpz_class& x) const;
887
888  /**
889  * Evaluate f(x)
890  *
891  * @param x: Evaluation point
892  **/
893  Integer evaluate(const Integer& x) const;
894
895  /**
896  * Square free
897  *
898  * @param
899  **/
900  Factors<DenseUnivariateIntegerPolynomial> squareFree() const;
901
902  /**
903  * Overload stream operator <<
904  *
905  * @param out: Stream object
906  * @param b: A univariate Integer polynoial
907  **/
908  void print(std::ostream &out) const;
909
910  /**
911  * Convert this DUZP into an expression tree.
912  */
913  ExpressionTree convertToExpressionTree() const;
914 };
915
916 #endif
DenseUnivariateIntegerPolynomial gcd(const DenseUnivariateIntegerPolynomial &q, int type) const
GCD(p, q)
DenseUnivariateIntegerPolynomial & operator+=(const DenseUnivariateIntegerPolynomial &b)
Definition: uzpolynomial.h:459
DenseUnivariateIntegerPolynomial operator*(const DenseUnivariateIntegerPolynomial &b) const
Multiply to another polynomial.
DenseUnivariateIntegerPolynomial(const Integer &e)
Construct a polynomial with a coeffient.
Definition: uzpolynomial.h:66
void integrate()
Convert current object to its integral with constant of integration 0.
DenseUnivariateIntegerPolynomial & operator=(const DenseUnivariateIntegerPolynomial &b)
Definition: uzpolynomial.h:211
DenseUnivariateIntegerPolynomial & operator>>=(int k)
Overload operator >>= replace by dividing x^k, and return the quotient.
Definition: uzpolynomial.h:442
DenseUnivariateIntegerPolynomial operator^(long long int e) const
Overload operator ^ replace xor operation by exponentiation.
DenseUnivariateIntegerPolynomial & operator*=(const DenseUnivariateIntegerPolynomial &b)
Definition: uzpolynomial.h:627
DenseUnivariateIntegerPolynomial & operator^=(long long int e)
Overload operator ^= replace xor operation by exponentiation.
Definition: uzpolynomial.h:402
DenseUnivariateIntegerPolynomial unitCanonical(DenseUnivariateIntegerPolynomial *u=NULL, DenseUnivariateIntegerPolynomial *v=NULL) const
Obtain the unit normal (a.k.a canonical associate) of an element.
Definition: uzpolynomial.h:329
mpz_class * coefficients(int k=0) const
Get coefficients of the polynomial, given start offset.
Definition: uzpolynomial.h:139
void differentiate()
Convert current object to its derivative.
Definition: uzpolynomial.h:840
DenseUnivariateIntegerPolynomial operator+(const DenseUnivariateIntegerPolynomial &b) const
DenseUnivariateIntegerPolynomial()
Construct a polynomial.
Definition: uzpolynomial.h:43
DenseUnivariateIntegerPolynomial(int s)
Construct a polynomial with degree.
Definition: uzpolynomial.h:52
Integer unitCanonical(Integer *u=NULL, Integer *v=NULL) const
Obtain the unit normal (a.k.a canonical associate) of an element.
DenseUnivariateIntegerPolynomial monicDivide(const DenseUnivariateIntegerPolynomial &b, DenseUnivariateIntegerPolynomial *rem) const
Monic division Return quotient.
Definition: uzpolynomial.h:766
DenseUnivariateIntegerPolynomial lazyPseudoDivide(const DenseUnivariateIntegerPolynomial &b, DenseUnivariateIntegerPolynomial *rem, Integer *c, Integer *d) const
Lazy pseudo dividsion Return the quotient e is the exact number of division steps.
Definition: uzpolynomial.h:792
A univariate polynomial with Integer coefficients using a dense representation.
Definition: uzpolynomial.h:13
Symbol variable() const
Get variable&#39;s name.
Definition: uzpolynomial.h:195
void setCoefficient(int k, const mpz_class value)
Set a coefficient of the polynomial.
Definition: uzpolynomial.h:164
Definition: uzpolynomial.h:113
void one()
Set polynomial to 1.
Definition: uzpolynomial.h:283
DenseUnivariateIntegerPolynomial lazyPseudoDivide(const DenseUnivariateIntegerPolynomial &b, Integer *c, Integer *d=NULL)
Lazy pseudo dividsion Return the quotient and itself becomes remainder e is the exact number of divis...
DenseUnivariateIntegerPolynomial derivative() const
Compute derivative.
Definition: uzpolynomial.h:859
Integer coefficient(int k) const
Get a coefficient of the polynomial.
Definition: uzpolynomial.h:151
Integer content() const
Content of the polynomial.
Definition: uzpolynomial.h:361
DenseUnivariateIntegerPolynomial derivative(int k) const
Return k-th derivative.
Definition: uzpolynomial.h:849
bool isConstantTermZero() const
Is the least signficant coefficient zero.
Definition: uzpolynomial.h:384
int isConstant() const
Is a constant.
Definition: uzpolynomial.h:318
void zero()
Zero polynomial.
Definition: uzpolynomial.h:262
DenseUnivariateIntegerPolynomial & operator<<=(int k)
Overload operator << replace by muplitying x^k.
Definition: uzpolynomial.h:421
void subtract(const DenseUnivariateIntegerPolynomial &b)
Subtract another polynomial from itself.
DenseUnivariateIntegerPolynomial integral()
Compute integral with constant of integration 0.
Definition: uzpolynomial.h:873
void negate()
Compute -f(x)
Definition: uzpolynomial.h:554
DenseUnivariateIntegerPolynomial(const DenseUnivariateIntegerPolynomial &b)
Copy constructor.
Definition: uzpolynomial.h:85
An arbitrary-precision Integer.
Definition: Integer.hpp:22
An abstract class defining the interface of a univariate polynomial over an arbitrary BPASRing...
Definition: polynomial.h:88
void differentiate(int k)
Convert current object to its k-th derivative.
DenseUnivariateIntegerPolynomial & operator-=(const DenseUnivariateIntegerPolynomial &b)
Definition: uzpolynomial.h:534
bool operator==(const DenseUnivariateIntegerPolynomial &b) const
Definition: uzpolynomial.h:242
bool isZero() const
Is zero polynomial.
Definition: uzpolynomial.h:251
bool operator!=(const DenseUnivariateIntegerPolynomial &b) const
Definition: uzpolynomial.h:233
bool isOne() const
Is polynomial a constatn 1.
Definition: uzpolynomial.h:272
DenseUnivariateIntegerPolynomial operator>>(int k) const
Overload operator >> replace by dividing x^k, and return the quotient.
An encapsulation of a mathematical symbol.
Definition: Symbol.hpp:23
bool isNegativeOne() const
Is polynomial a constatn -1.
Definition: uzpolynomial.h:295
An arbitrary-precision rational number.
Definition: RationalNumber.hpp:24
DenseUnivariateIntegerPolynomial & operator/=(const DenseUnivariateIntegerPolynomial &b)
DenseUnivariateIntegerPolynomial operator-() const
DenseUnivariateIntegerPolynomial operator/(const DenseUnivariateIntegerPolynomial &b) const
Definition: uzpolynomial.h:700
DenseUnivariateIntegerPolynomial pseudoDivide(const DenseUnivariateIntegerPolynomial &b, Integer *d=NULL)
Pseudo dividsion Return the quotient and itself becomes remainder.
void negativeOne()
Set polynomial to -1.
Definition: uzpolynomial.h:306
DenseUnivariateIntegerPolynomial monicDivide(const DenseUnivariateIntegerPolynomial &b)
Monic division Return quotient and itself become the remainder.
DenseUnivariateIntegerPolynomial operator<<(int k) const
Overload operator << replace by muplitying x^k.
Integer degree() const
Get degree of the polynomial.
Definition: uzpolynomial.h:104
~DenseUnivariateIntegerPolynomial()
Destroy the polynomial.
Definition: uzpolynomial.h:95
void setVariableName(const Symbol &x)
Set variable&#39;s name.
Definition: uzpolynomial.h:203