Functions | Variables
walkSupport.cc File Reference
#include <kernel/mod2.h>
#include <misc/intvec.h>
#include <misc/int64vec.h>
#include <polys/monomials/ring.h>
#include <polys/prCopy.h>
#include <polys/matpol.h>
#include <kernel/polys.h>
#include <kernel/ideals.h>
#include <kernel/groebner_walk/walkSupport.h>
#include <kernel/GBEngine/kstd1.h>
#include <string.h>
#include <math.h>

Go to the source code of this file.

Functions

int tdeg (poly p)
 
int getMaxTdeg (ideal I)
 
int getMaxPosOfNthRow (intvec *v, int n)
 
int64 getInvEps64 (ideal G, intvec *targm, int pertdeg)
 
int invEpsOk64 (ideal I, intvec *targm, int pertdeg, int64 inveps64)
 
intvecgetNthRow (intvec *v, int n)
 
int64vecgetNthRow64 (intvec *v, int n)
 
void getTaun64 (ideal G, intvec *targm, int pertdeg, int64vec **v64, int64 &i64)
 
static int64 scalarProduct64 (int64vec *a, int64vec *b)
 
ideal init64 (ideal G, int64vec *currw64)
 
BOOLEAN currwOnBorder64 (ideal G, int64vec *currw64)
 
BOOLEAN noPolysWithMoreThanTwoTerms (ideal Gw)
 
int DIFFspy (ideal G)
 
intvecDIFF (ideal G)
 
void gett64 (intvec *listw, int64vec *currw64, int64vec *targw64, int64 &tvec0, int64 &tvec1)
 
void nextt64 (ideal G, int64vec *currw64, int64vec *targw64, int64 &tvec0, int64 &tvec1)
 
int64vecnextw64 (int64vec *currw, int64vec *targw, int64 nexttvec0, int64 nexttvec1)
 
poly getNthPolyOfId (ideal I, int n)
 
intvecleadExp (poly p)
 
int64vecleadExp64 (poly p)
 
static long scalarProduct (intvec *a, intvec *b)
 
int gcd (int a, int b)
 
int64 gcd64 (int64 a, int64 b)
 
ideal idStd (ideal G)
 
ideal idInterRed (ideal G)
 
matrix matIdLift (ideal Gomega, ideal M)
 
void rCopyAndChangeA (int64vec *w)
 
int64vecrGetGlobalOrderMatrix (ring r)
 
int64vecrGetGlobalOrderWeightVec (ring r)
 
ideal sortRedSB (ideal G)
 
intvecint64VecToIntVec (int64vec *source)
 

Variables

BOOLEAN overflow_error
 

Function Documentation

◆ currwOnBorder64()

BOOLEAN currwOnBorder64 ( ideal  G,
int64vec currw64 
)

Definition at line 353 of file walkSupport.cc.

354 {
355  ideal J=init64(G,currw64);
356  int length=idealSize(J);
357  BOOLEAN res=FALSE;
358  for(int i=length; i>0; i--)
359  {
360  //if(pLength(getNthPolyOfId(J,i))>1)
361  poly p=getNthPolyOfId(J,i);
362  if ((p!=NULL) && (pNext(p)!=NULL))
363  {
364  res=TRUE;break;
365  }
366  }
367  idDelete(&J);
368  return res;
369 }
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
static TreeM * G
Definition: janet.cc:38
poly res
Definition: myNF.cc:322
ideal init64(ideal G, int64vec *currw64)
Definition: walkSupport.cc:302
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define idealSize(I)
Definition: walkSupport.h:35
#define pNext(p)
Definition: monomials.h:43
poly getNthPolyOfId(ideal I, int n)
Definition: walkSupport.cc:689
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85

◆ DIFF()

intvec* DIFF ( ideal  G)

Definition at line 438 of file walkSupport.cc.

439 {
440  intvec *v,*w;
441  poly p;
442  int s=idealSize(G);
443  int n=rVar(currRing);
444  int m=DIFFspy(G);
445  intvec* diffm=new intvec(m,n,0);
446  int j,l;
447  int inc=0;
448  for (j=1; j<=s; j++)
449  {
450  p=getNthPolyOfId(G,j);
451  v=leadExp(p);
452  pIter(p);
453  while(p!=NULL)
454  {
455  inc++;
456  intvec *lep=leadExp(p);
457  w=ivSub(v,lep /*leadExp(p)*/);
458  delete lep;
459  pIter(p);
460  for (l=1; l<=n; l++)
461  {
462  // setPosOfIM(diffm,inc,l,(*w)[l-1]);
463  IMATELEM(*diffm,inc,l) =(*w)[l-1] ;
464  }
465  delete w;
466  }
467  delete v;
468  }
469  return(diffm);
470 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
intvec * leadExp(poly p)
Definition: walkSupport.cc:749
intvec * ivSub(intvec *a, intvec *b)
Definition: intvec.cc:280
static TreeM * G
Definition: janet.cc:38
#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:10
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int DIFFspy(ideal G)
Definition: walkSupport.cc:410
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define idealSize(I)
Definition: walkSupport.h:35
poly getNthPolyOfId(ideal I, int n)
Definition: walkSupport.cc:689
polyrec * poly
Definition: hilb.h:10
#define IMATELEM(M, I, J)
Definition: intvec.h:77
int l
Definition: cfEzgcd.cc:94

◆ DIFFspy()

int DIFFspy ( ideal  G)

Definition at line 410 of file walkSupport.cc.

411 {
412  int s=idealSize(G);
413  int j;
414  int temp;
415  int sum=0;
416  poly p;
417  for (j=1; j<=s; j++)
418  {
419  p=getNthPolyOfId(G,j);
420  if((temp=pLength(p))>0) {sum += (temp-1);}
421  }
422  return(sum);
423 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
static TreeM * G
Definition: janet.cc:38
int j
Definition: myNF.cc:70
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define idealSize(I)
Definition: walkSupport.h:35
poly getNthPolyOfId(ideal I, int n)
Definition: walkSupport.cc:689
polyrec * poly
Definition: hilb.h:10

◆ gcd()

int gcd ( int  a,
int  b 
)

Definition at line 839 of file walkSupport.cc.

840 {
841  int r, p0 = a, p1 = b;
842  if(p0 < 0)
843  p0 = -p0;
844 
845  if(p1 < 0)
846  p1 = -p1;
847  while(p1 != 0)
848  {
849  r = p0 % p1;
850  p0 = p1;
851  p1 = r;
852  }
853  return p0;
854 }
const poly a
Definition: syzextra.cc:212
const ring r
Definition: syzextra.cc:208
const poly b
Definition: syzextra.cc:213

◆ gcd64()

int64 gcd64 ( int64  a,
int64  b 
)

Definition at line 867 of file walkSupport.cc.

868 {
869  int64 r, p0 = a, p1 = b;
870  if(p0 < 0)
871  p0 = -p0;
872 
873  if(p1 < 0)
874  p1 = -p1;
875 
876  while(p1 != ((int64)0) )
877  {
878  r = p0 % p1;
879  p0 = p1;
880  p1 = r;
881  }
882 
883  return p0;
884 }
const poly a
Definition: syzextra.cc:212
long int64
Definition: auxiliary.h:66
const ring r
Definition: syzextra.cc:208
const poly b
Definition: syzextra.cc:213

◆ getInvEps64()

int64 getInvEps64 ( ideal  G,
intvec targm,
int  pertdeg 
)

Definition at line 112 of file walkSupport.cc.

113 {
114  int n;
115  int64 temp64;
116  int64 sum64=0;
117 //think n=2 is enough (instead of n=1)
118  for (n=pertdeg; n>1; n--)
119  {
120  temp64=getMaxPosOfNthRow(targm,n);
121  sum64 += temp64;
122  }
123  int64 inveps64=getMaxTdeg(G)*sum64+1;
124 
125  //overflow test
126  if( sum64!=0 && (((inveps64-1)/sum64)!=getMaxTdeg(G)) )
127  overflow_error=11;
128 
129  return(inveps64);
130 }
long int64
Definition: auxiliary.h:66
static TreeM * G
Definition: janet.cc:38
BOOLEAN overflow_error
Definition: walkMain.cc:37
int getMaxTdeg(ideal I)
Definition: walkSupport.cc:57
int getMaxPosOfNthRow(intvec *v, int n)
Definition: walkSupport.cc:83

◆ getMaxPosOfNthRow()

int getMaxPosOfNthRow ( intvec v,
int  n 
)

Definition at line 83 of file walkSupport.cc.

84 {
85  int res=0;
86  assume( (0<n) && (n<=(v->rows())) );
87  {
88  int c=v->cols();
89  int cc=(n-1)*c;
90  res=abs((*v)[0+cc /*(n-1)*c*/]);
91  for (int i=c-1;i>=0;i--)
92  {
93  int temp=abs((*v)[i+cc /*(n-1)*c*/]);
94  if(temp>res){res=temp;}
95  }
96  }
97  return(res);
98 }
int rows() const
Definition: intvec.h:88
Rational abs(const Rational &a)
Definition: GMPrat.cc:443
poly res
Definition: myNF.cc:322
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87

◆ getMaxTdeg()

int getMaxTdeg ( ideal  I)

Definition at line 57 of file walkSupport.cc.

58 {
59  int res=-1;
60  int length=(int)I->ncols;
61  for(int j=length-1;j>=0;j--)
62  {
63  if ((I->m)[j]!=NULL)
64  {
65  int temp=pTotaldegree((I->m)[j]);
66  if(temp>res) {res=temp;}
67  }
68  }
69  return(res);
70 }
poly res
Definition: myNF.cc:322
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:264
#define NULL
Definition: omList.c:10

◆ getNthPolyOfId()

poly getNthPolyOfId ( ideal  I,
int  n 
)

Definition at line 689 of file walkSupport.cc.

690 {
691  if(0<n && n<=((int)I->ncols))
692  {
693  return (I->m)[n-1];
694  }
695  else
696  {
697  return(NULL);
698  }
699 }
#define NULL
Definition: omList.c:10

◆ getNthRow()

intvec* getNthRow ( intvec v,
int  n 
)

Definition at line 168 of file walkSupport.cc.

169 {
170  int r=v->rows();
171  int c=v->cols();
172  intvec *res=new intvec(c);
173  if((0<n) && (n<=r))
174  {
175  int cc=(n-1)*c;
176  for (int i=0; i<c; i++)
177  {
178  (*res)[i]=(*v)[i+cc /*(n-1)*c*/ ];
179  }
180  }
181  return(res);
182 }
int rows() const
Definition: intvec.h:88
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87

◆ getNthRow64()

int64vec* getNthRow64 ( intvec v,
int  n 
)

Definition at line 184 of file walkSupport.cc.

185 {
186  int r=v->rows();
187  int c=v->cols();
188  int64vec *res=new int64vec(c);
189  if((0<n) && (n<=r))
190  {
191  int cc=(n-1)*c;
192  for (int i=0; i<c; i++)
193  {
194  (*res)[i]=(int64)(*v)[i+cc /*(n-1)*c*/ ];
195  }
196  }
197  return(res);
198 }
int rows() const
Definition: intvec.h:88
long int64
Definition: auxiliary.h:66
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87

◆ gett64()

void gett64 ( intvec listw,
int64vec currw64,
int64vec targw64,
int64 tvec0,
int64 tvec1 
)

Definition at line 484 of file walkSupport.cc.

485 {
486  int s=ivSize(listw);
487  int j;
488  int64 zaehler64=0;
489  int64 nenner64=0;
490  int64 temp1,temp2,temp3,temp4; //overflowstuff
491  for(j=1; j<=s; j++)
492  {
493 
494  temp3=zaehler64;
495  temp1=((int64)((*listw)[j-1]));
496  temp2=((*currw64)[j-1]);
497  temp4=temp1*temp2;
498  zaehler64=temp3-temp4;
499 
500  //overflow test
501  if(temp1!=0 && (temp4/temp1)!=temp2) overflow_error=3;
502 
503  if( ( temp3<0 && temp4>0 ) || ( temp3>0 && temp4<0 ) )
504  {
505  int64 abs_t3=abs64(temp3);
506  if( (abs_t3+abs64(temp4))<abs_t3 ) overflow_error=4;
507  }
508 
509  //overflow test
510  temp1=((*targw64)[j-1])-((*currw64)[j-1]);
511  //this subtraction can never yield an overflow since both number
512  //will always be positive
513  temp2=((int64)((*listw)[j-1]));
514  temp3=nenner64;
515  temp4=temp1*temp2;
516  nenner64=temp3+temp4;
517 
518  //overflow test
519  if(temp1!=0 && ((temp1*temp2)/temp1)!=temp2) overflow_error=5;
520 
521  if( (temp3>0 && temp4>0) ||
522  (temp3<0 && temp4<0) )
523  {
524  int64 abs_t3=abs64(temp3);
525  if( (abs_t3+abs64(temp4))<abs_t3 )
526  {
527  overflow_error=6;
528  }
529  }
530  }
531 
532  if (nenner64==0)
533  {
534  zaehler64=2;
535  }
536  else
537  {
538  if ( (zaehler64<=0) && (nenner64<0) )
539  {
540  zaehler64=-zaehler64;
541  nenner64=-nenner64;
542  }
543  }
544 
545  int64 g=gcd64(zaehler64,nenner64);
546 
547  tvec0=zaehler64/g;
548  tvec1=nenner64/g;
549 
550 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
long int64
Definition: auxiliary.h:66
int ivSize(intvec *v)
Definition: walkSupport.h:36
g
Definition: cfModGcd.cc:4031
int64 abs64(int64 i)
Definition: walkSupport.h:44
BOOLEAN overflow_error
Definition: walkMain.cc:37
int j
Definition: myNF.cc:70
int64 gcd64(int64 a, int64 b)
Definition: walkSupport.cc:867

◆ getTaun64()

void getTaun64 ( ideal  G,
intvec targm,
int  pertdeg,
int64vec **  v64,
int64 i64 
)

Definition at line 212 of file walkSupport.cc.

213 {
214  int64vec* taun64=getNthRow64(targm,1);
215  int64vec *temp64,*add64;
216  int64 inveps64=1;
217  if (pertdeg>1) inveps64=getInvEps64(G,targm,pertdeg);
218 
219  int n;
220  //temp64 is used to check for overflow:
221  for (n=2; n<=pertdeg; n++)
222  {
223  if (inveps64!=1)
224  {
225  temp64=iv64Copy(taun64);
226  (*taun64)*=inveps64;
227  for(int i=0; i<rVar(currRing);i++)
228  {
229  if((*temp64)[i]!=0 && (((*taun64)[i])/((*temp64)[i]))!=inveps64)
230  overflow_error=12;
231  }
232  delete temp64;
233  }
234  temp64=iv64Copy(taun64);
235  add64=getNthRow64(targm,n);
236  taun64=iv64Add(add64,taun64);
237  for(int i=0; i<rVar(currRing);i++)
238  {
239  if( ( ((*temp64)[i]) > 0 ) && ( ((*add64)[i]) > 0 ) )
240  {
241  if( ((*taun64)[i]) < ((*temp64)[i]) )
242  overflow_error=13;
243  }
244  if( ( ((*temp64)[i]) < 0 ) && ( ((*add64)[i]) < 0 ) )
245  {
246  if( ((*taun64)[i]) > ((*temp64)[i]) )
247  overflow_error=13;
248  }
249  }
250  delete temp64;
251  }
252 
253  //lists taunlist64=makeTaunList64(taun64,inveps64);
254  //return(taunlist64);
255  *v64=taun64;
256  i64=inveps64;
257 }
int64vec * iv64Copy(int64vec *o)
Definition: int64vec.h:75
int64vec * iv64Add(int64vec *a, int64vec *b)
Definition: int64vec.cc:173
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
long int64
Definition: auxiliary.h:66
int64vec * getNthRow64(intvec *v, int n)
Definition: walkSupport.cc:184
static TreeM * G
Definition: janet.cc:38
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN overflow_error
Definition: walkMain.cc:37
int i
Definition: cfEzgcd.cc:123
int64 getInvEps64(ideal G, intvec *targm, int pertdeg)
Definition: walkSupport.cc:112

◆ idInterRed()

ideal idInterRed ( ideal  G)

Definition at line 961 of file walkSupport.cc.

962 {
963  assume(G != NULL);
964 
965  ideal GG = kInterRedOld(G, NULL);
966  idDelete(&G);
967  return GG;
968 }
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
static TreeM * G
Definition: janet.cc:38
const CanonicalForm & GG
Definition: cfModGcd.cc:4017
#define assume(x)
Definition: mod2.h:394
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3177
#define NULL
Definition: omList.c:10

◆ idStd()

ideal idStd ( ideal  G)

Definition at line 941 of file walkSupport.cc.

942 {
943  ideal GG = kStd(G, NULL, testHomog, NULL);
944  idSkipZeroes(GG);
945  return GG;
946 }
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
static TreeM * G
Definition: janet.cc:38
const CanonicalForm & GG
Definition: cfModGcd.cc:4017
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define NULL
Definition: omList.c:10

◆ init64()

ideal init64 ( ideal  G,
int64vec currw64 
)

Definition at line 302 of file walkSupport.cc.

303 {
304  int length=IDELEMS(G);
305  ideal I=idInit(length,G->rank);
306  int j;
307  int64 leadingweight,templeadingweight;
308  poly p=NULL;
309  poly leadp=NULL;
310  for (j=1; j<=length; j++)
311  {
312  p=getNthPolyOfId(G,j);
313  int64vec *tt=leadExp64(p);
314  leadingweight=scalarProduct64(currw64,tt /*leadExp64(p)*/);
315  delete tt;
316  while (p!=NULL)
317  {
318  tt=leadExp64(p);
319  templeadingweight=scalarProduct64(currw64,tt /*leadExp64(p)*/);
320  delete tt;
321  if(templeadingweight==leadingweight)
322  {
323  leadp=pAdd(leadp,pHead(p));
324  }
325  if(templeadingweight>leadingweight)
326  {
327  pDelete(&leadp);
328  leadp=pHead(p);
329  leadingweight=templeadingweight;
330  }
331  pIter(p);
332  }
333  (I->m)[j-1]=leadp;
334  p=NULL;
335  leadp=NULL;
336  }
337  return(I);
338 }
#define pAdd(p, q)
Definition: polys.h:186
return P p
Definition: myNF.cc:203
long int64
Definition: auxiliary.h:66
int64vec * leadExp64(poly p)
Definition: walkSupport.cc:772
static TreeM * G
Definition: janet.cc:38
#define pIter(p)
Definition: monomials.h:44
int j
Definition: myNF.cc:70
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:169
static int64 scalarProduct64(int64vec *a, int64vec *b)
Definition: walkSupport.cc:269
poly getNthPolyOfId(ideal I, int n)
Definition: walkSupport.cc:689
polyrec * poly
Definition: hilb.h:10

◆ int64VecToIntVec()

intvec* int64VecToIntVec ( int64vec source)

Definition at line 1184 of file walkSupport.cc.

1185 {
1186  int r=source->rows();
1187  int c=source->cols();
1188  intvec* res=new intvec(r,c,0);
1189  for(int i=0;i<r;i++){
1190  for(int j=0;j<c;j++){
1191  (*res)[i*c+j]=(int)(*source)[i*c+j];
1192  }
1193  }
1194  delete source;
1195  return(res);
1196 }
int cols() const
Definition: int64vec.h:56
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int rows() const
Definition: int64vec.h:57
int i
Definition: cfEzgcd.cc:123

◆ invEpsOk64()

int invEpsOk64 ( ideal  I,
intvec targm,
int  pertdeg,
int64  inveps64 
)

Definition at line 144 of file walkSupport.cc.

145 {
146  int64 temp64=getInvEps64(I,targm,pertdeg);
147  if (inveps64>=temp64)
148  {
149  return(1);
150  }
151  else
152  {
153  return(0);
154  }
155 }
long int64
Definition: auxiliary.h:66
int64 getInvEps64(ideal G, intvec *targm, int pertdeg)
Definition: walkSupport.cc:112

◆ leadExp()

intvec* leadExp ( poly  p)

Definition at line 749 of file walkSupport.cc.

750 {
751  int N=rVar(currRing);
752  int *e=(int*)omAlloc((N+1)*sizeof(int));
753  pGetExpV(p,e);
754  intvec* iv=new intvec(N);
755  for(int i=N;i>0;i--) { (*iv)[i-1]=e[i];}
756  omFree(e);
757  return(iv);
758 }
return P p
Definition: myNF.cc:203
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define omAlloc(size)
Definition: omAllocDecl.h:210
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
#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

◆ leadExp64()

int64vec* leadExp64 ( poly  p)

Definition at line 772 of file walkSupport.cc.

773 {
774  int N=rVar(currRing);
775  int *e=(int*)omAlloc((N+1)*sizeof(int));
776  pGetExpV(p,e);
777  int64vec* iv64=new int64vec(N);
778  for(int i=N;i>0;i--) { (*iv64)[i-1]=(int64)e[i];}
779  omFree(e);
780  return(iv64);
781 }
return P p
Definition: myNF.cc:203
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
long int64
Definition: auxiliary.h:66
#define omAlloc(size)
Definition: omAllocDecl.h:210
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
#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

◆ matIdLift()

matrix matIdLift ( ideal  Gomega,
ideal  M 
)

Definition at line 981 of file walkSupport.cc.

982 {
983  ideal Mtmp = idLift(Gomega, M, NULL, FALSE, FALSE, TRUE, NULL);
984  int rows=IDELEMS(Gomega);
985  int cols=IDELEMS(Mtmp);
987  return res;
988 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
poly res
Definition: myNF.cc:322
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
Definition: ideals.cc:938

◆ nextt64()

void nextt64 ( ideal  G,
int64vec currw64,
int64vec targw64,
int64 tvec0,
int64 tvec1 
)

Definition at line 563 of file walkSupport.cc.

564 {
565  intvec* diffm=DIFF(G);
566  int s=diffm->rows();
567  tvec0=(int64)2;
568  tvec1=(int64)0;
569  intvec *tt;
570  for(int j=1; j<=s; j++)
571  {
572  tt=getNthRow(diffm,j);
573  int64 temptvec0, temptvec1;
574  gett64(tt,currw64,targw64,temptvec0, temptvec1);
575  delete tt;
576 
577  //if tempt>0 both parts will be>0
578  if ( (temptvec1!=0) //that tempt is defined
579  &&
580  (temptvec0>0) && (temptvec1>0) //that tempt>0
581  )
582  {
583  if( ( (temptvec0) <= (temptvec1) ) //that tempt<=1
584  &&
585  ( ( (temptvec0) * (tvec1) ) <
586  ( (temptvec1) * (tvec0) ) )
587  )
588  { //that tempt<t
589  tvec0=temptvec0;
590  tvec1=temptvec1;
591  }
592  }
593  }
594  delete diffm;
595  return;
596 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int rows() const
Definition: intvec.h:88
long int64
Definition: auxiliary.h:66
static TreeM * G
Definition: janet.cc:38
Definition: intvec.h:14
int j
Definition: myNF.cc:70
intvec * DIFF(ideal G)
Definition: walkSupport.cc:438
intvec * getNthRow(intvec *v, int n)
Definition: walkSupport.cc:168
void gett64(intvec *listw, int64vec *currw64, int64vec *targw64, int64 &tvec0, int64 &tvec1)
Definition: walkSupport.cc:484

◆ nextw64()

int64vec* nextw64 ( int64vec currw,
int64vec targw,
int64  nexttvec0,
int64  nexttvec1 
)

Definition at line 607 of file walkSupport.cc.

609 {
610  //to do (targw-currw)*tvec[0]+currw*tvec[1]
611  int64vec* tempv;
612  int64vec* nextweight;
613  int64vec* a=iv64Sub(targw,currw);
614  //no overflow can occur since both are>=0
615 
616  //to test overflow
617  tempv=iv64Copy(a);
618  *a *= (nexttvec0);
619  for(int i=0; i<rVar(currRing); i++)
620  {
621  if( (nexttvec0) !=0 &&
622  (((*a)[i])/(nexttvec0))!=((*tempv)[i]) )
623  {
624  overflow_error=7;
625  break;
626  }
627  }
628  delete tempv;
629  int64vec* b=currw;
630  tempv=iv64Copy(b);
631  *b *= (nexttvec1);
632  for(int i=0; i<rVar(currRing); i++)
633  {
634  if( (nexttvec1) !=0 &&
635  (((*b)[i])/(nexttvec1))!=((*tempv)[i]) )
636  {
637  overflow_error=8;
638  break;
639  }
640  }
641  delete tempv;
642  nextweight=iv64Add(a,b);
643 
644  for(int i=0; i<rVar(currRing); i++)
645  {
646  if( (((*a)[i])>=0 && ((*b)[i])>=0) ||
647  (((*a)[i])<0 && ((*b)[i])<0) )
648  {
649  if( (abs64((*a)[i]))>abs64((*nextweight)[i]) ||
650  (abs64((*b)[i]))>abs64((*nextweight)[i])
651  )
652  {
653  overflow_error=9;
654  break;
655  }
656  }
657  }
658 
659  //to reduce common factors of nextweight
660  int s=iv64Size(nextweight);
661  int64 g,temp;
662  g=(*nextweight)[0];
663  for (int i=1; i<s; i++)
664  {
665  temp=(*nextweight)[i];
666  g=gcd64(g,temp);
667  if (g==1) break;
668  }
669 
670  if (g!=1) *nextweight /= g;
671 
672  return(nextweight);
673 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
int64vec * iv64Copy(int64vec *o)
Definition: int64vec.h:75
int64vec * iv64Add(int64vec *a, int64vec *b)
Definition: int64vec.cc:173
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
long int64
Definition: auxiliary.h:66
g
Definition: cfModGcd.cc:4031
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int64 abs64(int64 i)
Definition: walkSupport.h:44
BOOLEAN overflow_error
Definition: walkMain.cc:37
int64vec * iv64Sub(int64vec *a, int64vec *b)
Definition: int64vec.cc:203
int i
Definition: cfEzgcd.cc:123
int iv64Size(int64vec *v)
Definition: walkSupport.h:37
int64 gcd64(int64 a, int64 b)
Definition: walkSupport.cc:867
const poly b
Definition: syzextra.cc:213

◆ noPolysWithMoreThanTwoTerms()

BOOLEAN noPolysWithMoreThanTwoTerms ( ideal  Gw)

Definition at line 383 of file walkSupport.cc.

384 {
385  int length=idealSize(Gw);
386  for(int i=length; i>0; i--)
387  {
388  //if(pLength(getNthPolyOfId(Gw,i))>2)
389  poly p=getNthPolyOfId(Gw,i);
390  if ((p!=NULL) && (pNext(p)!=NULL) && (pNext(pNext(p))!=NULL))
391  {
392  return FALSE;
393  }
394  }
395  return TRUE;
396 }
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define idealSize(I)
Definition: walkSupport.h:35
#define pNext(p)
Definition: monomials.h:43
poly getNthPolyOfId(ideal I, int n)
Definition: walkSupport.cc:689
polyrec * poly
Definition: hilb.h:10

◆ rCopyAndChangeA()

void rCopyAndChangeA ( int64vec w)

Definition at line 1003 of file walkSupport.cc.

1004 {
1005  ring rnew=rCopy0(currRing);
1006  rComplete(rnew);
1007  rSetWeightVec(rnew,w->iv64GetVec());
1008  rChangeCurrRing(rnew);
1009 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3365
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1325
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void rSetWeightVec(ring r, int64 *wv)
Definition: ring.cc:5143
int64 * iv64GetVec()
Definition: int64vec.h:61

◆ rGetGlobalOrderMatrix()

int64vec* rGetGlobalOrderMatrix ( ring  r)

Definition at line 1022 of file walkSupport.cc.

1023 {
1024  int n=rVar(r);
1025  int64vec* res=new int64vec(n,n,(int64)0);
1026  if (rHasLocalOrMixedOrdering(r)) return res;
1027  int pos1=0;
1028  int pos2=0;
1029  int i=0;
1030  while(r->order[i]!=0 && pos2<n)
1031  {
1032  pos2=pos2+r->block1[i] - r->block0[i];
1033 
1034  if(r->order[i]==ringorder_lp)
1035  {
1036  for(int j=pos1; j<=pos2; j++)
1037  (*res)[j*n+j]=(int64)1;
1038  }
1039  else if(r->order[i]==ringorder_dp)
1040  {
1041  for(int j=pos1;j<=pos2;j++)
1042  (*res)[pos1*n+j]=(int64)1;
1043  for(int j=1;j<=(pos2-pos1);j++)
1044  (*res)[(pos1+j)*n+(pos2+1-j)]=(int64)-1;
1045  }
1046  else if(r->order[i]==ringorder_Dp)
1047  {
1048  for(int j=pos1;j<=pos2;j++)
1049  (*res)[pos1*n+j]=(int64)1;
1050  for(int j=1;j<=(pos2-pos1);j++)
1051  (*res)[(pos1+j)*n+(pos1+j-1)]=(int64)1;
1052  }
1053  else if(r->order[i]==ringorder_wp)
1054  {
1055  int* weights=r->wvhdl[i];
1056  for(int j=pos1;j<=pos2;j++)
1057  (*res)[pos1*n+j]=(int64)weights[j-pos1];
1058  for(int j=1;j<=(pos2-pos1);j++)
1059  (*res)[(pos1+j)*n+(pos2+1-j)]=(int64)-1;
1060  }
1061  else if(r->order[i]==ringorder_Wp)
1062  {
1063  int* weights=r->wvhdl[i];
1064  for(int j=pos1;j<=pos2;j++)
1065  (*res)[pos1*n+j]=(int64)weights[j-pos1];
1066  for(int j=1;j<=(pos2-pos1);j++)
1067  (*res)[(pos1+j)*n+(pos1+j-1)]=(int64)1;
1068  }
1069 
1070  else if(r->order[0]==ringorder_M)
1071  {
1072  int* weights=r->wvhdl[0];
1073  for(int j=pos1;j<((pos2+1)*(pos2+1));j++)
1074  (*res)[j]=(int64)weights[j];
1075  }
1076 
1077  pos1=pos2+1;
1078  pos2=pos2+1;
1079  i++;
1080  }
1081 
1082  return(res);
1083 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
long int64
Definition: auxiliary.h:66
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123

◆ rGetGlobalOrderWeightVec()

int64vec * rGetGlobalOrderWeightVec ( ring  r)

Definition at line 1097 of file walkSupport.cc.

1098 {
1099  int n=rVar(r);
1100  int64vec* res=new int64vec(n);
1101 
1102  if (rHasLocalOrMixedOrdering(r)) return res;
1103 
1104  int length;
1105 
1106  if(r->order[0]==ringorder_lp)
1107  {
1108  (*res)[0]=(int64)1;
1109  }
1110  else if( (r->order[0]==ringorder_dp) || (r->order[0]==ringorder_Dp) )
1111  {
1112  length=r->block1[0] - r->block0[0];
1113  for (int j=0;j<=length;j++)
1114  (*res)[j]=(int64)1;
1115  }
1116  else if( (r->order[0]==ringorder_wp) || (r->order[0]==ringorder_Wp) ||
1117  (r->order[0]==ringorder_a) || (r->order[0]==ringorder_M) )
1118  {
1119  int* weights=r->wvhdl[0];
1120  length=r->block1[0] - r->block0[0];
1121  for (int j=0;j<=length;j++)
1122  (*res)[j]=(int64)weights[j];
1123  }
1124  else if( /*(*/ r->order[0]==ringorder_a64 /*)*/ )
1125  {
1126  int64* weights=(int64*)r->wvhdl[0];
1127  length=r->block1[0] - r->block0[0];
1128  for (int j=0;j<=length;j++)
1129  (*res)[j]=weights[j];
1130  }
1131 
1132  return(res);
1133 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
for int64 weights
Definition: ring.h:79
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
long int64
Definition: auxiliary.h:66
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
for(int i=0;i< R->ExpL_Size;i++) Print("%09lx "
Definition: cfEzgcd.cc:66
int j
Definition: myNF.cc:70

◆ scalarProduct()

static long scalarProduct ( intvec a,
intvec b 
)
inlinestatic

Definition at line 814 of file walkSupport.cc.

815 {
816  assume( a->length() == b->length());
817  int i, n = a->length();
818  long result = 0;
819  for(i=n-1; i>=0; i--)
820  result += (*a)[i] * (*b)[i];
821  return result;
822 }
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
int length() const
Definition: intvec.h:86
return result
Definition: facAbsBiFact.cc:76

◆ scalarProduct64()

static int64 scalarProduct64 ( int64vec a,
int64vec b 
)
inlinestatic

Definition at line 269 of file walkSupport.cc.

270 {
271  assume( a->length() == b->length());
272  int i, n = a->length();
273  int64 result = 0;
274  int64 temp1,temp2;
275  for(i=n-1; i>=0; i--)
276  {
277  temp1=(*a)[i] * (*b)[i];
278  if((*a)[i]!=0 && (temp1/(*a)[i])!=(*b)[i]) overflow_error=1;
279 
280  temp2=result;
281  result += temp1;
282 
283  //since both vectors always have nonnegative entries in init64
284  //result should be >=temp2
285  if(temp2>result) overflow_error=2;
286  }
287 
288  return result;
289 }
long int64
Definition: auxiliary.h:66
BOOLEAN overflow_error
Definition: walkMain.cc:37
int length() const
Definition: int64vec.h:55
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
return result
Definition: facAbsBiFact.cc:76

◆ sortRedSB()

ideal sortRedSB ( ideal  G)

Definition at line 1149 of file walkSupport.cc.

1150 {
1151  int s=idealSize(G);
1152  poly* m=G->m;
1153  poly p,q;
1154  for (int i=0; i<(s-1); i++)
1155  {
1156  for (int j=0; j<((s-1)-i); j++)
1157  {
1158  p=m[j];
1159  q=m[j+1];
1160  if (pLmCmp(p,q)==1)
1161  {
1162  m[j+1]=p;
1163  m[j]=q;
1164  }
1165  }
1166  }
1167  return(G);
1168 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static TreeM * G
Definition: janet.cc:38
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define idealSize(I)
Definition: walkSupport.h:35
polyrec * poly
Definition: hilb.h:10

◆ tdeg()

int tdeg ( poly  p)

Definition at line 38 of file walkSupport.cc.

39 {
40  int res=0;
41  if(p!=NULL) res=pTotaldegree(p);
42  return(res);
43 }
return P p
Definition: myNF.cc:203
poly res
Definition: myNF.cc:322
static long pTotaldegree(poly p)
Definition: polys.h:264
#define NULL
Definition: omList.c:10

Variable Documentation

◆ overflow_error

BOOLEAN overflow_error

Definition at line 37 of file walkMain.cc.