Macros | Functions
shiftgb.cc File Reference
#include <kernel/mod2.h>
#include <polys/monomials/ring.h>
#include <kernel/polys.h>
#include <coeffs/numbers.h>
#include <kernel/ideals.h>
#include <polys/matpol.h>
#include <polys/kbuckets.h>
#include <kernel/GBEngine/kstd1.h>
#include <polys/sbuckets.h>
#include <polys/operations/p_Mult_q.h>
#include <kernel/GBEngine/kutil.h>
#include <kernel/structs.h>
#include <omalloc/omalloc.h>
#include <kernel/GBEngine/khstd.h>
#include <polys/weight.h>
#include <misc/intvec.h>
#include <kernel/GBEngine/kInline.h>
#include <kernel/combinatorics/stairc.h>
#include <kernel/GBEngine/shiftgb.h>
#include <polys/nc/sca.h>

Go to the source code of this file.

Macros

#define freeT(A, v)   omFreeSize((ADDRESS)A,(v+1)*sizeof(int))
 

Functions

poly p_LPshiftT (poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
 
poly p_LPshift (poly p, int sh, int uptodeg, int lV, const ring r)
 
poly p_mLPshift (poly p, int sh, int uptodeg, int lV, const ring r)
 
poly pLPshift (poly p, int sh, int uptodeg, int lV)
 
poly pmLPshift (poly p, int sh, int uptodeg, int lV)
 
int pLastVblock (poly p, int lV)
 
int pmLastVblock (poly p, int lV)
 
int p_LastVblockT (poly p, int lV, kStrategy strat, const ring r)
 
int p_LastVblock (poly p, int lV, const ring r)
 
int p_mLastVblock (poly p, int lV, const ring r)
 
int pFirstVblock (poly p, int lV)
 
int pmFirstVblock (poly p, int lV)
 
int isInV (poly p, int lV)
 
int poly_isInV (poly p, int lV)
 
int ideal_isInV (ideal I, int lV)
 
int itoInsert (poly p, int uptodeg, int lV, const ring r)
 
poly p_ShrinkT (poly p, int lV, kStrategy strat, const ring r)
 
poly p_Shrink (poly p, int lV, const ring r)
 
poly p_mShrink (poly p, int lV, const ring r)
 

Macro Definition Documentation

#define freeT (   A,
  v 
)    omFreeSize((ADDRESS)A,(v+1)*sizeof(int))

Definition at line 39 of file shiftgb.cc.

Function Documentation

int ideal_isInV ( ideal  I,
int  lV 
)

Definition at line 445 of file shiftgb.cc.

446 {
447  /* tests whether each polynomial of an ideal I lies in in V */
448  int i;
449  int s = IDELEMS(I)-1;
450  for(i = 0; i <= s; i++)
451  {
452  if ( !poly_isInV(I->m[i],lV) )
453  {
454  return(0);
455  }
456  }
457  return(1);
458 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int poly_isInV(poly p, int lV)
Definition: shiftgb.cc:430
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
int isInV ( poly  p,
int  lV 
)

Definition at line 378 of file shiftgb.cc.

379 {
380  /* investigate only the leading monomial of p in currRing */
381  if ( pIsConstant(p) ) return(1);
382  if (lV <= 0) return(0);
383  /* returns 1 iff p is in V */
384  /* that is in each block up to a certain one there is only one nonzero exponent */
385  /* lV = the length of V = the number of orig vars */
386  int *e = (int *)omAlloc0((currRing->N+1)*sizeof(int));
387  int b = (int)((currRing->N +lV-1)/lV); /* the number of blocks */
388  //int b = (int)(currRing->N)/lV;
389  int *B = (int *)omAlloc0((b+1)*sizeof(int)); /* the num of elements in a block */
390  pGetExpV(p,e);
391  int i,j;
392  for (j=1; j<=b; j++)
393  {
394  /* we go through all the vars */
395  /* by blocks in lV vars */
396  for (i=(j-1)*lV + 1; i<= j*lV; i++)
397  {
398  if (e[i]) B[j] = B[j]+1;
399  }
400  }
401  // j = b;
402  // while ( (!B[j]) && (j>=1)) j--;
403  for (j=b; j>=1; j--)
404  {
405  if (B[j]!=0) break;
406  }
407  /* do not need e anymore */
408  freeT(e, currRing->N);
409 
410  if (j==0) goto ret_true;
411 // {
412 // /* it is a zero exp vector, which is in V */
413 // freeT(B, b);
414 // return(1);
415 // }
416  /* now B[j] != 0 and we test place-squarefreeness */
417  for (; j>=1; j--)
418  {
419  if (B[j]!=1)
420  {
421  freeT(B, b);
422  return(0);
423  }
424  }
425  ret_true:
426  freeT(B, b);
427  return(1);
428 }
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
#define freeT(A, v)
Definition: shiftgb.cc:39
b *CanonicalForm B
Definition: facBivar.cc:51
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
const poly b
Definition: syzextra.cc:213
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int itoInsert ( poly  p,
int  uptodeg,
int  lV,
const ring  r 
)

Definition at line 461 of file shiftgb.cc.

462 {
463  /* for poly in lmCR/tailTR presentation */
464  /* the below situation (commented out) might happen! */
465 // if (r == currRing)
466 // {
467 // "Current ring is not expected in toInsert";
468 // return(0);
469 // }
470  /* compute the number of insertions */
471  int i = p_mLastVblock(p, lV, currRing);
472  if (pNext(p) != NULL)
473  {
474  i = si_max(i, p_LastVblock(pNext(p), lV, r) );
475  }
476  // i = uptodeg - i +1;
477  i = uptodeg - i;
478  // p_wrp(p,currRing,r); Print("----i:%d",i); PrintLn();
479  return(i);
480 }
int p_mLastVblock(poly p, int lV, const ring r)
Definition: shiftgb.cc:307
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int p_LastVblock(poly p, int lV, const ring r)
Definition: shiftgb.cc:289
int p_LastVblock ( poly  p,
int  lV,
const ring  r 
)

Definition at line 289 of file shiftgb.cc.

290 {
291  /* returns the number of maximal block */
292  /* appearing among the monomials of p */
293  /* the 0th block is the 1st one */
294  poly q = p; //p_Copy(p,currRing); /* need it ? */
295  int ans = 0;
296  int ansnew = 0;
297  while (q!=NULL)
298  {
299  ansnew = p_mLastVblock(q, lV, r);
300  ans = si_max(ans,ansnew);
301  pIter(q);
302  }
303  /* do not need to delete q */
304  return(ans);
305 }
int p_mLastVblock(poly p, int lV, const ring r)
Definition: shiftgb.cc:307
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
int p_LastVblockT ( poly  p,
int  lV,
kStrategy  strat,
const ring  r 
)

Definition at line 266 of file shiftgb.cc.

267 {
268  /* returns the number of maximal block */
269  /* appearing among the monomials of p */
270  /* the 0th block is the 1st one */
271 
272  /* p is like TObject: lm in currRing = r, tail in tailRing */
275 
276  int ans = p_mLastVblock(p, lV, r); // Block of LM
277  poly q = pNext(p);
278  int ansnew = 0;
279  while (q != NULL)
280  {
281  ansnew = p_mLastVblock(q, lV, strat->tailRing);
282  ans = si_max(ans,ansnew);
283  pIter(q);
284  }
285  /* do not need to delete q */
286  return(ans);
287 }
int p_mLastVblock(poly p, int lV, const ring r)
Definition: shiftgb.cc:307
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
poly p_LPshift ( poly  p,
int  sh,
int  uptodeg,
int  lV,
const ring  r 
)

Definition at line 74 of file shiftgb.cc.

75 {
76  /* assume shift takes place */
77  /* shifts the poly p from the ring r by sh */
78 
79  /* assume sh and uptodeg agree TODO check */
80 
81  if (p==NULL) return(p);
82  if (sh == 0) return(p); /* the zero shift */
83 
84  poly q = NULL;
85  poly pp = p; // do not take copies
86  while (pp!=NULL)
87  {
88  q = p_Add_q(q, p_mLPshift(pp,sh,uptodeg,lV,r),r);
89  pIter(pp);
90  }
91  return(q);
92 }
return P p
Definition: myNF.cc:203
poly pp
Definition: myNF.cc:296
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
poly p_mLPshift(poly p, int sh, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:94
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
poly p_LPshiftT ( poly  p,
int  sh,
int  uptodeg,
int  lV,
kStrategy  strat,
const ring  r 
)

Definition at line 45 of file shiftgb.cc.

46 {
47  /* assume shift takes place, shifts the poly p by sh */
48  /* p is like TObject: lm in currRing = r, tail in tailRing */
49 
50  if (p==NULL) return(p);
51 
54 
55  /* assume sh and uptodeg agree TODO check */
56 
57  if (sh == 0) return(p); /* the zero shift */
58 
59  poly q = NULL;
60  poly s = p_mLPshift(p, sh, uptodeg, lV, r); // lm in currRing
61  poly pp = pNext(p);
62 
63  while (pp != NULL)
64  {
65  q = p_Add_q(q, p_mLPshift(pp,sh,uptodeg,lV,strat->tailRing),strat->tailRing);
66  pIter(pp);
67  }
68  pNext(s) = q;
69  /* int version: returns TRUE if it was successful */
70  return(s);
71 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
poly pp
Definition: myNF.cc:296
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly p_mLPshift(poly p, int sh, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:94
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
int p_mLastVblock ( poly  p,
int  lV,
const ring  r 
)

Definition at line 307 of file shiftgb.cc.

308 {
309  /* for a monomial p, returns the number of the last block */
310  /* where a nonzero exponent is sitting */
311  if (p_LmIsConstant(p,r))
312  {
313  return(0);
314  }
315  int *e=(int *)omAlloc0((r->N+1)*sizeof(int));
316  p_GetExpV(p,e,r);
317  int j,b;
318  j = r->N;
319  while ( (!e[j]) && (j>=1) ) j--;
320  if (j==0)
321  {
322 #ifdef PDEBUG
323  PrintS("pmLastVblock: unexpected zero exponent vector\n");
324 #endif
325  return(j);
326  }
327  b = (int)((j+lV-1)/lV); /* the number of the block, >=1 */
328  freeT(e,r->N);
329  return (b);
330 }
return P p
Definition: myNF.cc:203
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1449
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:955
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
void PrintS(const char *s)
Definition: reporter.cc:294
#define freeT(A, v)
Definition: shiftgb.cc:39
const poly b
Definition: syzextra.cc:213
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly p_mLPshift ( poly  p,
int  sh,
int  uptodeg,
int  lV,
const ring  r 
)

Definition at line 94 of file shiftgb.cc.

95 {
96  /* p is a monomial from the ring r */
97 
98  if (sh == 0) return(p); /* the zero shift */
99 
100  if (sh < 0 )
101  {
102 #ifdef PDEBUG
103  PrintS("pmLPshift: negative shift requested\n");
104 #endif
105  return(NULL); /* violation, 2check */
106  }
107 
108  int L = p_mLastVblock(p,lV,r);
109  if (L+sh-1 > uptodeg)
110  {
111 #ifdef PDEBUG
112  PrintS("p_mLPshift: too big shift requested\n");
113 #endif
114  return(NULL); /* violation, 2check */
115  }
116  int *e=(int *)omAlloc0((r->N+1)*sizeof(int));
117  int *s=(int *)omAlloc0((r->N+1)*sizeof(int));
118  p_GetExpV(p,e,r);
119 
120  int j;
121  // for (j=1; j<=r->N; j++)
122  // L*lV gives the last position of the last block
123  for (j=1; j<= L*lV ; j++)
124  {
125  if (e[j]==1)
126  {
127  s[j + (sh*lV)] = e[j]; /* actually 1 */
128 #ifdef PDEBUG
129  omCheckAddr(s);
130 #endif
131  }
132 #ifdef PDEBUG
133  else
134  {
135  if (e[j]!=0)
136  {
137  // Print("p_mLPshift: ex[%d]=%d\n",j,e[j]);
138  }
139  }
140 #endif
141  }
142  poly m = p_One(r);
143  p_SetExpV(m,s,r);
144  freeT(e, r->N);
145  freeT(s, r->N);
146  /* pSetm(m); */ /* done in the pSetExpV */
147  /* think on the component and coefficient */
148  // number c = pGetCoeff(p);
149  // p_SetCoeff0(m,p_GetCoeff(p,r),r);
150  p_SetComp(m,p_GetComp(p,r),r); // component is preserved
151  p_SetCoeff0(m,n_Copy(p_GetCoeff(p,r),r->cf),r); // coeff is preserved
152  return(m);
153 }
int p_mLastVblock(poly p, int lV, const ring r)
Definition: shiftgb.cc:307
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1449
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1457
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
void PrintS(const char *s)
Definition: reporter.cc:294
#define freeT(A, v)
Definition: shiftgb.cc:39
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:452
#define p_GetCoeff(p, r)
Definition: monomials.h:57
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:68
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
polyrec * poly
Definition: hilb.h:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly p_mShrink ( poly  p,
int  lV,
const ring  r 
)

Definition at line 530 of file shiftgb.cc.

531 {
532  /* shrinks the monomial p in ring r */
533  /* lV = the length of V = the number of orig vars */
534 
535  /* check assumes/exceptions */
536  /* r->N is a multiple of lV */
537 
538  int *e = (int *)omAlloc0((r->N+1)*sizeof(int));
539  int b = (int)((r->N +lV-1)/lV); /* the number of blocks */
540  // int *B = (int *)omAlloc0((b+1)*sizeof(int)); /* the num of elements in a block */
541  int *S = (int *)omAlloc0((r->N+1)*sizeof(int)); /* the shrinked exponent */
542  p_GetExpV(p,e,r);
543  int i,j; int cnt = 1; //counter for blocks in S
544  for (j=1; j<=b; j++)
545  {
546  /* we go through all the vars */
547  /* by blocks in lV vars */
548  for (i=(j-1)*lV + 1; i<= j*lV; i++)
549  {
550  if (e[i]==1)
551  {
552  // B[j] = B[j]+1; // for control in V?
553  S[(cnt-1)*lV + (i - (j-1)*lV)] = e[i];
554  /* assuming we are in V, can interrupt here */
555  cnt++;
556  // break; //results in incomplete shrink!
557  i = j*lV; // manual break under assumption p is in V
558  }
559  }
560  }
561 #ifdef PDEBUG
562  // Print("p_mShrink: cnt = [%d], b = %d\n",cnt,b);
563 #endif
564  // cnt -1 <= b must hold!
565  // freeT(B, b);
566  poly s = p_One(r);
567  p_SetExpV(s,S,r);
568  freeT(e, r->N);
569  freeT(S, r->N);
570  /* p_Setm(s,r); // done by p_SetExpV */
571  p_SetComp(s,p_GetComp(p,r),r); // component is preserved
572  p_SetCoeff(s,p_GetCoeff(p,r),r); // coeff is preserved
573 #ifdef PDEBUG
574  // Print("p_mShrink: from "); p_wrp(p,r); Print(" to "); p_wrp(s,r); PrintLn();
575 #endif
576  return(s);
577 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1449
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1457
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define freeT(A, v)
Definition: shiftgb.cc:39
#define p_GetCoeff(p, r)
Definition: monomials.h:57
polyrec * poly
Definition: hilb.h:10
const poly b
Definition: syzextra.cc:213
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly p_Shrink ( poly  p,
int  lV,
const ring  r 
)

Definition at line 510 of file shiftgb.cc.

511 {
512  /* proc shrinks the poly p in ring r */
513  /* lV = the length of V = the number of orig vars */
514  /* check assumes/exceptions */
515  /* r->N is a multiple of lV */
516 
517  if (p==NULL) return(p);
519  poly q = NULL;
520  poly pp = p;
521 
522  while (pp != NULL)
523  {
524  q = p_Add_q(q, p_mShrink(pp,lV,r),r);
525  pIter(pp);
526  }
527  return(q);
528 }
return P p
Definition: myNF.cc:203
poly p_mShrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:530
poly pp
Definition: myNF.cc:296
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
poly p_ShrinkT ( poly  p,
int  lV,
kStrategy  strat,
const ring  r 
)

Definition at line 482 of file shiftgb.cc.

484 {
485  /* p is like TObject: lm in currRing = r, tail in tailRing */
486  /* proc shrinks the poly p in ring r */
487  /* lV = the length of V = the number of orig vars */
488  /* check assumes/exceptions */
489  /* r->N is a multiple of lV */
490 
491  if (p==NULL) return(p);
492 
495 
496  poly q = NULL;
497  poly s = p_mShrink(p, lV, r); // lm in currRing
498  poly pp = pNext(p);
499 
500  while (pp != NULL)
501  {
502  // q = p_Add_q(q, p_mShrink(pp,uptodeg,lV,strat->tailRing),strat->tailRing);
503  q = p_Add_q(q, p_mShrink(pp,lV,strat->tailRing),strat->tailRing);
504  pIter(pp);
505  }
506  pNext(s) = q;
507  return(s);
508 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
poly p_mShrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:530
poly pp
Definition: myNF.cc:296
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
int pFirstVblock ( poly  p,
int  lV 
)

Definition at line 332 of file shiftgb.cc.

333 {
334  /* returns the number of maximal block */
335  /* appearing among the monomials of p */
336  /* the 0th block is the 1st one */
337  poly q = p; //p_Copy(p,currRing); /* need it ? */
338  int ans = 0;
339  int ansnew = 0;
340  while (q!=NULL)
341  {
342  ansnew = pmFirstVblock(q,lV);
343  ans = si_min(ans,ansnew);
344  pIter(q);
345  }
346  /* do not need to delete q */
347  return(ans);
348 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
int pmFirstVblock(poly p, int lV)
Definition: shiftgb.cc:350
int pLastVblock ( poly  p,
int  lV 
)

Definition at line 223 of file shiftgb.cc.

224 {
225  /* returns the number of maximal block */
226  /* appearing among the monomials of p */
227  /* the 0th block is the 1st one */
228  poly q = p; //p_Copy(p,currRing); /* need it ? */
229  int ans = 0;
230  int ansnew = 0;
231  while (q!=NULL)
232  {
233  ansnew = pmLastVblock(q,lV);
234  ans = si_max(ans,ansnew);
235  pIter(q);
236  }
237  /* do not need to delete q */
238  return(ans);
239 }
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
int pmLastVblock(poly p, int lV)
Definition: shiftgb.cc:241
poly pLPshift ( poly  p,
int  sh,
int  uptodeg,
int  lV 
)

Definition at line 155 of file shiftgb.cc.

156 {
157  /* assume shift takes place */
158  /* shifts the poly p by sh */
159  /* deletes p */
160 
161  /* assume sh and uptodeg agree */
162 
163  if (sh == 0) return(p); /* the zero shift */
164 
165  poly q = NULL;
166  poly pp = p; // pCopy(p);
167  while (pp!=NULL)
168  {
169  q = p_Add_q(q, pmLPshift(pp,sh,uptodeg,lV),currRing);
170  pIter(pp);
171  }
172  /* delete pp? */
173  p_Delete(&p,currRing);
174  /* int version: returns TRUE if it was successful */
175  return(q);
176 }
poly pmLPshift(poly p, int sh, int uptodeg, int lV)
Definition: shiftgb.cc:178
return P p
Definition: myNF.cc:203
poly pp
Definition: myNF.cc:296
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:849
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
int pmFirstVblock ( poly  p,
int  lV 
)

Definition at line 350 of file shiftgb.cc.

351 {
352  if (pIsConstantPoly(p))
353  {
354  return(int(0));
355  }
356  /* for a monomial p, returns the number of the first block */
357  /* where a nonzero exponent is sitting */
358  int *e=(int *)omAlloc0((currRing->N+1)*sizeof(int));
359  pGetExpV(p,e);
360  int j,b;
361  j = 1;
362  while ( (!e[j]) && (j<=currRing->N-1) ) j++;
363  if (j==currRing->N + 1)
364  {
365 #ifdef PDEBUG
366  PrintS("pmFirstVblock: unexpected zero exponent vector\n");
367 #endif
368  return(j);
369  }
370  b = (int)(j/lV)+1; /* the number of the block, 1<= N <= currRing->N */
371  return (b);
372 }
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
void PrintS(const char *s)
Definition: reporter.cc:294
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
#define pIsConstantPoly(p)
return TRUE if all monomials of p are constant
Definition: polys.h:217
const poly b
Definition: syzextra.cc:213
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int pmLastVblock ( poly  p,
int  lV 
)

Definition at line 241 of file shiftgb.cc.

242 {
243  /* for a monomial p, returns the number of the last block */
244  /* where a nonzero exponent is sitting */
245  if (pIsConstantPoly(p))
246  {
247  return(int(0));
248  }
249  int *e=(int *)omAlloc0((currRing->N+1)*sizeof(int));
250  pGetExpV(p,e);
251  int j,b;
252  j = currRing->N;
253  while ( (!e[j]) && (j>=1) ) j--;
254  freeT(e, currRing->N);
255  if (j==0)
256  {
257 #ifdef PDEBUG
258  PrintS("pmLastVblock: unexpected zero exponent vector\n");
259 #endif
260  return(j);
261  }
262  b = (int)(j/lV) + 1; /* the number of the block, >=1 */
263  return (b);
264 }
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
void PrintS(const char *s)
Definition: reporter.cc:294
#define freeT(A, v)
Definition: shiftgb.cc:39
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
#define pIsConstantPoly(p)
return TRUE if all monomials of p are constant
Definition: polys.h:217
const poly b
Definition: syzextra.cc:213
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly pmLPshift ( poly  p,
int  sh,
int  uptodeg,
int  lV 
)

Definition at line 178 of file shiftgb.cc.

179 {
180  /* TODO: use a shortcut with p_ version */
181  /* pm is a monomial */
182 
183  if (sh == 0) return(p); /* the zero shift */
184 
185  if (sh < 0 )
186  {
187 #ifdef PDEBUG
188  PrintS("pmLPshift: negative shift requested\n");
189 #endif
190  return(NULL); /* violation, 2check */
191  }
192 
193  int L = pmLastVblock(p,lV);
194  if (L+sh-1 > uptodeg)
195  {
196 #ifdef PDEBUG
197  PrintS("pmLPshift: too big shift requested\n");
198 #endif
199  return(NULL); /* violation, 2check */
200  }
201  int *e=(int *)omAlloc0((currRing->N+1)*sizeof(int));
202  int *s=(int *)omAlloc0((currRing->N+1)*sizeof(int));
203  pGetExpV(p,e);
204  number c = pGetCoeff(p);
205  int j;
206  for (j=1; j<=currRing->N; j++)
207  {
208  if (e[j]==1)
209  {
210  s[j + (sh*lV)] = e[j]; /* actually 1 */
211  }
212  }
213  poly m = pOne();
214  pSetExpV(m,s);
215  /* pSetm(m); */ /* done in the pSetExpV */
216  /* think on the component */
217  pSetCoeff0(m,c);
218  freeT(e, currRing->N);
219  freeT(s, currRing->N);
220  return(m);
221 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#define pSetExpV(p, e)
Definition: polys.h:97
int m
Definition: cfEzgcd.cc:119
void PrintS(const char *s)
Definition: reporter.cc:294
#define pOne()
Definition: polys.h:286
#define freeT(A, v)
Definition: shiftgb.cc:39
#define NULL
Definition: omList.c:10
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
int pmLastVblock(poly p, int lV)
Definition: shiftgb.cc:241
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int poly_isInV ( poly  p,
int  lV 
)

Definition at line 430 of file shiftgb.cc.

431 {
432  /* tests whether the whole polynomial p in in V */
433  poly q = p;
434  while (q!=NULL)
435  {
436  if ( !isInV(q,lV) )
437  {
438  return(0);
439  }
440  q = pNext(q);
441  }
442  return(1);
443 }
return P p
Definition: myNF.cc:203
int isInV(poly p, int lV)
Definition: shiftgb.cc:378
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10