My Project
kInline.h
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 /***************************************************************
5  * File: kInline.h
6  * Purpose: implementation of std related inline routines
7  * Author: obachman (Olaf Bachmann)
8  * Created: 8/00
9  *******************************************************************/
10 #ifndef KINLINE_H
11 #define KINLINE_H
12 
13 #if !defined(NO_KINLINE) || defined(KUTIL_CC)
14 /* this file is a header file with inline routines,
15  * if NO_KINLINE is not defined (AND ONLY THEN!)
16  * otherwise it is an part of kutil.cc and a source file!
17  * (remark: NO_KINLINE is defined by KDEBUG, i.e. in the debug version)
18  */
19 
20 #include "omalloc/omalloc.h"
21 #include "misc/options.h"
23 #include "polys/kbuckets.h"
24 
25 #include "kernel/polys.h"
26 
27 #ifdef HAVE_SHIFTBBA
28 #include "polys/shiftop.h"
29 #endif
30 
31 
32 #define HAVE_TAIL_BIN
33 // This doesn't really work, fixme, if necessary
34 // #define HAVE_LM_BIN
35 
36 
37 
39 {
40  assume(i>= 0 && i<=sl);
41  assume(S_2_R[i] >= 0 && S_2_R[i] <= tl);
42  TObject* TT = R[S_2_R[i]];
43  assume(TT != NULL && TT->p == S[i]);
44  return TT;
45 }
46 
48 {
49  if (i >= 0 && i <= sl)
50  {
51  int sri= S_2_R[i];
52  if ((sri >= 0) && (sri <= tl))
53  {
54  TObject* t = R[sri];
55  if ((t != NULL) && (t->p == S[i]))
56  return t;
57  }
58  // last but not least, try kFindInT
59  sri = kFindInT(S[i], T, tl);
60  if (sri >= 0)
61  return &(T[sri]);
62  }
63  return NULL;
64 }
65 
67 {
68  if (tailRing == currRing)
69  return kNoether;
70  else
71  {
72  assume((kNoether == NULL && t_kNoether == NULL) ||
73  (kNoether != NULL && t_kNoether != NULL));
74  return t_kNoether;
75  }
76 }
77 
78 /***************************************************************
79  *
80  * Operation on TObjects
81  *
82  ***************************************************************/
83 
85 {
86  TSet T = (TSet)omAlloc0(setmaxT*sizeof(TObject));
87  for (int i=setmaxT-1; i>=0; i--)
88  {
89  T[i].tailRing = currRing;
90  T[i].i_r = -1;
91  }
92  return T;
93 }
94 
96 {
97  return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
98 }
99 
100 KINLINE unsigned long* initsevT()
101 {
102  return (unsigned long*) omAlloc0(setmaxT*sizeof(unsigned long));
103 }
104 
105 // initialization
106 KINLINE void sTObject::Set(ring r)
107 {
108  tailRing = r;
109 }
111 {
112  memset(this, 0, sizeof(sTObject));
113  i_r = -1;
114  Set(r);
115 }
117 {
118  Init(r);
119 }
120 KINLINE void sTObject::Set(poly p_in, ring r)
121 {
122  if (r != currRing)
123  {
124  assume(r == tailRing);
125 #ifdef HAVE_SHIFTBBA
126  if (r->isLPring)
127  {
128  shift = si_max(p_mFirstVblock(p_in, r) - 1, 0);
129  if (!shift) p_Test(p_in, r);
130  }
131  else
132 #endif
133  {
134  p_Test(p_in, r);
135  }
136  t_p = p_in;
137  }
138  else
139  {
140 #ifdef HAVE_SHIFTBBA
141  if (currRing->isLPring)
142  {
143  shift = si_max(p_mFirstVblock(p_in, currRing) - 1, 0);
144  if (!shift) p_Test(p_in, currRing);
145  }
146  else
147 #endif
148  {
149  p_Test(p_in, currRing);
150  }
151  p = p_in;
152  }
153  pLength=::pLength(p_in);
154 }
155 
156 KINLINE sTObject::sTObject(poly p_in, ring r)
157 {
158  Init(r);
159  Set(p_in, r);
160 }
161 
162 KINLINE void sTObject::Set(poly p_in, ring c_r, ring t_r)
163 {
164  if (c_r != t_r)
165  {
166  assume(c_r == currRing && t_r == tailRing);
167 #ifdef HAVE_SHIFTBBA
168  if (c_r->isLPring)
169  {
170  shift = si_max(p_mFirstVblock(p_in, c_r) - 1, 0);
171  if (!shift) p_Test(p_in, currRing);
172  }
173  else
174 #endif
175  {
176  p_Test(p_in, currRing);
177  }
178  p = p_in;
179  pLength=::pLength(p_in);
180  }
181  else
182  {
183  Set(p_in, c_r);
184  }
185 }
186 
187 KINLINE sTObject::sTObject(poly p_in, ring c_r, ring t_r)
188 {
189  Init(t_r);
190  Set(p_in, c_r, t_r);
191 }
192 
194 {
195  *this = *T;
196  if (copy)
197  {
198  if (t_p != NULL)
199  {
200  t_p = p_Copy(t_p, tailRing);
202  }
203  else
204  {
205  p = p_Copy(p, currRing);
206  }
207  }
208 }
209 
211 {
212  if (t_p != NULL)
213  {
214  p_Delete(&t_p, tailRing);
215  if (p != NULL)
216  p_LmFree(p, currRing);
217  }
218  else
219  {
220  p_Delete(&p, currRing);
221  }
222 }
223 
225 {
226  p = NULL;
227  t_p = NULL;
228  ecart = 0;
229  length = 0;
230  pLength = 0;
231  FDeg = 0;
233 }
234 
236 {
237  if (t_p != NULL)
238  {
239  t_p = p_Copy(t_p, tailRing);
240  if (p != NULL) /* and t_p!=NULL*/
241  {
242  p = p_LmInit(p, currRing);
244  pNext(p) = pNext(t_p);
245  }
246  }
247  else
248  {
249  p = p_Copy(p, currRing);
250  }
251 }
252 
254 {
255  if (p == NULL && t_p != NULL)
257 
258  return p;
259 }
261 {
262  if (t_p == NULL)
263  {
264  if (p != NULL && tailRing != currRing)
265  {
267  return t_p;
268  }
269  return p;
270  }
271  return t_p;
272 }
274 {
275  assume(r == tailRing || r == currRing);
276  if (r == currRing)
277  return GetLmCurrRing();
278 
279  if (t_p == NULL && p != NULL)
281 
282  return t_p;
283 }
284 
285 KINLINE void sTObject::GetLm(poly &p_r, ring &r_r) const
286 {
287  if (t_p != NULL)
288  {
289  p_r = t_p;
290  r_r = tailRing;
291  }
292  else
293  {
294  p_r = p;
295  r_r = currRing;
296  }
297 }
298 
300 {
301  return (p == NULL && t_p == NULL);
302 }
303 
305 {
306  if (pLength <= 0) pLength = ::pLength(p != NULL ? p : t_p);
307  return pLength;
308 }
309 
311 {
312  if (p == NULL && t_p != NULL)
314 }
315 
317 {
318  assume(p != NULL || t_p != NULL);
319  if (t_p != NULL) return pNext(t_p);
320  return pNext(p);
321 }
322 
323 // Iterations
325 {
326  assume(p != NULL || t_p != NULL);
327  if (t_p != NULL)
328  {
330  if (p != NULL)
331  {
332  p_LmFree(p, currRing);
333  p = NULL;
334  }
335  }
336  else
337  {
339  }
341 }
342 
343 
344 // arithmetic
346 {
347  if (t_p != NULL)
348  {
349  t_p = p_Mult_nn(t_p, n, tailRing);
350  if (p != NULL) pSetCoeff0(p, pGetCoeff(t_p));
351  }
352  else
353  {
354  p = p_Mult_nn(p, n, currRing, tailRing);
355  }
356 }
357 
359 {
360  if (t_p != NULL)
361  {
362  pNormalize(t_p);
363  if (p != NULL) pSetCoeff0(p, pGetCoeff(t_p));
364  }
365  else
366  {
367  pNormalize(p);
368  }
370 }
371 
373 {
374  if (bucket != NULL)
376 }
377 
379 {
380  if (t_p != NULL)
381  {
383  if (p != NULL) pSetCoeff0(p, pGetCoeff(t_p));
384  }
385  else
386  {
388  }
389 }
390 
391 KINLINE void
392 sTObject::ShallowCopyDelete(ring new_tailRing, omBin new_tailBin,
393  pShallowCopyDeleteProc p_shallow_copy_delete,
394  BOOLEAN set_max)
395 {
396  if (new_tailBin == NULL) new_tailBin = new_tailRing->PolyBin;
397  if (t_p != NULL)
398  {
399  t_p = p_shallow_copy_delete(t_p, tailRing, new_tailRing, new_tailBin);
400  if (p != NULL)
401  pNext(p) = pNext(t_p);
402  if (new_tailRing == currRing)
403  {
404  if (p == NULL) p = t_p;
405  else p_LmFree(t_p, tailRing);
406  t_p = NULL;
407  }
408  }
409  else if (p != NULL) /* && t_p==NULL */
410  {
411  if (pNext(p) != NULL)
412  {
413  pNext(p) = p_shallow_copy_delete(pNext(p),
414  tailRing, new_tailRing, new_tailBin);
415  }
416  if (new_tailRing != currRing)
417  {
418  t_p = k_LmInit_currRing_2_tailRing(p, new_tailRing);
419  pNext(t_p) = pNext(p);
420  }
421  }
422  if (max_exp != NULL)
423  {
424  max_exp = p_shallow_copy_delete(max_exp,tailRing,new_tailRing,new_tailBin);
425  }
426  else if (set_max && pNext(t_p) != NULL)
427  {
428  max_exp = p_GetMaxExpP(pNext(t_p), new_tailRing);
429  }
430  tailRing = new_tailRing;
431 }
432 
434 {
435  if (p != NULL) return p_FDeg(p, currRing);
436  return tailRing->pFDeg(t_p, tailRing);
437 }
439 {
440  if (p != NULL) return p_Totaldegree(p, currRing);
441  return p_Totaldegree(t_p,tailRing);
442 }
444 {
445  FDeg = this->pFDeg();
446  return FDeg;
447 }
449 {
450  assume(FDeg == this->pFDeg());
451  return FDeg;
452 }
454 {
455  return tailRing->pLDeg(GetLmTailRing(), &length, tailRing);
456 }
458 {
459  FDeg = this->pFDeg();
460  long d = this->pLDeg();
461  ecart = d - FDeg;
462  return d;
463 }
464 
465 //extern void pCleardenom(poly p);
466 // extern void pNorm(poly p);
467 
468 // manipulations
470 {
471  assume(p != NULL);
473  if ((TEST_OPT_CONTENTSB) && (!is_ring))
474  {
475  number n;
476  if (t_p != NULL)
477  {
480  }
481  else
482  {
484  }
485  if (!nIsOne(n))
486  {
488  denom->n=nInvers(n);
489  denom->next=DENOMINATOR_LIST;
490  DENOMINATOR_LIST=denom;
491  }
492  nDelete(&n);
493  }
494  #ifdef HAVE_RINGS
495  else if (is_ring)
496  {
497  number c;
498  if (t_p != NULL)
499  c=pGetCoeff(t_p);
500  else
501  c=pGetCoeff(p);
502  const coeffs C=tailRing->cf;
503  number u=n_GetUnit(c,C);
504 
505  if (t_p != NULL)
506  {
507  if (!n_IsOne(u,C))
508  {
509  number uInv = n_Invers(u, C);
510  t_p=p_Mult_nn(t_p,uInv,tailRing);
511  n_Delete(&uInv,C);
512  }
514  {
515  t_p = p_Neg(t_p,tailRing);
516  }
518  }
519  else
520  {
521  if (!n_IsOne(u,C))
522  {
523  number uInv = n_Invers(u, C);
524  p=p_Mult_nn(p,uInv,tailRing);
525  n_Delete(&uInv,C);
526  }
527  if(!n_GreaterZero(pGetCoeff(p),tailRing->cf))
528  {
529  p = p_Neg(p,tailRing);
530  }
531  }
532  n_Delete(&u,C);
533  }
534  #endif
535  else
536  {
537  if (t_p != NULL)
538  {
541  }
542  else
543  {
545  }
546  }
547 }
548 
550 {
551  assume(p != NULL);
552  if (t_p != NULL)
553  {
555  if (!n_GreaterZero(pGetCoeff(t_p),tailRing->cf))
556  {
557  t_p=p_Neg (t_p,tailRing);
558  }
560  }
561  else
562  {
564  if (!n_GreaterZero(pGetCoeff(p),currRing->cf))
565  {
566  p=p_Neg (p,currRing);
567  }
568  }
569 }
570 
571 KINLINE void sTObject::pNorm() // pNorm seems to be a _bad_ method name...
572 {
573  assume(p != NULL);
574  if (! is_normalized)
575  {
576  p_Norm(p, currRing);
577  if (t_p != NULL)
580  }
581 }
582 
583 
584 
585 /***************************************************************
586  *
587  * Operation on LObjects
588  *
589  ***************************************************************/
590 // Initialization
592 {
593  sTObject::Clear();
594  sev = 0;
595 }
596 // Initialization
598 {
600  if (bucket != NULL)
602 }
603 
605 {
606  memset(this, 0, sizeof(sLObject));
607  i_r1 = -1;
608  i_r2 = -1;
609  i_r = -1;
610  Set(r);
611 }
613 {
614  Init(r);
615 }
616 KINLINE sLObject::sLObject(poly p_in, ring r)
617 {
618  Init(r);
619  Set(p_in, r);
620 }
621 
622 KINLINE sLObject::sLObject(poly p_in, ring c_r, ring t_r)
623 {
624  Init(t_r);
625  Set(p_in, c_r, t_r);
626 }
627 
629 {
630  if (bucket == NULL)
631  {
632  unsigned l = GetpLength();
633  if (use_bucket && (l > 1))
634  {
635  poly tp = GetLmTailRing();
636  assume(l == ::pLength(tp));
638  kBucketInit(bucket, pNext(tp), l-1);
639  pNext(tp) = NULL;
640  if (p != NULL) pNext(p) = NULL;
641  pLength = 0;
642  }
643  }
644 }
645 
646 KINLINE void sLObject::SetLmTail(poly lm, poly p_tail, int p_Length, int use_bucket, ring _tailRing)
647 {
648 
649  Set(lm, _tailRing);
650  if (use_bucket)
651  {
652  bucket = kBucketCreate(_tailRing);
653  kBucketInit(bucket, p_tail, p_Length);
654  pNext(lm) = NULL;
655  pLength = 0;
656  }
657  else
658  {
659  pNext(lm) = p_tail;
660  pLength = p_Length + 1;
661  }
662 }
663 
665 {
666  if (bucket != NULL)
667  {
669  }
670  else
671  {
672  poly _p = (t_p != NULL ? t_p : p);
673  assume(_p != NULL);
674  pNext(_p) = __p_Mult_nn(pNext(_p), n, tailRing);
675  }
676 }
677 
679  poly spNoether)
680 {
681  if (bucket != NULL)
682  {
683  kBucket_Minus_m_Mult_p(bucket, m, q, &lq, spNoether);
684  }
685  else
686  {
687  if (lq<=0) lq= ::pLength(q);
688  poly _p = (t_p != NULL ? t_p : p);
689  assume(_p != NULL);
690 
691  int lp=pLength-1;
692  pNext(_p) = p_Minus_mm_Mult_qq( pNext(_p), m, q, lp, lq,
693  spNoether, tailRing );
694  pLength=lp+1;
695 // tailRing->p_Procs->p_Minus_mm_Mult_qq(pNext(_p), m, q, shorter,spNoether, tailRing, last);
696 // pLength += lq - shorter;
697  }
698 }
699 
701 {
703  if (bucket != NULL)
704  {
705  poly _p = kBucketExtractLm(bucket);
706  if (_p == NULL)
707  {
709  p = t_p = NULL;
710  return;
711  }
712  Set(_p, tailRing);
713  }
714  else
715  {
716  pLength--;
717  }
718 }
719 
721 {
722  poly ret = GetLmTailRing();
723  poly pn;
724 
725  assume(p != NULL || t_p != NULL);
726 
727  if (bucket != NULL)
728  {
729  pn = kBucketExtractLm(bucket);
730  if (pn == NULL)
732  }
733  else
734  {
735  pn = pNext(ret);
736  }
737  pLength--;
738  pNext(ret) = NULL;
739  if (p != NULL && t_p != NULL)
740  p_LmFree(p, currRing);
741 
742  Set(pn, tailRing);
743  return ret;
744 }
745 
747 {
748  //kTest_L(this);
749  poly tp = GetLmTailRing();
750  assume(tp != NULL);
751 
752  if (bucket != NULL)
753  {
754  kBucketClear(bucket, &pNext(tp), &pLength);
756  pLength++;
757  }
758  return tp;
759 }
760 
761 
763 {
764  //kTest_L(this);
765  if (p == NULL)
766  {
768  ((lmBin!=NULL)?lmBin:currRing->PolyBin));
769  FDeg = pFDeg();
770  }
771  else if ((lmBin != NULL) && (lmBin != currRing->PolyBin))
772  {
774  FDeg = pFDeg();
775  }
776 
777  if (bucket != NULL)
778  {
781  pLength++;
782  if (t_p != NULL) pNext(t_p) = pNext(p);
783  }
784  //kTest_L(this);
785  return p;
786 }
787 
788 KINLINE void
789 sLObject::ShallowCopyDelete(ring new_tailRing,
790  pShallowCopyDeleteProc p_shallow_copy_delete)
791 {
792  if (bucket != NULL)
793  kBucketShallowCopyDelete(bucket, new_tailRing, new_tailRing->PolyBin,
794  p_shallow_copy_delete);
795  sTObject::ShallowCopyDelete(new_tailRing,
796  new_tailRing->PolyBin,p_shallow_copy_delete,
797  FALSE);
798 }
799 
801 {
802  if (t_p != NULL)
803  {
805  }
806  else
807  {
809  }
810 }
811 
813 {
814  if (bucket != NULL)
815  {
817  kBucket_pt new_bucket = kBucketCreate(tailRing);
818  kBucketInit(new_bucket,
819  p_Copy(bucket->buckets[i], tailRing),
820  bucket->buckets_length[i]);
821  bucket = new_bucket;
822  if (t_p != NULL) pNext(t_p) = NULL;
823  if (p != NULL) pNext(p) = NULL;
824  }
825  TObject::Copy();
826 }
827 
829 {
830  poly tp = GetLmTailRing();
831  assume(tp != NULL);
832  if (bucket != NULL)
833  {
835  pNext(tp) = bucket->buckets[i];
836  long ldeg = tailRing->pLDeg(tp, &length, tailRing);
837  pNext(tp) = NULL;
838  return ldeg;
839  }
840  else
841  return tailRing->pLDeg(tp, &length, tailRing);
842 }
844 {
845  if (! deg_last || bucket != NULL) return sLObject::pLDeg();
846 
847  long ldeg;
848  ldeg = tailRing->pLDeg(GetLmTailRing(), &length, tailRing);
849 #ifndef SING_NDEBUG
850  if ( pLength == 0)
853 #else
854  pLength=length;
855 #endif
856  return ldeg;
857 }
858 
860 {
861  FDeg = this->pFDeg();
862  long d = this->pLDeg();
863  ecart = d - FDeg;
864  return d;
865 }
867 {
868  FDeg = this->pFDeg();
869  long d = this->pLDeg(use_last);
870  ecart = d - FDeg;
871  return d;
872 }
874 {
875  if (bucket == NULL)
876  return sTObject::GetpLength();
878  return bucket->buckets_length[i] + 1;
879 }
881 {
882  if (length_pLength)
883  {
884  length = this->GetpLength();
885  }
886  else
887  this->pLDeg();
888  return length;
889 }
891 {
892  poly tp = GetLmTailRing();
893  assume(tp != NULL);
894  if (bucket != NULL)
895  {
897  pNext(tp) = bucket->buckets[i];
898  long m = p_MinComp(tp, tailRing);
899  pNext(tp) = NULL;
900  return m;
901  }
902  else
903  return p_MinComp(tp, tailRing);
904 }
906 {
907  poly pp;
908  ring r;
909  GetLm(pp, r);
910  assume(pp != NULL);
911  return p_GetComp(pp, r);
912 }
913 
915 {
916  memset(this, 0, sizeof(*this));
917  memcpy(this, &t, sizeof(sTObject));
918  return *this;
919 }
920 
922 {
923  if (p1 == NULL) return NULL;
924  if (i_r1 == -1) i_r1 = kFindInT(p1, s->T, s->tl);
925  assume(i_r1 >= 0 && i_r1 <= s->tl);
926  TObject* T = s->R[i_r1];
927  assume(T->p == p1);
928  return T;
929 }
930 
932 {
933  if (p1 == NULL) return NULL;
934  assume(p2 != NULL);
935  if (i_r2 == -1) i_r2 = kFindInT(p2, strat->T, strat->tl);
936  assume(i_r2 >= 0 && i_r2 <= strat->tl);
937  TObject* T = strat->R[i_r2];
938  assume(T->p == p2);
939  return T;
940 }
941 
943  TObject* &T_1, TObject* &T_2)
944 {
945  if (p1 == NULL)
946  {
947  T_1 = NULL;
948  T_2 = NULL;
949  return;
950  }
951  assume(p1 != NULL && p2 != NULL);
952  if (i_r1 == -1) i_r1 = kFindInT(p1, strat->T, strat->tl);
953  if (i_r2 == -1) i_r2 = kFindInT(p2, strat->T, strat->tl);
954  assume(i_r1 >= 0 && i_r1 <= strat->tl);
955  assume(i_r2 >= 0 && i_r2 <= strat->tl);
956  T_1 = strat->R[i_r1];
957  T_2 = strat->R[i_r2];
958  assume(T_1->p == p1);
959  assume(T_2->p == p2);
960  return;
961 }
962 
963 /***************************************************************
964  *
965  * Conversion of polys
966  *
967  ***************************************************************/
968 
969 KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
970 {
971 
972  poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
973  pNext(t_p) = pNext(p);
974  pSetCoeff0(t_p, pGetCoeff(p));
975  return t_p;
976 }
977 
978 KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
979 {
980  poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
981  pNext(p) = pNext(t_p);
982  pSetCoeff0(p, pGetCoeff(t_p));
983  return p;
984 }
985 
986 // this should be made more efficient
987 KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
988 {
989  poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
990  p_LmFree(p, currRing);
991  return np;
992 }
993 
995 {
996  poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
997  p_LmFree(p, tailRing);
998  return np;
999 }
1000 
1001 KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing)
1002 {
1003  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
1004 }
1005 
1006 KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing)
1007 {
1008  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
1009 }
1010 
1012 {
1013  return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
1014 }
1015 
1017 {
1018  return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
1019 }
1020 
1021 /***************************************************************
1022  *
1023  * Lcm business
1024  *
1025  ***************************************************************/
1026 // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
1027 // m2 = LCM(LM(p1), LM(p2))/LM(p2)
1028 KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r,
1029  poly &m1, poly &m2, const ring m_r)
1030 {
1031  p_LmCheckPolyRing(p1, p_r);
1032  p_LmCheckPolyRing(p2, p_r);
1033 
1034  int i;
1035  long x;
1036  m1 = p_Init(m_r,m_r->PolyBin);
1037  m2 = p_Init(m_r,m_r->PolyBin);
1038 
1039  for (i = p_r->N; i; i--)
1040  {
1041  x = p_GetExpDiff(p1, p2, i, p_r);
1042  if (x > 0)
1043  {
1044  if (x > (long) m_r->bitmask) goto false_return;
1045  p_SetExp(m2,i,x, m_r);
1046  p_SetExp(m1,i,0, m_r);
1047  }
1048  else
1049  {
1050  if (-x > (long) m_r->bitmask) goto false_return;
1051  p_SetExp(m1,i,-x, m_r);
1052  p_SetExp(m2,i,0, m_r);
1053  }
1054  }
1055 
1056  p_Setm(m1, m_r);
1057  p_Setm(m2, m_r);
1058  return TRUE;
1059 
1060  false_return:
1061  p_LmFree(m1, m_r);
1062  p_LmFree(m2, m_r);
1063  m1 = m2 = NULL;
1064  return FALSE;
1065 }
1066 
1067 #ifdef HAVE_RINGS
1068 // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
1069 // m2 = LCM(LM(p1), LM(p2))/LM(p2) in tailRing
1070 // lcm = LCM(LM(p1), LM(p2)) in leadRing
1071 KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing,
1072  poly &m1, poly &m2, poly &lcm, const ring tailRing)
1073 {
1074  p_LmCheckPolyRing(p1, leadRing);
1075  p_LmCheckPolyRing(p2, leadRing);
1076 
1077  int i;
1078  int x;
1079  int e1;
1080  int e2;
1081  int s;
1082  m1 = p_Init(tailRing,tailRing->PolyBin);
1083  m2 = p_Init(tailRing,tailRing->PolyBin);
1084  lcm = p_Init(leadRing,leadRing->PolyBin);
1085 
1086  for (i = leadRing->N; i>=0; i--)
1087  {
1088  e1 = p_GetExp(p1,i,leadRing);
1089  e2 = p_GetExp(p2,i,leadRing);
1090  x = e1 - e2;
1091  if (x > 0)
1092  {
1093  p_SetExp(m2,i,x, tailRing);
1094  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1095  s = e1;
1096  }
1097  else if (x<0)
1098  {
1099  p_SetExp(m1,i,-x, tailRing);
1100  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1101  s = e2;
1102  }
1103  else
1104  s = e1; // e1==e2
1105  p_SetExp(lcm,i,s, leadRing);
1106  }
1107 
1108  p_Setm(m1, tailRing);
1109  p_Setm(m2, tailRing);
1110  p_Setm(lcm, leadRing);
1111 }
1112 #endif
1113 
1114 /***************************************************************
1115  *
1116  * Misc things
1117  *
1118  ***************************************************************/
1120 {
1121  BOOLEAN ret;
1122  number mult, rest;
1123  TObject red = *PW;
1124  red.Copy();
1125  rest = n_QuotRem(pGetCoeff(Red->p), pGetCoeff(red.p),
1126  &mult, currRing->cf);
1127  red.Mult_nn(rest);
1128 
1129  assume(PR->GetLmCurrRing() != red.GetLmCurrRing());
1130  ret = ksReducePolyLC(Red, &red, NULL, &mult);
1131  red.Delete();
1132  red.Clear();
1133 
1134  return ret;
1135 }
1136 
1138 {
1139  BOOLEAN ret;
1140  number coef;
1141 
1142  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1143  ret = ksReducePoly(Red, PW, NULL, &coef);
1144 
1145  if (!ret)
1146  {
1147  if (! n_IsOne(coef, currRing->cf))
1148  {
1149  PR->Mult_nn(coef);
1150  // HANNES: mark for Normalize
1151  }
1152  n_Delete(&coef, currRing->cf);
1153  }
1154  return ret;
1155 }
1156 
1158 {
1159  BOOLEAN ret;
1160  number coef;
1161 
1162  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1163  Red->HeadNormalize();
1164  ret = ksReducePoly(Red, PW, NULL, &coef);
1165 
1166  if (!ret)
1167  {
1168  if (! n_IsOne(coef, currRing->cf))
1169  {
1170  PR->Mult_nn(coef);
1171  // HANNES: mark for Normalize
1172  }
1173  n_Delete(&coef, currRing->cf);
1174  }
1175  return ret;
1176 }
1177 
1178 /***************************************************************
1179  *
1180  * Routines for backwards-Compatibility
1181  *
1182  *
1183  ***************************************************************/
1184 KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
1185 {
1186  LObject L(p2);
1187  TObject T(p1);
1188 
1189  ksReducePoly(&L, &T, spNoether);
1190 
1191  return L.GetLmCurrRing();
1192 }
1193 
1194 KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
1195 {
1196  LObject L(p_Copy(p2, currRing));
1197  TObject T(p1);
1198 
1199  ksReducePoly(&L, &T, spNoether);
1200 
1201  return L.GetLmCurrRing();
1202 }
1203 
1204 KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
1205 {
1206  LObject L(r);
1207  L.p1 = p1;
1208  L.p2 = p2;
1209 
1210  ksCreateSpoly(&L, spNoether);
1211  return L.GetLmCurrRing();
1212 }
1213 
1214 void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether, ring r)
1215 {
1216  LObject L(q, currRing, r);
1217  TObject T(p1, currRing, r);
1218 
1219  ksReducePolyTail(&L, &T, q2, spNoether);
1220 }
1221 
1222 KINLINE poly redtailBba (poly p,int pos,kStrategy strat,BOOLEAN normalize)
1223 {
1224  LObject L(p);
1225  return redtailBba(&L, pos, strat,FALSE, normalize);
1226 }
1227 
1229 {
1230  LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1231  return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1232 }
1233 
1234 #ifdef HAVE_RINGS
1235 KINLINE poly redtailBba_Ring (poly p,int pos,kStrategy strat)
1236 {
1237  LObject L(p, currRing, strat->tailRing);
1238  return redtailBba_Ring(&L, pos, strat);
1239 }
1240 KINLINE poly redtailBba_Z (poly p,int pos,kStrategy strat)
1241 {
1242  LObject L(p, currRing, strat->tailRing);
1243  return redtailBba_Z(&L, pos, strat);
1244 }
1245 #endif
1246 
1247 KINLINE void clearS (poly p, unsigned long p_sev, int* at, int* k,
1248  kStrategy strat)
1249 {
1250  assume(p_sev == pGetShortExpVector(p));
1251  if (strat->noClearS) return;
1252  #ifdef HAVE_RINGS
1254  {
1255  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1256  return;
1257  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1258  return;
1259  }
1260  else
1261  #endif
1262  {
1263  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1264  }
1265  deleteInS((*at),strat);
1266  (*at)--;
1267  (*k)--;
1268 }
1269 
1270 // dummy function for function pointer strat->rewCrit being usable in all
1271 // possible choices for criteria
1272 KINLINE BOOLEAN arriRewDummy(poly /*sig*/, unsigned long /*not_sevSig*/, poly /*lm*/, kStrategy /*strat*/, int /*start=0*/)
1273 {
1274  return FALSE;
1275 }
1276 
1277 #endif // defined(KINLINE) || defined(KUTIL_CC)
1278 #endif // KINLINE_H
static int si_max(const int a, const int b)
Definition: auxiliary.h:124
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
Variable x
Definition: cfModGcd.cc:4082
int p
Definition: cfModGcd.cc:4078
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
KINLINE long SetDegStuffReturnLDeg()
Definition: kInline.h:859
KINLINE void Tail_Mult_nn(number n)
Definition: kInline.h:664
int i_r1
Definition: kutil.h:193
KINLINE void Copy()
Definition: kInline.h:812
KINLINE void Delete()
Definition: kInline.h:597
KINLINE void LmDeleteAndIter()
Definition: kInline.h:700
KINLINE TObject * T_2(const skStrategy *strat)
Definition: kInline.h:931
KINLINE void PrepareRed(BOOLEAN use_bucket)
Definition: kInline.h:628
KINLINE void CanonicalizeP()
Definition: kInline.h:372
KINLINE void SetLmTail(poly lm, poly new_p, int length, int use_bucket, ring r)
Definition: kInline.h:646
KINLINE void T_1_2(const skStrategy *strat, TObject *&T_1, TObject *&T_2)
Definition: kInline.h:942
KINLINE void Normalize()
Definition: kInline.h:358
unsigned long sev
Definition: kutil.h:187
KINLINE void Init(ring tailRing=currRing)
Definition: kInline.h:604
KINLINE long MinComp()
Definition: kInline.h:890
kBucket_pt bucket
Definition: kutil.h:192
poly p2
Definition: kutil.h:188
KINLINE TObject * T_1(const skStrategy *strat)
Definition: kInline.h:921
KINLINE int GetpLength()
Definition: kInline.h:873
KINLINE int SetLength(BOOLEAN lengt_pLength=FALSE)
Definition: kInline.h:880
KINLINE void Clear()
Definition: kInline.h:591
KINLINE void Tail_Minus_mm_Mult_qq(poly m, poly qq, int lq, poly spNoether)
Definition: kInline.h:678
KINLINE void ShallowCopyDelete(ring new_tailRing, pShallowCopyDeleteProc p_shallow_copy_delete)
Definition: kInline.h:789
KINLINE poly GetTP()
Definition: kInline.h:746
KINLINE long pLDeg()
Definition: kInline.h:828
KINLINE sLObject & operator=(const sTObject &)
Definition: kInline.h:914
KINLINE void SetShortExpVector()
Definition: kInline.h:800
KINLINE void HeadNormalize()
Definition: kInline.h:378
KINLINE poly GetP(omBin lmBin=(omBin) NULL)
Definition: kInline.h:762
KINLINE sLObject(ring tailRing=currRing)
Definition: kInline.h:612
poly p1
Definition: kutil.h:188
KINLINE long Comp()
Definition: kInline.h:905
KINLINE poly LmExtractAndIter()
Definition: kInline.h:720
int i_r2
Definition: kutil.h:193
Definition: kutil.h:69
KINLINE poly GetLm(ring r)
Definition: kInline.h:273
KINLINE poly GetLmCurrRing()
Definition: kInline.h:253
KINLINE void Init(ring r=currRing)
Definition: kInline.h:110
KINLINE void Mult_nn(number n)
Definition: kInline.h:345
int length
Definition: kutil.h:79
KINLINE long SetDegStuffReturnLDeg()
Definition: kInline.h:457
KINLINE poly GetLmTailRing()
Definition: kInline.h:260
KINLINE void pCleardenom()
Definition: kInline.h:469
int ecart
Definition: kutil.h:78
KINLINE long GetpFDeg() const
Definition: kInline.h:448
KINLINE sTObject(ring tailRing=currRing)
Definition: kInline.h:116
KINLINE void ShallowCopyDelete(ring new_tailRing, omBin new_tailBin, pShallowCopyDeleteProc p_shallow_copy_delete, BOOLEAN set_max=TRUE)
Definition: kInline.h:392
KINLINE void SetLmCurrRing()
Definition: kInline.h:310
poly max_exp
Definition: kutil.h:75
char is_normalized
Definition: kutil.h:87
KINLINE long pLDeg()
Definition: kInline.h:453
KINLINE void LmDeleteAndIter()
Definition: kInline.h:324
int pLength
Definition: kutil.h:80
KINLINE long pFDeg() const
Definition: kInline.h:433
int i_r
Definition: kutil.h:81
poly p
Definition: kutil.h:73
KINLINE BOOLEAN IsNull() const
Definition: kInline.h:299
KINLINE void Set(ring r=currRing)
Definition: kInline.h:106
KINLINE void Delete()
Definition: kInline.h:210
poly t_p
Definition: kutil.h:74
ring tailRing
Definition: kutil.h:76
KINLINE int GetpLength()
Definition: kInline.h:304
KINLINE void pNorm()
Definition: kInline.h:571
KINLINE void Clear()
Definition: kInline.h:224
long FDeg
Definition: kutil.h:77
KINLINE poly Next()
Definition: kInline.h:316
int shift
Definition: kutil.h:84
KINLINE void pContent()
Definition: kInline.h:549
KINLINE long pTotalDeg() const
Definition: kInline.h:438
KINLINE long SetpFDeg()
Definition: kInline.h:443
KINLINE void Copy()
Definition: kInline.h:235
KINLINE poly kNoetherTail()
Definition: kInline.h:66
poly t_kNoether
Definition: kutil.h:330
int * S_2_R
Definition: kutil.h:342
ring tailRing
Definition: kutil.h:343
TSet T
Definition: kutil.h:326
polyset S
Definition: kutil.h:306
poly kNoether
Definition: kutil.h:329
TObject ** R
Definition: kutil.h:340
int tl
Definition: kutil.h:350
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:47
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:38
char noClearS
Definition: kutil.h:402
int sl
Definition: kutil.h:348
unsigned long * sevS
Definition: kutil.h:322
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition: coeffs.h:681
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
in Z: 1 in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that is co-prime with k i...
Definition: coeffs.h:532
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:753
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
const CanonicalForm int s
Definition: facAbsFact.cc:51
CFArray copy(const CFList &list)
write elements of list into an array
static number Copy(number a, const coeffs)
Definition: flintcf_Q.cc:202
STATIC_VAR jList * T
Definition: janet.cc:30
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:994
KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
Definition: kInline.h:1204
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
KINLINE poly redtailBba_Ring(poly p, int pos, kStrategy strat)
Definition: kInline.h:1235
void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether, ring r)
Definition: kInline.h:1214
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:987
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:969
KINLINE TSet initT()
Definition: kInline.h:84
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:1071
KINLINE int ksReducePolyTailLC_Z(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1119
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1222
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1184
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:978
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1228
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition: kInline.h:1272
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1157
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1194
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1247
KINLINE TObject ** initR()
Definition: kInline.h:95
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:1028
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1240
KINLINE int ksReducePolyTail_Z(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1137
void kBucketDeleteAndDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:223
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:521
void kBucketShallowCopyDelete(kBucket_pt bucket, ring new_tailRing, omBin new_tailBin, pShallowCopyDeleteProc p_shallow_copy_delete)
For changing the ring of the Bpoly to new_tailBin.
Definition: kbuckets.cc:535
void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, poly spNoether)
Bpoly == Bpoly - m*p; where m is a monom Does not destroy p and m assume (*l <= 0 || pLength(p) == *l...
Definition: kbuckets.cc:722
void kBucket_Mult_n(kBucket_pt bucket, number n)
Multiply Bucket by number ,i.e. Bpoly == n*Bpoly.
Definition: kbuckets.cc:598
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:216
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:493
poly kBucketExtractLm(kBucket_pt bucket)
Definition: kbuckets.cc:511
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:209
void kBucketNormalize(kBucket_pt bucket)
apply n_Normalize to all coefficients
int kBucketCanonicalize(kBucket_pt bucket)
Canonicalizes Bpoly, i.e. converts polys of buckets into one poly in one bucket: Returns number of bu...
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:458
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1185
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat)
Definition: kspoly.cc:187
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:742
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1163
VAR denominator_list DENOMINATOR_LIST
Definition: kutil.cc:84
denominator_list_s * denominator_list
Definition: kutil.h:63
TObject * TSet
Definition: kutil.h:59
denominator_list next
Definition: kutil.h:65
#define setmaxT
Definition: kutil.h:33
#define KINLINE
Definition: kutil.h:49
class sTObject TObject
Definition: kutil.h:57
class sLObject LObject
Definition: kutil.h:58
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:709
#define assume(x)
Definition: mod2.h:387
#define p_GetComp(p, r)
Definition: monomials.h:64
#define pNext(p)
Definition: monomials.h:36
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define pSetCoeff0(p, n)
Definition: monomials.h:59
The main handler for Singular numbers which are suitable for Singular polynomials.
Definition: lq.h:40
#define nDelete(n)
Definition: numbers.h:16
#define nInvers(a)
Definition: numbers.h:33
#define nIsOne(n)
Definition: numbers.h:25
#define nNormalize(n)
Definition: numbers.h:30
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define NULL
Definition: omList.c:12
omBin_t * omBin
Definition: omStructs.h:12
#define TEST_OPT_CONTENTSB
Definition: options.h:127
p_Length
Definition: p_Procs_Impl.h:123
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0,...
Definition: p_polys.cc:1134
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:3015
void p_SimpleContent(poly ph, int smax, const ring r)
Definition: p_polys.cc:2625
void p_Norm(poly p1, const ring r)
Definition: p_polys.cc:3793
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4814
void p_ProjectiveUnique(poly ph, const ring r)
Definition: p_polys.cc:3204
poly p_Last(const poly p, int &l, const ring r)
Definition: p_polys.cc:4654
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1079
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:635
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1307
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:380
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:488
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:313
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233
static poly p_LmShallowCopyDelete(poly p, const ring r)
Definition: p_polys.h:1365
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:469
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:930
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:873
static void p_LmFree(poly p, ring)
Definition: p_polys.h:683
static poly p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, int lq, const poly spNoether, const ring r)
Definition: p_polys.h:1042
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1292
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:731
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:818
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1479
#define p_Test(p, r)
Definition: p_polys.h:162
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:943
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
Compatiblity layer for legacy polynomial operations (over currRing)
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
#define pNormalize(p)
Definition: polys.h:317
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:721
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:44
#define rField_is_Ring(R)
Definition: ring.h:486
int p_mFirstVblock(poly p, const ring ri)
Definition: shiftop.cc:477
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026