My Project
Poly.h
Go to the documentation of this file.
1 #ifndef POLYCPP_HEADER
2 #define POLYCPP_HEADER
3 #include "kernel/mod2.h"
4 #include "IIntvec.h"
5 #include "coeffs/numbers.h"
6 #include "Number.h"
7 #include "kernel/polys.h"
8 #include "polys/monomials/ring.h"
9 
10 
11 #include <boost/shared_ptr.hpp>
12 
13 #include <vector>
14 #include <exception>
15 using std::exception;
16 
17 #define BOOST_DISABLE_THREADS
18 
19 class DifferentDomainException: public std::exception
20 {
21 
22 };
24 {
25  public:
26  static const bool handleErrors=true;
27  static void handleDifferentRing(ring r, ring s)
28  {
29  PrintS("throwing");
31  }
32 };
33 
34 //PolyImpl is a 08/15 poly wrapper
35 //Poly wraps around PolyImpl with reference counting using boost
37 {
38  public:
39  static const bool handleErrors=false;
40  static void handleDifferentRing(ring r, ring s)
41  {}
42 };
44 class PolyImpl
45 {
46  template <poly_variant,class,class> friend class PolyBase;
47  //friend class PolyBase<POLY_VARIANT_RING,Poly,TrivialErrorHandler>;
48  //friend class PolyBase<POLY_VARIANT_MODUL,Vector, TrivialErrorHandler>;
49  //friend class PolyBase<POLY_VARIANT_MODUL>;
50  friend class Poly;
51  friend class Vector;
52  //friend class Number;
53  protected:
54  poly getInternalReference() const
55  {
56  return p;
57  }
58  public:
59  ring getRing() const
60  {
61  return r.get();
62  }
63  friend inline bool operator==(const Poly& p1, const Poly& p2);
64  friend inline bool operator==(const Vector& p1, const Vector& p2);
65  friend PolyImpl operator+(const PolyImpl& p1, const PolyImpl& n2);
66  friend PolyImpl operator-(const PolyImpl& p1, const PolyImpl& n2);
67  friend PolyImpl operator/(const PolyImpl& p1, const PolyImpl& n2);
68  friend PolyImpl operator*(const PolyImpl& p1, const PolyImpl& n2);
69  friend bool operator==(const PolyImpl& p1, const PolyImpl& n2);
70  friend PolyImpl operator+(const PolyImpl& p1, int n2);
71  friend PolyImpl operator-(const PolyImpl& p1, int n2);
72  friend PolyImpl operator/(const PolyImpl& p1, int n2);
73  friend PolyImpl operator*(const PolyImpl& p1, int n2);
74  friend bool operator==(const PolyImpl& p1, int n2);
76  {
77  return Number(p->coef,r.get());
78  }
80  {
81  //durch Reihenfolge Selbstzuweisungen berücksichtigt
82  if (this==&p2) return *this;
83  poly pc=p_Copy(p2.p,p2.r.get());
84  if(r!=NULL)
85  p_Delete(&p,r.get());
86  r=p2.r;
87  p=pc;
88  return *this;
89  }
91  {
92  PolyImpl t(*this);
93  t.p=p_Copy(p,r.get());
94  t.p=p_Neg(t.p,r.get());
95  return t;
96  }
98  {
99  if (r!=p2.r)
100  {
101  WerrorS("not the same ring");
102  return *this;
103  }
104  if (this==&p2)
105  {
106  number two=n_Init(2,r.get()->cf);
107  p_Mult_nn(p,two,r.get());
108  return *this;
109  }
110  p=p_Add_q(p,p_Copy(p2.p,p2.r.get()),r.get());
111 
112  return *this;
113  }
115  {
116  if (r!=p2.r)
117  {
118  WerrorS("not the same ring");
119  return *this;
120  }
121  if (this==&p2)
122  {
123  poly pc=p_Copy(p,r.get());
124  p=p_Mult_q(p,p2.p,r.get());
125  return *this;
126  }
127  p=p_Mult_q(p,p_Copy(p2.p,p2.r.get()),r.get());
128  return *this;
129  }
131  {
132  if (r!=n.r)
133  {
134  WerrorS("not the same ring");
135  return *this;
136  }
137  p=p_Mult_nn(p,n.n,r.get());
138  return *this;
139  }
141  {
142  if (r!=p2.r)
143  {
144  WerrorS("not the same ring");
145  return *this;
146  }
147  if (this==&p2)
148  {
149  p_Delete(&p,r.get());
150  p=NULL;
151  return *this;
152  }
153  poly pc=p_Copy(p2.p,p2.r.get());
154  pc=p_Neg(pc,r.get());
155  p=p_Add_q(p,pc,r.get());
156  return *this;
157  }
159  {
160  p_Delete(&p,r.get());
161  p=p_ISet(n,r.get());
162  return *this;
163  }
165  {
166  r=currRing;
167  p=NULL;
168  }
169  PolyImpl(const PolyImpl & p)
170  {
171  r=p.r;
172  this->p=p_Copy(p.p,r.get());
173  }
174  PolyImpl(poly p, intrusive_ptr<ip_sring> r)
175  {
176  this->p=p_Copy(p,r.get());
177  this->r=r;
178  }
179  PolyImpl(poly p, intrusive_ptr<ip_sring> r,int)
180  {
181  this->p=p;
182  this->r=r;
183  }
184  PolyImpl(int n, intrusive_ptr<ip_sring> r)
185  {
186  this->p=p_ISet(n,r.get());
187  this->r=r;
188  }
189  PolyImpl(const Number & n)
190  {
191  r=n.r.get();
192  this->p=p_NSet(n_Copy(n.n,r.get()->cf),r.get());
193  }
194  explicit PolyImpl(int n)
195  {
196  r=currRing;
197  this->p=p_ISet(n,r.get());
198  }
199  void print()
200  {
201  p_Write(p,r.get(),r.get());
202  }
203  virtual ~PolyImpl()
204  {
205  if (r!=NULL)
206  p_Delete(&p,r.get());
207  }
208  protected:
209  poly p;
210  intrusive_ptr<ip_sring> r;
211 };
212 
213 inline PolyImpl operator+(const PolyImpl &p1, const PolyImpl& p2)
214 {
215  PolyImpl erg(p1);
216  erg+=p2;
217  return erg;
218 }
219 inline PolyImpl operator*(const PolyImpl &p1, const PolyImpl& p2)
220 {
221  PolyImpl erg(p1);
222  erg*=p2;
223  return erg;
224 }
225 inline PolyImpl operator-(const PolyImpl &p1, const PolyImpl& p2)
226 {
227  PolyImpl erg(p1);
228  erg-=p2;
229  return erg;
230 }
231 inline PolyImpl operator+(const PolyImpl &p1, int p2)
232 {
233  PolyImpl erg(p1);
234  erg+=PolyImpl(p2,p1.r.get());
235  return erg;
236 }
237 inline PolyImpl operator*(const PolyImpl &p1, int p2)
238 {
239  PolyImpl erg(p1);
240  erg*=PolyImpl(p2,p1.r.get());
241  return erg;
242 }
243 inline PolyImpl operator-(const PolyImpl &p1, int p2)
244 {
245  PolyImpl erg(p1);
246  erg-=PolyImpl(p2,p1.r);
247  return erg;
248 }
249 inline PolyImpl operator+(int p1, const PolyImpl& p2)
250 {
251  PolyImpl erg(p2);
252  return erg+=PolyImpl(p1,p2.getRing());
253 }
254 inline PolyImpl operator*(int p1, const PolyImpl& p2)
255 {
256  PolyImpl erg(p2);
257  return erg*=PolyImpl(p1,p2.getRing());
258 }
259 
260 using namespace boost;
261 
262 template<class T> class ConstTermReference
263 {
264  private:
265  ring r;
266  poly t;
267  public:
268  operator T() const
269  {
270  return T(p_Head(t,r),r);
271  }
272  ConstTermReference(poly p, ring r)
273  {
274  this->t=p;
275  this->r=r;
276  }
277  bool isConstant() const
278  {
279  return p_LmIsConstant(t,r);
280  }
281 };
282 
283 template<class T> class PolyInputIterator:
284 public std::iterator<std::input_iterator_tag,T,int, shared_ptr<const T>,ConstTermReference<T> >
285 {
286  private:
287  poly t;
288  ring r;
289  public:
291  {
292  return t2.t==t;
293  }
295  {
296  return t2.t!=t;
297  }
298  PolyInputIterator(poly p, ring r)
299  {
300  t=p;
301  this->r=r;
302  }
304  {
305  t=it.t;
306  r=it.r;
307  }
309  {
310  t=t->next;
311  return *this;
312  }
314  {
315  PolyInputIterator it(*this);
316  ++(*this);
317  return it;
318  }
320  {
321  return ConstTermReference<T> (t,r);
322  }
323  shared_ptr<const T> operator->()
324  {
325  return shared_ptr<const T>(new T(p_Head(t,r),r,0));
326  }
327 };
328 
329 template<poly_variant variant, class create_type_input, class error_handle_traits> class PolyBase
330 {
331  private:
333  public:
334  poly as_poly() const
335  {
336  return p_Copy(ptr->p,ptr->getRing());
337  }
338  template<class T> void checkIsSameRing(T& p)
339  {
340  if (error_handle_traits::handleErrors)
341  {
342  if (p.getRing()!=this->getRing())
343  {
344  error_handle_traits::handleDifferentRing(this->getRing(),
345  p.getRing()
346  );
347  }
348  }
349  }
350  typedef create_type_input create_type;
353  {
354  int nvars=rVar(ptr->r.get());
355  Intvec res(nvars);
356  for(int i=0;i<nvars;i++)
357  {
358  res[i]=p_GetExp(ptr->p,i+1,ptr->getRing());
359  }
360  return res;
361  }
363  {
364  if (!ptr.unique())
365  {
366  ptr.reset(new PolyImpl(*ptr));
367  }
368  }
369  void print() const
370  {
371  ptr->print();
372  }
373  //* resource managed by Singular
374  char* c_string() const
375  {
376  return p_String(ptr->p,ptr->getRing(),ptr->getRing());
377  }
378  PolyBase(ring r=currRing):ptr(new PolyImpl((poly) NULL,r))
379  { }
380  PolyBase(const char* c, ring r=currRing):ptr(new PolyImpl((poly)NULL,r))
381  {
382  //p_Read takes no const so do
383  char* cp=(char*) omAlloc((strlen(c)+1)*sizeof(char));
384  strcpy(cp,c);
385  p_Read(cp,ptr->p,r);
386  omfree(cp);
387  }
388  PolyBase(const PolyBase&p):ptr(p.ptr){
389  }
390 
391 
392 
394  checkIsSameRing(p2);
395  copy_on_write();
396  *ptr += *p2.ptr;
397 
398  return *this;
399  }
400  PolyBase& operator*=(const Poly & p2);
402  copy_on_write();
403  *ptr *=n;
404 
405  return *this;
406  }
407  /* void print(){
408  StringSetS("");
409  write();
410  PrintS(StringAppendS(""));
411  }*/
412  virtual ~PolyBase(){}
413  PolyBase(poly p, ring r):ptr(new PolyImpl(p_Copy(p,r),r)){
414  }
415  PolyBase(poly p, ring r,int):ptr(new PolyImpl(p,r,0)){
416  }
417  /*Poly(Poly& p){
418  ptr=p.ptr;
419  }*/
420 
422  return PolyInputIterator<create_type>(ptr->p,ptr->getRing());
423  }
425  return PolyInputIterator<create_type>(NULL, ptr->getRing());
426  }
427  ring getRing() const{
428  return ptr->getRing();
429  }
430  int lmTotalDegree() const{
431  return pTotaldegree(ptr->p);
432  }
434  return ptr->leadCoef();
435  }
437  create_type erg(*this);
438  erg*=Number(-1,ptr->getRing());
439  return erg;
440  }
441  protected:
442 
443  PolyBase(PolyImpl& impl):ptr(&impl){
444 
445  }
447  return ptr->getInternalReference();
448  }
449  protected:
450 
451  shared_ptr<PolyImpl> ptr;
452 
453 };
454 
455 class Poly: public PolyBase<POLY_VARIANT_RING, Poly, MyErrorHandler>{
456  private:
458  friend class Vector;
460  public:
461 
462  Poly(ring r=currRing):Base ((poly)NULL,r,0){
463  }
464  Poly(int n, ring r=currRing):Base(*(new PolyImpl(n,r))){
465 
466  }
467  Poly(const char* c, ring r=currRing):Base(c,r){
468 
469  }
470  Poly(const Base& p):Base(p){
471  }
472 
473  Poly(const Number& n):Base(*(new PolyImpl(n))){
474 
475  }
476  Poly(poly p, ring r):Base(p,r){
477 
478  }
479  Poly(poly p, ring r, int):Base(p,r,0){
480  }
481  Poly(const std::vector<int>& v, ring r=currRing):Base(*(new PolyImpl((poly) NULL,r))){
482  unsigned int i;
483  int s=v.size();
484  poly p=p_ISet(1,r);
485  for(i=0;i<v.size();i++){
486  pSetExp(p,i+1,v[i]);
487  }
488  pSetm(p);
489  ptr.reset(new PolyImpl(p,r));
490  }
491  /* Poly& operator+=(const Number& n){
492  Poly p2(n);
493  ((PolyBase<POLY_VARIANT_RING, Poly>&) (*this))+=p2;
494  return *this;
495  }*/
496  Poly& operator+=(const Poly& p ){
497 
498  ((Base&)*this)+=p;
499  return *this;
500  }
501  Poly& operator+=(const Base& p ){
502 
503  ((Base&)*this)+=p;
504  return *this;
505  }
506  friend inline bool operator==(const Poly& p1, const Poly& p2);
507 
508 };
509 class Vector: public PolyBase<POLY_VARIANT_MODUL, Vector, MyErrorHandler>{
510  private:
512  public:
513 
514  Vector(ring r=currRing):Base ((poly)NULL,r,0){
515  }
516  Vector(int n, ring r=currRing):Base(*(new PolyImpl(n,r))){
517 
518  }
519  Vector(const char* c, ring r=currRing):Base(c,r){
520 
521  }
522  Vector(const Base& p):Base(p){
523  }
524 
525 
526  Vector(poly p, ring r):Base(p,r){
527 
528  }
529  Vector(poly p, ring r, int):Base(p,r,0){
530  }
531  Vector(std::vector<int> v, ring r=currRing):Base(*(new PolyImpl((poly) NULL,r))){
532  unsigned int i;
533  int s=v.size();
534  poly p=p_ISet(1,r);
535  for(i=0;i<v.size();i++){
536  pSetExp(p,i+1,v[i]);
537  }
538  pSetm(p);
539  ptr.reset(new PolyImpl(p,r));
540  }
541  /* Poly& operator+=(const Number& n){
542  Poly p2(n);
543  ((PolyBase<POLY_VARIANT_MODUL, Poly>&) (*this))+=p2;
544  return *this;
545  }*/
547 
548  ((Base&)*this)+=p;
549  return *this;
550  }
551  Vector& operator+=(const Base& p ){
552 
553  ((Base&)*this)+=p;
554  return *this;
555  }
556  friend inline bool operator==(const Vector& p1, const Vector& p2);
557 };
558 
559 //typedef Poly PolyBase<POLY_VARIANT_RING>::create_type;
560 /*template <poly_variant v, class c> inline PolyBase<v> operator+(const PolyBase<v,c>& p1, const PolyBase<v,c>& p2){
561  PolyImpl* res=new PolyImpl(*p1.ptr);
562  *res+=*p2.ptr;
563  return(PolyBase<v,c>(*res));
564  }*/
565 /*template <poly_variant v> inline PolyBase<v> operator*(const PolyBase<v>& p1, const PolyBase<v>& p2){
566  PolyImpl* res=new PolyImpl(*p1.ptr);
567  *res *= *p2.ptr;
568  return(PolyBase<v> (*res));
569  }*/
570 /*template <class c> inline PolyBase<POLY_VARIANT_MODUL> operator*(const PolyBase<POLY_VARIANT_MODUL>& p1, const Number& n){
571  PolyBase<POLY_VARIANT_MODUL> erg(p1);
572  erg*=n;
573  return erg;
574  }*/
575 inline Poly operator*(const Poly& p, const Poly& p2){
576  Poly erg=p;
577  erg*=p2;
578  return erg;
579 }
580 inline Vector operator*(const Number& n, const Vector& v){
581  Vector res=v;
582  res*=n;
583  return res;
584 }
585 
586 //assumes monomials commute with numbers
587 template <poly_variant variant, class create_type, class error_traits>
589  operator*
590  (const Number& n,
592 {
594  erg*=n;
595  return erg;
596 }
597 
598 inline Vector operator*(const Poly& p, const Vector& v){
599  Vector res(v);
600  res*=p;
601  return res;
602 }
603 inline Poly operator+(const Poly& p1, const Number& n){
604  Poly f(p1);
605  f+=n;
606  return f;
607  }
608 inline bool operator==(const Poly& p1, const Poly& p2){
609  ring r1=p1.getRing();
610  ring r2=p2.getRing();
611  if (r1!=r2) return false;
612  return p_EqualPolys(p1.ptr->p,p2.ptr->p,r1);
613 }
614 inline bool operator==(const Vector& p1, const Vector& p2){
615  ring r1=p1.getRing();
616  ring r2=p2.getRing();
617  if (r1!=r2) return false;
618  return p_EqualPolys(p1.ptr->p,p2.ptr->p,r1);
619 }
620 template <poly_variant variant, class create_type,class error_traits>
622  operator+
625 {
627  erg+=b2;
628  return erg;
629 }
630 inline Vector unitVector(int i,ring r=currRing){
631  poly p=p_ISet(1,r);
632  p_SetComp(p,i,r);
633  return Vector(p,r,0);
634 }
635 inline Poly operator*(const Number& n, const Poly & p){
636  Poly res=p;
637  res*=n;
638  return res;
639 }
640 template <poly_variant variant, class create_type, class error_traits>
641 
644  copy_on_write();
645  *ptr *= *p2.ptr;
646 
647  return *this;
648  }
649 #endif
@ POLY_VARIANT_MODUL
Definition: Number.h:27
TrivialErrorHandler MyErrorHandler
Definition: Poly.h:43
PolyImpl operator-(const PolyImpl &p1, const PolyImpl &p2)
Definition: Poly.h:225
bool operator==(const Poly &p1, const Poly &p2)
Definition: Poly.h:608
Vector unitVector(int i, ring r=currRing)
Definition: Poly.h:630
PolyImpl operator+(const PolyImpl &p1, const PolyImpl &p2)
Definition: Poly.h:213
PolyImpl operator*(const PolyImpl &p1, const PolyImpl &p2)
Definition: Poly.h:219
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4078
FILE * f
Definition: checklibs.c:9
bool isConstant() const
Definition: Poly.h:277
ConstTermReference(poly p, ring r)
Definition: Poly.h:272
static void handleDifferentRing(ring r, ring s)
Definition: Poly.h:27
static const bool handleErrors
Definition: Poly.h:26
Definition: IIntvec.h:6
Definition: Number.h:34
intrusive_ptr< ip_sring > r
Definition: Number.h:218
number n
Definition: Number.h:217
Definition: Poly.h:330
PolyBase(PolyImpl &impl)
Definition: Poly.h:443
void checkIsSameRing(T &p)
Definition: Poly.h:338
PolyBase & operator*=(Number n)
Definition: Poly.h:401
PolyBase(poly p, ring r)
Definition: Poly.h:413
Intvec leadExp()
Definition: Poly.h:352
PolyBase & operator+=(const PolyBase &p2)
Definition: Poly.h:393
ring getRing() const
Definition: Poly.h:427
int lmTotalDegree() const
Definition: Poly.h:430
PolyInputIterator< create_type > end()
Definition: Poly.h:424
create_type operator-()
Definition: Poly.h:436
poly getInternalReference()
Definition: Poly.h:446
PolyBase(poly p, ring r, int)
Definition: Poly.h:415
virtual ~PolyBase()
Definition: Poly.h:412
char * c_string() const
Definition: Poly.h:374
PolyBase(ring r=currRing)
Definition: Poly.h:378
create_type_input create_type
Definition: Poly.h:350
PolyBase< variant, create_type_input, error_handle_traits > ThisType
Definition: Poly.h:332
poly as_poly() const
Definition: Poly.h:334
void copy_on_write()
Definition: Poly.h:362
Number leadCoef()
Definition: Poly.h:433
PolyInputIterator< create_type > begin()
Definition: Poly.h:421
PolyBase & operator*=(const Poly &p2)
Definition: Poly.h:643
void print() const
Definition: Poly.h:369
PolyBase(const PolyBase &p)
Definition: Poly.h:388
PolyInputIterator< create_type > iterator
Definition: Poly.h:351
shared_ptr< PolyImpl > ptr
Definition: Poly.h:451
PolyBase(const char *c, ring r=currRing)
Definition: Poly.h:380
Definition: Poly.h:45
PolyImpl(int n, intrusive_ptr< ip_sring > r)
Definition: Poly.h:184
PolyImpl(int n)
Definition: Poly.h:194
intrusive_ptr< ip_sring > r
Definition: Poly.h:210
PolyImpl(const Number &n)
Definition: Poly.h:189
Number leadCoef()
Definition: Poly.h:75
ring getRing() const
Definition: Poly.h:59
friend bool operator==(const PolyImpl &p1, int n2)
PolyImpl(poly p, intrusive_ptr< ip_sring > r)
Definition: Poly.h:174
friend PolyImpl operator+(const PolyImpl &p1, const PolyImpl &n2)
Definition: Poly.h:213
friend bool operator==(const Poly &p1, const Poly &p2)
Definition: Poly.h:608
PolyImpl(const PolyImpl &p)
Definition: Poly.h:169
friend PolyImpl operator*(const PolyImpl &p1, const PolyImpl &n2)
Definition: Poly.h:219
void print()
Definition: Poly.h:199
PolyImpl & operator=(const PolyImpl &p2)
Definition: Poly.h:79
poly p
Definition: Poly.h:209
PolyImpl()
Definition: Poly.h:164
friend PolyImpl operator/(const PolyImpl &p1, const PolyImpl &n2)
PolyImpl & operator=(int n)
Definition: Poly.h:158
friend bool operator==(const PolyImpl &p1, const PolyImpl &n2)
virtual ~PolyImpl()
Definition: Poly.h:203
PolyImpl operator-()
Definition: Poly.h:90
PolyImpl & operator*=(const PolyImpl &p2)
Definition: Poly.h:114
PolyImpl(poly p, intrusive_ptr< ip_sring > r, int)
Definition: Poly.h:179
PolyImpl & operator-=(const PolyImpl &p2)
Definition: Poly.h:140
PolyImpl & operator+=(const PolyImpl &p2)
Definition: Poly.h:97
poly getInternalReference() const
Definition: Poly.h:54
PolyImpl & operator*=(const Number &n)
Definition: Poly.h:130
friend PolyImpl operator/(const PolyImpl &p1, int n2)
bool operator==(const PolyInputIterator &t2)
Definition: Poly.h:290
PolyInputIterator operator++(int)
Definition: Poly.h:313
PolyInputIterator(const PolyInputIterator &it)
Definition: Poly.h:303
PolyInputIterator & operator++()
Definition: Poly.h:308
bool operator!=(const PolyInputIterator &t2)
Definition: Poly.h:294
PolyInputIterator(poly p, ring r)
Definition: Poly.h:298
const ConstTermReference< T > operator*()
Definition: Poly.h:319
shared_ptr< const T > operator->()
Definition: Poly.h:323
static void handleDifferentRing(ring r, ring s)
Definition: Poly.h:40
static const bool handleErrors
Definition: Poly.h:39
Definition: Poly.h:509
Vector(poly p, ring r)
Definition: Poly.h:526
Vector(int n, ring r=currRing)
Definition: Poly.h:516
Vector(const char *c, ring r=currRing)
Definition: Poly.h:519
Vector & operator+=(const Base &p)
Definition: Poly.h:551
Vector(const Base &p)
Definition: Poly.h:522
Vector(ring r=currRing)
Definition: Poly.h:514
PolyBase< POLY_VARIANT_MODUL, Vector, MyErrorHandler > Base
Definition: Poly.h:511
Vector(poly p, ring r, int)
Definition: Poly.h:529
Vector & operator+=(const Vector &p)
Definition: Poly.h:546
Vector(std::vector< int > v, ring r=currRing)
Definition: Poly.h:531
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:448
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:535
const CanonicalForm int s
Definition: facAbsFact.cc:51
CanonicalForm res
Definition: facAbsFact.cc:60
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
void WerrorS(const char *s)
Definition: feFopen.cc:24
STATIC_VAR jList * T
Definition: janet.cc:30
#define omfree(addr)
Definition: omAllocDecl.h:237
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:12
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297
const char * p_Read(const char *st, poly &rc, const ring r)
Definition: p_polys.cc:1370
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1469
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4508
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1105
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:934
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1112
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:342
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:245
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition: p_polys.h:858
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:467
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:1021
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:322
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:956
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:899
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
Compatibility layer for legacy polynomial operations (over currRing)
static long pTotaldegree(poly p)
Definition: polys.h:282
#define pSetm(p)
Definition: polys.h:271
#define pSetExp(p, i, v)
Definition: polys.h:42
void PrintS(const char *s)
Definition: reporter.cc:284
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592
Definition: janet.h:15
Poly(const Number &n)
Definition: Poly.h:473
Poly(const char *c, ring r=currRing)
Definition: Poly.h:467
Poly(int n, ring r=currRing)
Definition: Poly.h:464
Poly(ring r=currRing)
Definition: Poly.h:462
Poly(poly p, ring r, int)
Definition: Poly.h:479
Poly(const std::vector< int > &v, ring r=currRing)
Definition: Poly.h:481
Poly(poly p, ring r)
Definition: Poly.h:476
Poly & operator+=(const Base &p)
Definition: Poly.h:501
Poly(const Base &p)
Definition: Poly.h:470
Poly & operator+=(const Poly &p)
Definition: Poly.h:496
PolyBase< POLY_VARIANT_RING, Poly, MyErrorHandler > Base
Definition: Poly.h:457