Basic Polynomial Algebra Subprograms (BPAS)  v. 1.791
sdmpolynomial.h
1 #ifndef _SMALLMMPOLYNOMIAL_H_
2 #define _SMALLMMPOLYNOMIAL_H_
3 
4 #include "../Polynomial/BPASMultivarPolynomial.hpp"
5 #include "../FFT/src/modpn.h"
6 #include "../FFT/src/general_routine.h"
7 #include "../FFT/src/basic_routine.h"
8 #include "../FFT/src/DDMP.h"
9 //#include "../../include/FFT/src/modpn_hfiles/Types.h"
10 //#if FURER
11 //#include "src/fft_furer1.h"
12 //#else
13 //#include "src/fft_iter1.h"
14 //#endif
15 
16 
17 #define SDMPBASESIZE 1024
18 
19 /**
20  * A multivariate polynomial with coefficients in a small prime field using a dense representation.
21  */
22 class SmallPrimeFieldDistributedDenseMultivariateModularPolynomial : public BPASGCDDomain<SmallPrimeFieldDistributedDenseMultivariateModularPolynomial> {
23 //TODO wrap sfixn in BPASRing class.
24 //public BPASMultivariatePolynomial<sfixn,SmallPrimeFieldDistributedDenseMultivariateModularPolynomial>,
25 
26  private:
27  Symbol* names; // Variable names
28  int var; // Number of variables
29  int n; // Number of terms
30  sfixn* coefs; // Coefficients in Prime field
31  int* degs; // Partial size
32  sfixn p; // Prime
33  int* acc;
34 
35  void zeros();
37  bool shrink();
40 
41  public:
42  static mpz_class characteristic;
43  // static bool isPrimeField;
44  // static bool isSmallPrimeField;
45  // static bool isComplexField;
46 
47  /**
48  * Constructor using a default prime
49  **/
51  p = BPASPRIME;
52  coefs = new sfixn[1];
53  coefs[0] = 0;
54  degs = new int[1];
55  degs[0] = 0;
56  acc = new int[1];
57  acc[0] = 1;
58  names = new Symbol[1];
59  names[0] = "1";
60  }
61 
62  /**
63  * Constructor with the field
64  *
65  * @param m: The prime
66  **/
68  coefs = new sfixn[1];
69  coefs[0] = 0;
70  degs = new int[1];
71  degs[0] = 0;
72  acc = new int[1];
73  acc[0] = 1;
74  names = new Symbol[1];
75  names[0] = "1";
76  }
77 
78  /**
79  * Constructor with number of variables and terms
80  *
81  * @param v: Number of variables
82  * @param ds: Partial degrees
83  * @param m: The prime
84  **/
85  SmallPrimeFieldDistributedDenseMultivariateModularPolynomial (int v, int* ds, sfixn m) : var(v), p(m) {
86  degs = new int[var];
87  acc = new int[var];
88  acc[0] = 1;
89  for (int i = 0; i < var; ++i) {
90  degs[i] = ds[i];
91  if (i < var - 1)
92  acc[i+1] = acc[i] * (degs[i] + 1);
93  }
94  n = acc[var-1] * (degs[var-1] + 1);
95  coefs = new sfixn[n];
96  zeros();
97  names = new Symbol[var+1];
98  names[0] = "1";
99  for (int i = 1; i <= var; ++i) {
100  std::ostringstream convert;
101  convert << var - i + 1;
102  names[i] = "_";
103  names[i] += convert.str();
104  }
105  }
106 
107  /**
108  * Construct with a variable name
109  * such that f(x) = x;
110  *
111  * @param x: The variable name
112  * @param m: The prime
113  **/
115  names = new Symbol[2];
116  names[0] = "9";
117  names[1] = x;
118  degs = new int[1];
119  degs[0] = 1;
120  acc = new int[1];
121  acc[0] = 1;
122  coefs = new sfixn[2];
123  coefs[0] = 0;
124  coefs[1] = 1;
125  }
126 
127  /**
128  * Copy constructor
129  *
130  * @param b: A multivariate modular polynomial
131  **/
133  degs = new int[var];
134  std::copy(b.degs, b.degs+var, degs);
135  acc = new int[var];
136  std::copy(b.acc, b.acc+var, acc);
137  coefs = new sfixn[n];
138  std::copy(b.coefs, b.coefs+n, coefs);
139  names = new Symbol[var+1];
140  std::copy(b.names, b.names+var+1, names);
141  }
142 
143  /**
144  * Deconstructor
145  *
146  * @param
147  **/
149  delete [] coefs;
150  delete [] degs;
151  delete [] names;
152  delete [] acc;
153  }
154 
155  /**
156  * Overload operator =
157  *
158  * @param b: A multivariate modular polynomial
159  **/
161  if (this != &b) {
162  delete [] coefs;
163  delete [] degs;
164  delete [] names;
165  delete [] acc;
166 
167  var = b.var;
168  degs = new int[var];
169  std::copy(b.degs, b.degs+var, degs);
170  acc = new int[var];
171  std::copy(b.acc, b.acc+var, acc);
172  n = b.n;
173  coefs = new sfixn[n];
174  std::copy(b.coefs, b.coefs+n, coefs);
175  names = new Symbol[var+1];
176  std::copy(b.names, b.names+var+1, names);
177  p = b.p;
178  }
179  return *this;
180  }
181 
184  }
185 
186  /**
187  * The characteristic of this ring class.
188  */
189  mpz_class getCharacteristic() const override {
190  return SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::characteristic;
191  }
192 
193  /**
194  * Is a zero polynomial
195  *
196  **/
197  inline bool isZero() const {
198  for (int i = 0; i < n; ++i) {
199  if (coefs[i] != 0)
200  return 0;
201  }
202  return 1;
203  }
204 
205  /**
206  * Zero polynomial
207  *
208  * @param
209  **/
210  inline void zero() {
211  zeros();
212  }
213 
214  /**
215  * Is polynomial 1
216  *
217  * @param
218  **/
219  inline bool isOne() const {
220  for (int i = 1; i < n; ++i) {
221  if (coefs[i] != 0)
222  return 0;
223  }
224  return (coefs[0] == 1);
225  }
226 
227  /**
228  * Set polynomial to 1
229  *
230  * @param
231  **/
232  inline void one() {
233  coefs[0] = 1;
234  for (int i = 1; i < n; ++i)
235  coefs[i] = 0;
236  }
237 
238  /**
239  * Is polynomial -1
240  *
241  * @param
242  **/
243  inline bool isNegativeOne() const {
244  for (int i = 1; i < n; ++i) {
245  if (coefs[i] != 0)
246  return 0;
247  }
248  return (coefs[0] == p - 1);
249  }
250 
251  /**
252  * Set polynomial to -1
253  *
254  * @param
255  **/
256  inline void negativeOne() {
257  coefs[0] = p - 1;
258  for (int i = 1; i < n; ++i)
259  coefs[i] = 0;
260  }
261 
262  /**
263  * Is a constant
264  *
265  * @param
266  **/
267  inline int isConstant() const {
268  for (int i = 1; i < n; ++i) {
269  if (coefs[i] != 0)
270  return 0;
271  }
272  if (coefs[0] < (p >> 1)) { return 1; }
273  else { return -1; }
274  }
275 
278  sfixn leadCoef = this->leadingCoefficient();
279  mpz_class mpzLead(leadCoef);
280  mpz_class mpzPrime(p);
281 
282  mpz_t temp;
283  mpz_init(temp);
284  if (!mpz_invert(temp, mpzLead.get_mpz_t(), mpzPrime.get_mpz_t()))
285  mpz_set_si(temp, 0);
286  sfixn leadInv = mpz_get_si(temp);
287  mpz_clear(temp);
288 
290  if (u != NULL) {
291  *u = leadCoef;
292  }
293  if (v != NULL) {
294  *v = leadInv;
295  }
296  return ret;
297  }
298 
299  /**
300  * Get the number of variables
301  *
302  * @param
303  **/
304  inline int numberOfVariables() const {
305  return variables().size();
306  }
307 
308  /**
309  * Get the number of variables in this polynomial ring.
310  */
311  inline int numberOfRingVariables() const {
312  return ringVariables().size();
313  }
314 
315  /**
316  * Get the number of non-zero terms
317  *
318  * @param
319  **/
320  inline Integer numberOfTerms() const {
321  int k = 0;
322  for (int i = 0; i < n; ++i)
323  if (coefs[i] != 0) { k++; }
324  return k;
325  }
326 
327  /**
328  * Get the size of the polynomial
329  *
330  * @param
331  **/
332  inline int size() const {
333  return n;
334  }
335 
336  /**
337  * Total degree.
338  */
339  inline Integer degree() const {
340  std::cerr << "SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::degree() NOT YET IMPLEMENTED" << std::endl;
341  //TODO
342  return 0;
343  }
344 
345  /**
346  * Get a partial degree of variable x
347  *
348  * @param x: The variable name
349  **/
350  inline Integer degree(const Symbol& x) const {
351  int k = 0, d = 0;
352  for (int i = 1; i <= var; ++i) {
353  if (names[i] == x) {
354  k = i;
355  break;
356  }
357  }
358  if (k) {
359  k--;
360  for (int i = 0; i < n; ++i) {
361  int e = (i / acc[k]) % (degs[k] + 1);
362  if (coefs[i] != 0 && e > d)
363  d = e;
364  }
365  }
366  return d;
367  }
368 
369  /**
370  * Get the leading coefficient
371  *
372  * @param
373  **/
374  inline sfixn leadingCoefficient() const {
375  for (int i = n-1; i > -1; --i) {
376  if (coefs[i] != 0)
377  return coefs[i];
378  }
379  return 0;
380  }
381 
382  inline sfixn trailingCoefficient() const {
383  for (int i = 0; i < n; ++i) {
384  if (coefs[i] != 0) {
385  return coefs[i];
386  }
387  }
388  return 0;
389  }
390 
391  inline bool isConstantTermZero() const {
392  return (coefs[0] == 0);
393  }
394 
395  /**
396  * Get a coefficient
397  *
398  * @param v: Number of variables
399  * @param d: The exponent of each variable
400  **/
401  inline sfixn coefficient(int v, const int* d) const {
402  int k = 0;
403  for (int i = var-1, j = 0; i > -1 && j < v; --i, ++j) {
404  if (d[j] <= degs[i])
405  k += d[j] * acc[i];
406  else { return 0; }
407  }
408  for (int i = v-var-1; i > -1; --i)
409  if (d[i]) { return 0; }
410  return coefs[k];
411  }
412 
413  inline sfixn coefficient(const std::vector<int>& v) const {
414  return coefficient(v.size(), v.data());
415  }
416 
417  /**
418  * Set a coefficient
419  *
420  * @param v: Number of variables
421  * @param d: The exponent of each variable
422  * @param val: Value of the coefficient
423  **/
424  inline void setCoefficient(int v, const int* d, const sfixn& val) {
425  if (v != var) {
426  std::cout << "BPAS: error, SFDDMMP(" << var << "), but trying to setCoefficient with " << v << " variables." << std::endl;
427  exit(1);
428  }
429  int k = 0;
430  for (int i = var-1, j = 0; i > -1 && j < v; --i, ++j) {
431  if (d[j] <= degs[i])
432  k += d[j] * acc[i];
433  else {
434  std::cout << "BPAS: error, the degree of " << names[i+1] << " in SFDDMMP is " << degs[i] << "." << std::endl;
435  exit(1);
436  }
437  }
438  coefs[k] = val;
439  }
440 
441  inline void setCoefficient(const std::vector<int>& v, const sfixn& val) {
442  setCoefficient(v.size(), v.data(), val);
443  }
444 
445  /**
446  * Set a coefficient
447  *
448  * @param k: The offset in the coefficient array
449  * @param val: Value of the coefficient
450  **/
451  inline void setCoefficient(int k, const sfixn& val) {
452  if (k >= n || k < 0) {
453  std::cout << "BPAS: error, trying to access a non-exist coefficient in SFDDMMP<Field>." << std::endl;
454  exit(1);
455  }
456  coefs[k] = val;
457  }
458 
459  /**
460  * Get variable names
461  *
462  * @param
463  **/
464  inline std::vector<Symbol> ringVariables() const {
465  std::vector<Symbol> xs;
466  for (int i = var; i > 0; --i)
467  xs.push_back(names[i]);
468  return xs;
469  }
470 
471  /**
472  * Set variable names
473  *
474  * @param xs: Variable names
475  **/
476  inline void setRingVariables(const std::vector<Symbol>& xs) {
477  int ns = xs.size();
478  if (ns != var) {
479  std::cerr << "BPAS ERROR: SDMP shrinking and expanding polynomial ring NOT YET IMPLEMENTED" << std::endl;
480  return;
481  }
482  names[0] = "9";
483  for (int i = var, j = 0; i > 0 && j < ns; --i, ++j)
484  names[i] = xs[j];
485  }
486 
487  inline std::vector<Symbol> variables() const {
488  std::cerr << "BPAS ERROR: SDMP::variables() NOT YET IMPLEMENTED" << std::endl;
489  return ringVariables();
490  }
491 
492  /**
493  * Convert current object to its k-th derivative
494  *
495  * @param s: Symbol to differentiate with respect to
496  * @param k: Order of the derivative, k > 0
497  **/
498  void differentiate(const Symbol& s, int k) {}
499 
500  /**
501  * Convert current object to its derivative
502  *
503  * @param s: Symbol to differentiate with respect to
504  **/
505  inline void differentiate(const Symbol& s) {
506  this->differentiate(s,0);
507  }
508 
509  /**
510  * Return k-th derivative
511  *
512  * @param s: Symbol to differentiate with respect to
513  * @param k: Order of the k-th derivative, k > 0
514  **/
517  a.differentiate(s,k);
518  return a;
519  }
520  /**
521  * Compute derivative
522  *
523  * @param s: Symbol to differentiate with respect to
524  **/
526  return this->derivative(s,0);
527  }
528 
529  /**
530  * Evaluate f(x)
531  *
532  * @param syms: Array of Symbols to evaluate at corresponding xs
533  * @param xs: Evaluation points
534  **/
535  inline SmallPrimeFieldDistributedDenseMultivariateModularPolynomial evaluate(int, const Symbol* syms, const sfixn* xs) const {
537  return a;
538  }
539 
540  /**
541  * Evaluate f(x)
542  *
543  * @param syms: Vector of Symbols to evaluate at corresponding xs
544  * @param xs: Corresponding evaluation points
545  **/
546  inline SmallPrimeFieldDistributedDenseMultivariateModularPolynomial evaluate(const std::vector<Symbol>& syms, const std::vector<sfixn>& xs) const {
548  return a;
549  }
550 
551  /**
552  * Overload operator ==
553  *
554  * @param b: A multivariate modular polynomial
555  **/
557 
558  /**
559  * Overload operator !=
560  *
561  * @param b: A multivariate modular polynomial
562  **/
564  return !(*this == b);
565  }
566 
567  /**
568  * Overload operator +
569  *
570  * @param b: A multivariate modular polynomial
571  **/
573 
574  /**
575  * Overload operator +=
576  *
577  * @param b: A multivariate modular polynomial
578  **/
580  *this = *this + b;
581  return *this;
582  }
583 
584  /**
585  * Overload operator +
586  *
587  * @param e: A constant
588  **/
591  return (r += e);
592  }
593 
595  return (f + e);
596  }
597 
598  /**
599  * Overload operator +=
600  *
601  * @param e: A constant
602  **/
604 
605  /**
606  * Overload operator -
607  *
608  * @param b: A multivariate modular polynomial
609  **/
611 
612  /**
613  * Overload operator -=
614  *
615  * @param b: A multivariate modular polynomial
616  **/
618  *this = *this - b;
619  return *this;
620  }
621 
622  /**
623  * Overload operator -
624  *
625  * @param e: A constant
626  **/
629  return (r -= e);
630  }
631 
633  return (-r + e);
634  }
635 
636  /**
637  * Overload operator -=
638  *
639  * @param e: A constant
640  **/
642 
643  /**
644  * Overload operator -, negate
645  *
646  * @param
647  **/
649 
650  /**
651  * Negate, f(-x)
652  *
653  * @param
654  **/
655  void negate();
656 
657  /**
658  * Overload operator *
659  *
660  * @param b: A multivariate modular polynomial
661  **/
663 
664  /**
665  * Overload operator *=
666  *
667  * @param b: A multivariate modular polynomial
668  **/
670  *this = *this * b;
671  return *this;
672  }
673 
674  /**
675  * Overload operator *
676  *
677  * @param e: A constant
678  **/
681  return (r *= e);
682  }
683 
685  return (f * e);
686  }
687 
688  /**
689  * Overload operator *=
690  *
691  * @param e: A constant
692  **/
694 
695  /**
696  * Overload operator ^ for exponentiation.
697  *
698  *
699  */
701  //TODO
702  std::cerr << "BPAS ERROR: SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::opeartor^ NOT YET IMPLEMENTED" << std::endl;
703  return *this;
704  }
705 
706  /**
707  * Overload operator ^ for exponentiation.
708  *
709  *
710  */
712  *this = *this ^ e;
713  return *this;
714  }
715 
716  SmallPrimeFieldDistributedDenseMultivariateModularPolynomial operator/ (const sfixn& e) const {
717  std::cerr << "BPAS ERROR: SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::operator/(sfixn) NOT YET IMPLEMENTED" << std::endl;
718  return *this;
719  }
720 
722  *this = *this / e;
723  return *this;
724  }
725  sfixn content() const {
726  std::cerr << "BPAS ERROR: SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::content NOT YET IMPLEMENTED" << std::endl;
727  return sfixn(1);
728  }
729 
731  std::cerr << "BPAS ERROR: SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::primitivePart NOT YET IMPLEMENTED" << std::endl;
732  return *this;
733  }
734 
735  void print(std::ostream& out) const;
736 
737  /**
738  * Convert *this to an expression tree
739  *
740  */
742 
744  std::cerr << "SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::operator/ NOT YET IMPLEMENTED" << std::endl;
745  //TODO
746  return *this;
747  }
748 
750  std::cerr << "SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::operator/= NOT YET IMPLEMENTED" << std::endl;
751  //TODO
752  return *this;
753  }
754 
756  std::cerr << "SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::gcd NOT YET IMPLEMENTED" << std::endl;
757  //TODO
758  return *this;
759  }
760 
761  /**
762  * Compute squarefree factorization of *this
763  */
765  std::cerr << "SmallPrimeFieldDistributedDenseMultivariateModularPolynomial::squareFree NOT YET IMPLEMENTED" << std::endl;
766  //TODO
767  std::vector<SmallPrimeFieldDistributedDenseMultivariateModularPolynomial> ret;
768  ret.push_back(*this);
769  return ret;
770  }
771 
772 };
773 
774 #endif
775 
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial & operator-=(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b)
Overload operator -=.
Definition: sdmpolynomial.h:617
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial & operator+=(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b)
Overload operator +=.
Definition: sdmpolynomial.h:579
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial derivative(const Symbol &s) const
Compute derivative.
Definition: sdmpolynomial.h:525
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial evaluate(int, const Symbol *syms, const sfixn *xs) const
Evaluate f(x)
Definition: sdmpolynomial.h:535
void print(std::ostream &out) const
Print the Ring element.
A multivariate polynomial with coefficients in a small prime field using a dense representation.
Definition: sdmpolynomial.h:22
An abstract class defining the interface of a GCD domain.
Definition: BPASGCDDomain.hpp:14
bool isOne() const
Is polynomial 1.
Definition: sdmpolynomial.h:219
sfixn coefficient(int v, const int *d) const
Get a coefficient.
Definition: sdmpolynomial.h:401
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial(Symbol x, sfixn m)
Construct with a variable name such that f(x) = x;.
Definition: sdmpolynomial.h:114
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial operator*(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b) const
Overload operator *.
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b)
Copy constructor.
Definition: sdmpolynomial.h:132
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial & operator*=(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b)
Overload operator *=.
Definition: sdmpolynomial.h:669
Factors< SmallPrimeFieldDistributedDenseMultivariateModularPolynomial > squareFree() const
Compute squarefree factorization of *this.
Definition: sdmpolynomial.h:764
An ExpressionTree encompasses various forms of data that can be expressed generically as a binary tre...
Definition: ExpressionTree.hpp:17
void setRingVariables(const std::vector< Symbol > &xs)
Set variable names.
Definition: sdmpolynomial.h:476
~SmallPrimeFieldDistributedDenseMultivariateModularPolynomial()
Deconstructor.
Definition: sdmpolynomial.h:148
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial operator+(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b) const
Overload operator +.
ExpressionTree convertToExpressionTree() const
Convert *this to an expression tree.
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial unitCanonical(SmallPrimeFieldDistributedDenseMultivariateModularPolynomial *u=NULL, SmallPrimeFieldDistributedDenseMultivariateModularPolynomial *v=NULL) const
Obtain the unit normal (a.k.a canonical associate) of an element.
Definition: sdmpolynomial.h:276
int numberOfRingVariables() const
Get the number of variables in this polynomial ring.
Definition: sdmpolynomial.h:311
void zero()
Zero polynomial.
Definition: sdmpolynomial.h:210
void setCoefficient(int v, const int *d, const sfixn &val)
Set a coefficient.
Definition: sdmpolynomial.h:424
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial(int v, int *ds, sfixn m)
Constructor with number of variables and terms.
Definition: sdmpolynomial.h:85
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial derivative(const Symbol &s, int k) const
Return k-th derivative.
Definition: sdmpolynomial.h:515
void differentiate(const Symbol &s)
Convert current object to its derivative.
Definition: sdmpolynomial.h:505
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial & operator=(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b)
Overload operator =.
Definition: sdmpolynomial.h:160
bool operator==(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b) const
Overload operator ==.
void differentiate(const Symbol &s, int k)
Convert current object to its k-th derivative.
Definition: sdmpolynomial.h:498
A simple data structure for encapsulating a collection of Factor elements.
Definition: Factors.hpp:95
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial()
Constructor using a default prime.
Definition: sdmpolynomial.h:50
bool isZero() const
Is a zero polynomial.
Definition: sdmpolynomial.h:197
Integer numberOfTerms() const
Get the number of non-zero terms.
Definition: sdmpolynomial.h:320
sfixn leadingCoefficient() const
Get the leading coefficient.
Definition: sdmpolynomial.h:374
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial evaluate(const std::vector< Symbol > &syms, const std::vector< sfixn > &xs) const
Evaluate f(x)
Definition: sdmpolynomial.h:546
An arbitrary-precision Integer.
Definition: Integer.hpp:22
bool isNegativeOne() const
Is polynomial -1.
Definition: sdmpolynomial.h:243
std::vector< Symbol > ringVariables() const
Get variable names.
Definition: sdmpolynomial.h:464
bool operator!=(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &b) const
Overload operator !=.
Definition: sdmpolynomial.h:563
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial(sfixn m)
Constructor with the field.
Definition: sdmpolynomial.h:67
An encapsulation of a mathematical symbol.
Definition: Symbol.hpp:23
void negativeOne()
Set polynomial to -1.
Definition: sdmpolynomial.h:256
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial & operator^=(long long int e)
Overload operator ^ for exponentiation.
Definition: sdmpolynomial.h:711
Integer degree() const
Total degree.
Definition: sdmpolynomial.h:339
int numberOfVariables() const
Get the number of variables.
Definition: sdmpolynomial.h:304
int isConstant() const
Is a constant.
Definition: sdmpolynomial.h:267
void setCoefficient(int k, const sfixn &val)
Set a coefficient.
Definition: sdmpolynomial.h:451
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial operator/(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &p) const
Exact division.
Definition: sdmpolynomial.h:743
mpz_class getCharacteristic() const override
The characteristic of this ring class.
Definition: sdmpolynomial.h:189
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial & operator/=(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &p)
Exact division assignment.
Definition: sdmpolynomial.h:749
int size() const
Get the size of the polynomial.
Definition: sdmpolynomial.h:332
Integer degree(const Symbol &x) const
Get a partial degree of variable x.
Definition: sdmpolynomial.h:350
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial operator^(long long int e) const
Overload operator ^ for exponentiation.
Definition: sdmpolynomial.h:700
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial operator-() const
Overload operator -, negate.
SmallPrimeFieldDistributedDenseMultivariateModularPolynomial gcd(const SmallPrimeFieldDistributedDenseMultivariateModularPolynomial &p) const
Get GCD of *this and other.
Definition: sdmpolynomial.h:755
void one()
Set polynomial to 1.
Definition: sdmpolynomial.h:232