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 444 of file shiftgb.cc.

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

Definition at line 377 of file shiftgb.cc.

378 {
379  /* investigate only the leading monomial of p in currRing */
380  if ( pIsConstant(p) ) return(1);
381  if (lV <= 0) return(0);
382  /* returns 1 iff p is in V */
383  /* that is in each block up to a certain one there is only one nonzero exponent */
384  /* lV = the length of V = the number of orig vars */
385  int *e = (int *)omAlloc0((currRing->N+1)*sizeof(int));
386  int b = (int)((currRing->N +lV-1)/lV); /* the number of blocks */
387  //int b = (int)(currRing->N)/lV;
388  int *B = (int *)omAlloc0((b+1)*sizeof(int)); /* the num of elements in a block */
389  pGetExpV(p,e);
390  int i,j;
391  for (j=1; j<=b; j++)
392  {
393  /* we go through all the vars */
394  /* by blocks in lV vars */
395  for (i=(j-1)*lV + 1; i<= j*lV; i++)
396  {
397  if (e[i]) B[j] = B[j]+1;
398  }
399  }
400  // j = b;
401  // while ( (!B[j]) && (j>=1)) j--;
402  for (j=b; j>=1; j--)
403  {
404  if (B[j]!=0) break;
405  }
406  /* do not need e anymore */
407  freeT(e, currRing->N);
408 
409  if (j==0) goto ret_true;
410 // {
411 // /* it is a zero exp vector, which is in V */
412 // freeT(B, b);
413 // return(1);
414 // }
415  /* now B[j] != 0 and we test place-squarefreeness */
416  for (; j>=1; j--)
417  {
418  if (B[j]!=1)
419  {
420  freeT(B, b);
421  return(0);
422  }
423  }
424  ret_true:
425  freeT(B, b);
426  return(1);
427 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
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 460 of file shiftgb.cc.

461 {
462  /* for poly in lmCR/tailTR presentation */
463  /* the below situation (commented out) might happen! */
464 // if (r == currRing)
465 // {
466 // "Current ring is not expected in toInsert";
467 // return(0);
468 // }
469  /* compute the number of insertions */
470  int i = p_mLastVblock(p, lV, currRing);
471  if (pNext(p) != NULL)
472  {
473  i = si_max(i, p_LastVblock(pNext(p), lV, r) );
474  }
475  // i = uptodeg - i +1;
476  i = uptodeg - i;
477  // p_wrp(p,currRing,r); Print("----i:%d",i); PrintLn();
478  return(i);
479 }
int p_mLastVblock(poly p, int lV, const ring r)
Definition: shiftgb.cc:306
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:288
int p_LastVblock ( poly  p,
int  lV,
const ring  r 
)

Definition at line 288 of file shiftgb.cc.

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

Definition at line 265 of file shiftgb.cc.

266 {
267  /* returns the number of maximal block */
268  /* appearing among the monomials of p */
269  /* the 0th block is the 1st one */
270 
271  /* p is like TObject: lm in currRing = r, tail in tailRing */
274 
275  int ans = p_mLastVblock(p, lV, r); // Block of LM
276  poly q = pNext(p);
277  int ansnew = 0;
278  while (q != NULL)
279  {
280  ansnew = p_mLastVblock(q, lV, strat->tailRing);
281  ans = si_max(ans,ansnew);
282  pIter(q);
283  }
284  /* do not need to delete q */
285  return(ans);
286 }
int p_mLastVblock(poly p, int lV, const ring r)
Definition: shiftgb.cc:306
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
polyrec * poly
Definition: hilb.h:10
#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:343
#define pNext(p)
Definition: monomials.h:43
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
polyrec * poly
Definition: hilb.h:10
#define NULL
Definition: omList.c:10
poly p_mLPshift(poly p, int sh, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:94
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
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
polyrec * poly
Definition: hilb.h:10
#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:343
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
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
int p_mLastVblock ( poly  p,
int  lV,
const ring  r 
)

Definition at line 306 of file shiftgb.cc.

307 {
308  /* for a monomial p, returns the number of the last block */
309  /* where a nonzero exponent is sitting */
310  if (p_LmIsConstant(p,r))
311  {
312  return(0);
313  }
314  int *e=(int *)omAlloc0((r->N+1)*sizeof(int));
315  p_GetExpV(p,e,r);
316  int j,b;
317  j = r->N;
318  while ( (!e[j]) && (j>=1) ) j--;
319  if (j==0)
320  {
321 #ifdef PDEBUG
322  PrintS("pmLastVblock: unexpected zero exponent vector\n");
323 #endif
324  return(j);
325  }
326  b = (int)((j+lV-1)/lV); /* the number of the block, >=1 */
327  freeT(e,r->N);
328  return (b);
329 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
return P p
Definition: myNF.cc:203
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1448
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:954
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:306
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
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:236
#define p_GetComp(p, r)
Definition: monomials.h:72
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1448
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1456
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
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 'n'
Definition: coeffs.h:451
#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
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly p_mShrink ( poly  p,
int  lV,
const ring  r 
)

Definition at line 529 of file shiftgb.cc.

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

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

Definition at line 481 of file shiftgb.cc.

483 {
484  /* p is like TObject: lm in currRing = r, tail in tailRing */
485  /* proc shrinks the poly p in ring r */
486  /* lV = the length of V = the number of orig vars */
487  /* check assumes/exceptions */
488  /* r->N is a multiple of lV */
489 
490  if (p==NULL) return(p);
491 
494 
495  poly q = NULL;
496  poly s = p_mShrink(p, lV, r); // lm in currRing
497  poly pp = pNext(p);
498 
499  while (pp != NULL)
500  {
501  // q = p_Add_q(q, p_mShrink(pp,uptodeg,lV,strat->tailRing),strat->tailRing);
502  q = p_Add_q(q, p_mShrink(pp,lV,strat->tailRing),strat->tailRing);
503  pIter(pp);
504  }
505  pNext(s) = q;
506  return(s);
507 }
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:529
poly pp
Definition: myNF.cc:296
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
#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:343
#define pNext(p)
Definition: monomials.h:43
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
int pFirstVblock ( poly  p,
int  lV 
)

Definition at line 331 of file shiftgb.cc.

332 {
333  /* returns the number of maximal block */
334  /* appearing among the monomials of p */
335  /* the 0th block is the 1st one */
336  poly q = p; //p_Copy(p,currRing); /* need it ? */
337  int ans = 0;
338  int ansnew = 0;
339  while (q!=NULL)
340  {
341  ansnew = pmFirstVblock(q,lV);
342  ans = si_min(ans,ansnew);
343  pIter(q);
344  }
345  /* do not need to delete q */
346  return(ans);
347 }
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
polyrec * poly
Definition: hilb.h:10
#define NULL
Definition: omList.c:10
int pmFirstVblock(poly p, int lV)
Definition: shiftgb.cc:349
int pLastVblock ( poly  p,
int  lV 
)

Definition at line 222 of file shiftgb.cc.

223 {
224  /* returns the number of maximal block */
225  /* appearing among the monomials of p */
226  /* the 0th block is the 1st one */
227  poly q = p; //p_Copy(p,currRing); /* need it ? */
228  int ans = 0;
229  int ansnew = 0;
230  while (q!=NULL)
231  {
232  ansnew = pmLastVblock(q,lV);
233  ans = si_max(ans,ansnew);
234  pIter(q);
235  }
236  /* do not need to delete q */
237  return(ans);
238 }
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
polyrec * poly
Definition: hilb.h:10
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
#define NULL
Definition: omList.c:10
int pmLastVblock(poly p, int lV)
Definition: shiftgb.cc:240
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  /* int version: returns TRUE if it was successful */
174  return(q);
175 }
poly pmLPshift(poly p, int sh, int uptodeg, int lV)
Definition: shiftgb.cc:177
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
polyrec * poly
Definition: hilb.h:10
#define NULL
Definition: omList.c:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
int pmFirstVblock ( poly  p,
int  lV 
)

Definition at line 349 of file shiftgb.cc.

350 {
351  if (pIsConstantPoly(p))
352  {
353  return(int(0));
354  }
355  /* for a monomial p, returns the number of the first block */
356  /* where a nonzero exponent is sitting */
357  int *e=(int *)omAlloc0((currRing->N+1)*sizeof(int));
358  pGetExpV(p,e);
359  int j,b;
360  j = 1;
361  while ( (!e[j]) && (j<=currRing->N-1) ) j++;
362  if (j==currRing->N + 1)
363  {
364 #ifdef PDEBUG
365  PrintS("pmFirstVblock: unexpected zero exponent vector\n");
366 #endif
367  return(j);
368  }
369  b = (int)(j/lV)+1; /* the number of the block, 1<= N <= currRing->N */
370  return (b);
371 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
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 240 of file shiftgb.cc.

241 {
242  /* for a monomial p, returns the number of the last block */
243  /* where a nonzero exponent is sitting */
244  if (pIsConstantPoly(p))
245  {
246  return(int(0));
247  }
248  int *e=(int *)omAlloc0((currRing->N+1)*sizeof(int));
249  pGetExpV(p,e);
250  int j,b;
251  j = currRing->N;
252  while ( (!e[j]) && (j>=1) ) j--;
253  freeT(e, currRing->N);
254  if (j==0)
255  {
256 #ifdef PDEBUG
257  PrintS("pmLastVblock: unexpected zero exponent vector\n");
258 #endif
259  return(j);
260  }
261  b = (int)(j/lV) + 1; /* the number of the block, >=1 */
262  return (b);
263 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
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 177 of file shiftgb.cc.

178 {
179  /* TODO: use a shortcut with p_ version */
180  /* pm is a monomial */
181 
182  if (sh == 0) return(p); /* the zero shift */
183 
184  if (sh < 0 )
185  {
186 #ifdef PDEBUG
187  PrintS("pmLPshift: negative shift requested\n");
188 #endif
189  return(NULL); /* violation, 2check */
190  }
191 
192  int L = pmLastVblock(p,lV);
193  if (L+sh-1 > uptodeg)
194  {
195 #ifdef PDEBUG
196  PrintS("pmLPshift: too big shift requested\n");
197 #endif
198  return(NULL); /* violation, 2check */
199  }
200  int *e=(int *)omAlloc0((currRing->N+1)*sizeof(int));
201  int *s=(int *)omAlloc0((currRing->N+1)*sizeof(int));
202  pGetExpV(p,e);
203  number c = pGetCoeff(p);
204  int j;
205  for (j=1; j<=currRing->N; j++)
206  {
207  if (e[j]==1)
208  {
209  s[j + (sh*lV)] = e[j]; /* actually 1 */
210  }
211  }
212  poly m = pOne();
213  pSetExpV(m,s);
214  /* pSetm(m); */ /* done in the pSetExpV */
215  /* think on the component */
216  pSetCoeff0(m,c);
217  freeT(e, currRing->N);
218  freeT(s, currRing->N);
219  return(m);
220 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
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
polyrec * poly
Definition: hilb.h:10
#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
int pmLastVblock(poly p, int lV)
Definition: shiftgb.cc:240
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int poly_isInV ( poly  p,
int  lV 
)

Definition at line 429 of file shiftgb.cc.

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