My Project
Loading...
Searching...
No Matches
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"

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

EXTERN_VAR BOOLEAN overflow_error
 

Function Documentation

◆ currwOnBorder64()

BOOLEAN currwOnBorder64 ( ideal  G,
int64vec currw64 
)

Definition at line 350 of file walkSupport.cc.

351{
352 ideal J=init64(G,currw64);
353 int length=idealSize(J);
355 for(int i=length; i>0; i--)
356 {
357 //if(pLength(getNthPolyOfId(J,i))>1)
358 poly p=getNthPolyOfId(J,i);
359 if ((p!=NULL) && (pNext(p)!=NULL))
360 {
361 res=TRUE;break;
362 }
363 }
364 idDelete(&J);
365 return res;
366}
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4078
CanonicalForm res
Definition: facAbsFact.cc:60
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
STATIC_VAR TreeM * G
Definition: janet.cc:31
#define pNext(p)
Definition: monomials.h:36
#define NULL
Definition: omList.c:12
poly getNthPolyOfId(ideal I, int n)
Definition: walkSupport.cc:686
ideal init64(ideal G, int64vec *currw64)
Definition: walkSupport.cc:299
#define idealSize(I)
Definition: walkSupport.h:35

◆ DIFF()

intvec * DIFF ( ideal  G)

Definition at line 435 of file walkSupport.cc.

436{
437 intvec *v,*w;
438 poly p;
439 int s=idealSize(G);
440 int n=rVar(currRing);
441 int m=DIFFspy(G);
442 intvec* diffm=new intvec(m,n,0);
443 int j,l;
444 int inc=0;
445 for (j=1; j<=s; j++)
446 {
448 v=leadExp(p);
449 pIter(p);
450 while(p!=NULL)
451 {
452 inc++;
453 intvec *lep=leadExp(p);
454 w=ivSub(v,lep /*leadExp(p)*/);
455 delete lep;
456 pIter(p);
457 for (l=1; l<=n; l++)
458 {
459 // setPosOfIM(diffm,inc,l,(*w)[l-1]);
460 IMATELEM(*diffm,inc,l) =(*w)[l-1] ;
461 }
462 delete w;
463 }
464 delete v;
465 }
466 return(diffm);
467}
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
Definition: intvec.h:23
const CanonicalForm int s
Definition: facAbsFact.cc:51
const CanonicalForm & w
Definition: facAbsFact.cc:51
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
int j
Definition: facHensel.cc:110
intvec * ivSub(intvec *a, intvec *b)
Definition: intvec.cc:297
#define IMATELEM(M, I, J)
Definition: intvec.h:85
#define pIter(p)
Definition: monomials.h:37
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592
intvec * leadExp(poly p)
Definition: walkSupport.cc:746
int DIFFspy(ideal G)
Definition: walkSupport.cc:407

◆ DIFFspy()

int DIFFspy ( ideal  G)

Definition at line 407 of file walkSupport.cc.

408{
409 int s=idealSize(G);
410 int j;
411 int temp;
412 int sum=0;
413 poly p;
414 for (j=1; j<=s; j++)
415 {
417 if((temp=pLength(p))>0) {sum += (temp-1);}
418 }
419 return(sum);
420}
static int pLength(poly a)
Definition: p_polys.h:188

◆ gcd()

int gcd ( int  a,
int  b 
)

Definition at line 836 of file walkSupport.cc.

837{
838 int r, p0 = a, p1 = b;
839 if(p0 < 0)
840 p0 = -p0;
841
842 if(p1 < 0)
843 p1 = -p1;
844 while(p1 != 0)
845 {
846 r = p0 % p1;
847 p0 = p1;
848 p1 = r;
849 }
850 return p0;
851}
CanonicalForm b
Definition: cfModGcd.cc:4103

◆ gcd64()

int64 gcd64 ( int64  a,
int64  b 
)

Definition at line 864 of file walkSupport.cc.

865{
866 int64 r, p0 = a, p1 = b;
867 if(p0 < 0)
868 p0 = -p0;
869
870 if(p1 < 0)
871 p1 = -p1;
872
873 while(p1 != ((int64)0) )
874 {
875 r = p0 % p1;
876 p0 = p1;
877 p1 = r;
878 }
879
880 return p0;
881}
long int64
Definition: auxiliary.h:68

◆ getInvEps64()

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

Definition at line 109 of file walkSupport.cc.

110{
111 int n;
112 int64 temp64;
113 int64 sum64=0;
114//think n=2 is enough (instead of n=1)
115 for (n=pertdeg; n>1; n--)
116 {
117 temp64=getMaxPosOfNthRow(targm,n);
118 sum64 += temp64;
119 }
120 int64 inveps64=getMaxTdeg(G)*sum64+1;
121
122 //overflow test
123 if( sum64!=0 && (((inveps64-1)/sum64)!=getMaxTdeg(G)) )
125
126 return(inveps64);
127}
EXTERN_VAR BOOLEAN overflow_error
Definition: walkSupport.cc:15
int getMaxTdeg(ideal I)
Definition: walkSupport.cc:54
int getMaxPosOfNthRow(intvec *v, int n)
Definition: walkSupport.cc:80

◆ getMaxPosOfNthRow()

int getMaxPosOfNthRow ( intvec v,
int  n 
)

Definition at line 80 of file walkSupport.cc.

81{
82 int res=0;
83 assume( (0<n) && (n<=(v->rows())) );
84 {
85 int c=v->cols();
86 int cc=(n-1)*c;
87 res=abs((*v)[0+cc /*(n-1)*c*/]);
88 for (int i=c-1;i>=0;i--)
89 {
90 int temp=abs((*v)[i+cc /*(n-1)*c*/]);
91 if(temp>res){res=temp;}
92 }
93 }
94 return(res);
95}
Rational abs(const Rational &a)
Definition: GMPrat.cc:436
#define assume(x)
Definition: mod2.h:389

◆ getMaxTdeg()

int getMaxTdeg ( ideal  I)

Definition at line 54 of file walkSupport.cc.

55{
56 int res=-1;
57 int length=(int)I->ncols;
58 for(int j=length-1;j>=0;j--)
59 {
60 if ((I->m)[j]!=NULL)
61 {
62 int temp=pTotaldegree((I->m)[j]);
63 if(temp>res) {res=temp;}
64 }
65 }
66 return(res);
67}
static long pTotaldegree(poly p)
Definition: polys.h:282

◆ getNthPolyOfId()

poly getNthPolyOfId ( ideal  I,
int  n 
)

Definition at line 686 of file walkSupport.cc.

687{
688 if(0<n && n<=((int)I->ncols))
689 {
690 return (I->m)[n-1];
691 }
692 else
693 {
694 return(NULL);
695 }
696}

◆ getNthRow()

intvec * getNthRow ( intvec v,
int  n 
)

Definition at line 165 of file walkSupport.cc.

166{
167 int r=v->rows();
168 int c=v->cols();
169 intvec *res=new intvec(c);
170 if((0<n) && (n<=r))
171 {
172 int cc=(n-1)*c;
173 for (int i=0; i<c; i++)
174 {
175 (*res)[i]=(*v)[i+cc /*(n-1)*c*/ ];
176 }
177 }
178 return(res);
179}

◆ getNthRow64()

int64vec * getNthRow64 ( intvec v,
int  n 
)

Definition at line 181 of file walkSupport.cc.

182{
183 int r=v->rows();
184 int c=v->cols();
185 int64vec *res=new int64vec(c);
186 if((0<n) && (n<=r))
187 {
188 int cc=(n-1)*c;
189 for (int i=0; i<c; i++)
190 {
191 (*res)[i]=(int64)(*v)[i+cc /*(n-1)*c*/ ];
192 }
193 }
194 return(res);
195}

◆ gett64()

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

Definition at line 481 of file walkSupport.cc.

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

◆ getTaun64()

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

Definition at line 209 of file walkSupport.cc.

210{
211 int64vec* taun64=getNthRow64(targm,1);
212 int64vec *temp64,*add64;
213 int64 inveps64=1;
214 if (pertdeg>1) inveps64=getInvEps64(G,targm,pertdeg);
215
216 int n;
217 //temp64 is used to check for overflow:
218 for (n=2; n<=pertdeg; n++)
219 {
220 if (inveps64!=1)
221 {
222 temp64=iv64Copy(taun64);
223 (*taun64)*=inveps64;
224 for(int i=0; i<rVar(currRing);i++)
225 {
226 if((*temp64)[i]!=0 && (((*taun64)[i])/((*temp64)[i]))!=inveps64)
228 }
229 delete temp64;
230 }
231 temp64=iv64Copy(taun64);
232 add64=getNthRow64(targm,n);
233 taun64=iv64Add(add64,taun64);
234 for(int i=0; i<rVar(currRing);i++)
235 {
236 if( ( ((*temp64)[i]) > 0 ) && ( ((*add64)[i]) > 0 ) )
237 {
238 if( ((*taun64)[i]) < ((*temp64)[i]) )
240 }
241 if( ( ((*temp64)[i]) < 0 ) && ( ((*add64)[i]) < 0 ) )
242 {
243 if( ((*taun64)[i]) > ((*temp64)[i]) )
245 }
246 }
247 delete temp64;
248 }
249
250 //lists taunlist64=makeTaunList64(taun64,inveps64);
251 //return(taunlist64);
252 *v64=taun64;
253 i64=inveps64;
254}
int64vec * iv64Add(int64vec *a, int64vec *b)
Definition: int64vec.cc:172
int64vec * iv64Copy(int64vec *o)
Definition: int64vec.h:84
int64vec * getNthRow64(intvec *v, int n)
Definition: walkSupport.cc:181
int64 getInvEps64(ideal G, intvec *targm, int pertdeg)
Definition: walkSupport.cc:109

◆ idInterRed()

ideal idInterRed ( ideal  G)

Definition at line 958 of file walkSupport.cc.

959{
960 assume(G != NULL);
961
962 ideal GG = kInterRedOld(G, NULL);
963 idDelete(&G);
964 return GG;
965}
const CanonicalForm & GG
Definition: cfModGcd.cc:4076
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3409

◆ idStd()

ideal idStd ( ideal  G)

Definition at line 938 of file walkSupport.cc.

939{
940 ideal GG = kStd(G, NULL, testHomog, NULL);
942 return GG;
943}
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:2447
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
@ testHomog
Definition: structs.h:38

◆ init64()

ideal init64 ( ideal  G,
int64vec currw64 
)

Definition at line 299 of file walkSupport.cc.

300{
301 int length=IDELEMS(G);
302 ideal I=idInit(length,G->rank);
303 int j;
304 int64 leadingweight,templeadingweight;
305 poly p=NULL;
306 poly leadp=NULL;
307 for (j=1; j<=length; j++)
308 {
310 int64vec *tt=leadExp64(p);
311 leadingweight=scalarProduct64(currw64,tt /*leadExp64(p)*/);
312 delete tt;
313 while (p!=NULL)
314 {
315 tt=leadExp64(p);
316 templeadingweight=scalarProduct64(currw64,tt /*leadExp64(p)*/);
317 delete tt;
318 if(templeadingweight==leadingweight)
319 {
320 leadp=pAdd(leadp,pHead(p));
321 }
322 if(templeadingweight>leadingweight)
323 {
324 pDelete(&leadp);
325 leadp=pHead(p);
326 leadingweight=templeadingweight;
327 }
328 pIter(p);
329 }
330 (I->m)[j-1]=leadp;
331 p=NULL;
332 leadp=NULL;
333 }
334 return(I);
335}
#define pAdd(p, q)
Definition: polys.h:203
#define pDelete(p_ptr)
Definition: polys.h:186
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define IDELEMS(i)
Definition: simpleideals.h:23
int64vec * leadExp64(poly p)
Definition: walkSupport.cc:769
static int64 scalarProduct64(int64vec *a, int64vec *b)
Definition: walkSupport.cc:266

◆ int64VecToIntVec()

intvec * int64VecToIntVec ( int64vec source)

Definition at line 1181 of file walkSupport.cc.

1182{
1183 int r=source->rows();
1184 int c=source->cols();
1185 intvec* res=new intvec(r,c,0);
1186 for(int i=0;i<r;i++){
1187 for(int j=0;j<c;j++){
1188 (*res)[i*c+j]=(int)(*source)[i*c+j];
1189 }
1190 }
1191 delete source;
1192 return(res);
1193}
int rows() const
Definition: int64vec.h:66
int cols() const
Definition: int64vec.h:65

◆ invEpsOk64()

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

Definition at line 141 of file walkSupport.cc.

142{
143 int64 temp64=getInvEps64(I,targm,pertdeg);
144 if (inveps64>=temp64)
145 {
146 return(1);
147 }
148 else
149 {
150 return(0);
151 }
152}

◆ leadExp()

intvec * leadExp ( poly  p)

Definition at line 746 of file walkSupport.cc.

747{
748 int N=rVar(currRing);
749 int *e=(int*)omAlloc((N+1)*sizeof(int));
751 intvec* iv=new intvec(N);
752 for(int i=N;i>0;i--) { (*iv)[i-1]=e[i];}
753 omFree(e);
754 return(iv);
755}
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1518

◆ leadExp64()

int64vec * leadExp64 ( poly  p)

Definition at line 769 of file walkSupport.cc.

770{
771 int N=rVar(currRing);
772 int *e=(int*)omAlloc((N+1)*sizeof(int));
774 int64vec* iv64=new int64vec(N);
775 for(int i=N;i>0;i--) { (*iv64)[i-1]=(int64)e[i];}
776 omFree(e);
777 return(iv64);
778}

◆ matIdLift()

matrix matIdLift ( ideal  Gomega,
ideal  M 
)

Definition at line 978 of file walkSupport.cc.

979{
980 ideal Mtmp = idLift(Gomega, M, NULL, FALSE, FALSE, TRUE, NULL);
981 int rows=IDELEMS(Gomega);
982 int cols=IDELEMS(Mtmp);
984 return res;
985}
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
Definition: ideals.cc:1105
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
#define M
Definition: sirandom.c:25

◆ nextt64()

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

Definition at line 560 of file walkSupport.cc.

561{
562 intvec* diffm=DIFF(G);
563 int s=diffm->rows();
564 tvec0=(int64)2;
565 tvec1=(int64)0;
566 intvec *tt;
567 for(int j=1; j<=s; j++)
568 {
569 tt=getNthRow(diffm,j);
570 int64 temptvec0, temptvec1;
571 gett64(tt,currw64,targw64,temptvec0, temptvec1);
572 delete tt;
573
574 //if tempt>0 both parts will be>0
575 if ( (temptvec1!=0) //that tempt is defined
576 &&
577 (temptvec0>0) && (temptvec1>0) //that tempt>0
578 )
579 {
580 if( ( (temptvec0) <= (temptvec1) ) //that tempt<=1
581 &&
582 ( ( (temptvec0) * (tvec1) ) <
583 ( (temptvec1) * (tvec0) ) )
584 )
585 { //that tempt<t
586 tvec0=temptvec0;
587 tvec1=temptvec1;
588 }
589 }
590 }
591 delete diffm;
592 return;
593}
int rows() const
Definition: intvec.h:96
intvec * DIFF(ideal G)
Definition: walkSupport.cc:435
intvec * getNthRow(intvec *v, int n)
Definition: walkSupport.cc:165
void gett64(intvec *listw, int64vec *currw64, int64vec *targw64, int64 &tvec0, int64 &tvec1)
Definition: walkSupport.cc:481

◆ nextw64()

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

Definition at line 604 of file walkSupport.cc.

606{
607 //to do (targw-currw)*tvec[0]+currw*tvec[1]
608 int64vec* tempv;
609 int64vec* nextweight;
610 int64vec* a=iv64Sub(targw,currw);
611 //no overflow can occur since both are>=0
612
613 //to test overflow
614 tempv=iv64Copy(a);
615 *a *= (nexttvec0);
616 for(int i=0; i<rVar(currRing); i++)
617 {
618 if( (nexttvec0) !=0 &&
619 (((*a)[i])/(nexttvec0))!=((*tempv)[i]) )
620 {
622 break;
623 }
624 }
625 delete tempv;
626 int64vec* b=currw;
627 tempv=iv64Copy(b);
628 *b *= (nexttvec1);
629 for(int i=0; i<rVar(currRing); i++)
630 {
631 if( (nexttvec1) !=0 &&
632 (((*b)[i])/(nexttvec1))!=((*tempv)[i]) )
633 {
635 break;
636 }
637 }
638 delete tempv;
639 nextweight=iv64Add(a,b);
640
641 for(int i=0; i<rVar(currRing); i++)
642 {
643 if( (((*a)[i])>=0 && ((*b)[i])>=0) ||
644 (((*a)[i])<0 && ((*b)[i])<0) )
645 {
646 if( (abs64((*a)[i]))>abs64((*nextweight)[i]) ||
647 (abs64((*b)[i]))>abs64((*nextweight)[i])
648 )
649 {
651 break;
652 }
653 }
654 }
655
656 //to reduce common factors of nextweight
657 int s=iv64Size(nextweight);
658 int64 g,temp;
659 g=(*nextweight)[0];
660 for (int i=1; i<s; i++)
661 {
662 temp=(*nextweight)[i];
663 g=gcd64(g,temp);
664 if (g==1) break;
665 }
666
667 if (g!=1) *nextweight /= g;
668
669 return(nextweight);
670}
int64vec * iv64Sub(int64vec *a, int64vec *b)
Definition: int64vec.cc:202
int iv64Size(int64vec *v)
Definition: walkSupport.h:37

◆ noPolysWithMoreThanTwoTerms()

BOOLEAN noPolysWithMoreThanTwoTerms ( ideal  Gw)

Definition at line 380 of file walkSupport.cc.

381{
382 int length=idealSize(Gw);
383 for(int i=length; i>0; i--)
384 {
385 //if(pLength(getNthPolyOfId(Gw,i))>2)
386 poly p=getNthPolyOfId(Gw,i);
387 if ((p!=NULL) && (pNext(p)!=NULL) && (pNext(pNext(p))!=NULL))
388 {
389 return FALSE;
390 }
391 }
392 return TRUE;
393}

◆ rCopyAndChangeA()

void rCopyAndChangeA ( int64vec w)

Definition at line 1000 of file walkSupport.cc.

1001{
1002 ring rnew=rCopy0(currRing);
1003 rComplete(rnew);
1004 rSetWeightVec(rnew,w->iv64GetVec());
1005 rChangeCurrRing(rnew);
1006}
void rChangeCurrRing(ring r)
Definition: polys.cc:15
void rSetWeightVec(ring r, int64 *wv)
Definition: ring.cc:5232
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:3450
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1421

◆ rGetGlobalOrderMatrix()

int64vec * rGetGlobalOrderMatrix ( ring  r)

Definition at line 1019 of file walkSupport.cc.

1020{
1021 int n=rVar(r);
1022 int64vec* res=new int64vec(n,n,(int64)0);
1023 if (rHasLocalOrMixedOrdering(r)) return res;
1024 int pos1=0;
1025 int pos2=0;
1026 int i=0;
1027 while(r->order[i]!=0 && pos2<n)
1028 {
1029 pos2=pos2+r->block1[i] - r->block0[i];
1030
1031 if(r->order[i]==ringorder_lp)
1032 {
1033 for(int j=pos1; j<=pos2; j++)
1034 (*res)[j*n+j]=(int64)1;
1035 }
1036 else if(r->order[i]==ringorder_dp)
1037 {
1038 for(int j=pos1;j<=pos2;j++)
1039 (*res)[pos1*n+j]=(int64)1;
1040 for(int j=1;j<=(pos2-pos1);j++)
1041 (*res)[(pos1+j)*n+(pos2+1-j)]=(int64)-1;
1042 }
1043 else if(r->order[i]==ringorder_Dp)
1044 {
1045 for(int j=pos1;j<=pos2;j++)
1046 (*res)[pos1*n+j]=(int64)1;
1047 for(int j=1;j<=(pos2-pos1);j++)
1048 (*res)[(pos1+j)*n+(pos1+j-1)]=(int64)1;
1049 }
1050 else if(r->order[i]==ringorder_wp)
1051 {
1052 int* weights=r->wvhdl[i];
1053 for(int j=pos1;j<=pos2;j++)
1054 (*res)[pos1*n+j]=(int64)weights[j-pos1];
1055 for(int j=1;j<=(pos2-pos1);j++)
1056 (*res)[(pos1+j)*n+(pos2+1-j)]=(int64)-1;
1057 }
1058 else if(r->order[i]==ringorder_Wp)
1059 {
1060 int* weights=r->wvhdl[i];
1061 for(int j=pos1;j<=pos2;j++)
1062 (*res)[pos1*n+j]=(int64)weights[j-pos1];
1063 for(int j=1;j<=(pos2-pos1);j++)
1064 (*res)[(pos1+j)*n+(pos1+j-1)]=(int64)1;
1065 }
1066
1067 else if(r->order[0]==ringorder_M)
1068 {
1069 int* weights=r->wvhdl[0];
1070 for(int j=pos1;j<((pos2+1)*(pos2+1));j++)
1071 (*res)[j]=(int64)weights[j];
1072 }
1073
1074 pos1=pos2+1;
1075 pos2=pos2+1;
1076 i++;
1077 }
1078
1079 return(res);
1080}
@ ringorder_lp
Definition: ring.h:77
@ ringorder_Dp
Definition: ring.h:80
@ ringorder_dp
Definition: ring.h:78
@ ringorder_Wp
Definition: ring.h:82
@ ringorder_wp
Definition: ring.h:81
@ ringorder_M
Definition: ring.h:74
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:760

◆ rGetGlobalOrderWeightVec()

int64vec * rGetGlobalOrderWeightVec ( ring  r)

Definition at line 1094 of file walkSupport.cc.

1095{
1096 int n=rVar(r);
1097 int64vec* res=new int64vec(n);
1098
1099 if (rHasLocalOrMixedOrdering(r)) return res;
1100
1101 int length;
1102
1103 if(r->order[0]==ringorder_lp)
1104 {
1105 (*res)[0]=(int64)1;
1106 }
1107 else if( (r->order[0]==ringorder_dp) || (r->order[0]==ringorder_Dp) )
1108 {
1109 length=r->block1[0] - r->block0[0];
1110 for (int j=0;j<=length;j++)
1111 (*res)[j]=(int64)1;
1112 }
1113 else if( (r->order[0]==ringorder_wp) || (r->order[0]==ringorder_Wp) ||
1114 (r->order[0]==ringorder_a) || (r->order[0]==ringorder_M) )
1115 {
1116 int* weights=r->wvhdl[0];
1117 length=r->block1[0] - r->block0[0];
1118 for (int j=0;j<=length;j++)
1119 (*res)[j]=(int64)weights[j];
1120 }
1121 else if( /*(*/ r->order[0]==ringorder_a64 /*)*/ )
1122 {
1123 int64* weights=(int64*)r->wvhdl[0];
1124 length=r->block1[0] - r->block0[0];
1125 for (int j=0;j<=length;j++)
1126 (*res)[j]=weights[j];
1127 }
1128
1129 return(res);
1130}
for(j=0;j< factors.length();j++)
Definition: facHensel.cc:129
@ ringorder_a
Definition: ring.h:70
@ ringorder_a64
for int64 weights
Definition: ring.h:71

◆ scalarProduct()

static long scalarProduct ( intvec a,
intvec b 
)
inlinestatic

Definition at line 811 of file walkSupport.cc.

812{
813 assume( a->length() == b->length());
814 int i, n = a->length();
815 long result = 0;
816 for(i=n-1; i>=0; i--)
817 result += (*a)[i] * (*b)[i];
818 return result;
819}
int length() const
Definition: intvec.h:94
return result
Definition: facAbsBiFact.cc:75

◆ scalarProduct64()

static int64 scalarProduct64 ( int64vec a,
int64vec b 
)
inlinestatic

Definition at line 266 of file walkSupport.cc.

267{
268 assume( a->length() == b->length());
269 int i, n = a->length();
270 int64 result = 0;
271 int64 temp1,temp2;
272 for(i=n-1; i>=0; i--)
273 {
274 temp1=(*a)[i] * (*b)[i];
275 if((*a)[i]!=0 && (temp1/(*a)[i])!=(*b)[i]) overflow_error=1;
276
277 temp2=result;
278 result += temp1;
279
280 //since both vectors always have nonnegative entries in init64
281 //result should be >=temp2
282 if(temp2>result) overflow_error=2;
283 }
284
285 return result;
286}
int length() const
Definition: int64vec.h:64

◆ sortRedSB()

ideal sortRedSB ( ideal  G)

Definition at line 1146 of file walkSupport.cc.

1147{
1148 int s=idealSize(G);
1149 poly* m=G->m;
1150 poly p,q;
1151 for (int i=0; i<(s-1); i++)
1152 {
1153 for (int j=0; j<((s-1)-i); j++)
1154 {
1155 p=m[j];
1156 q=m[j+1];
1157 if (pLmCmp(p,q)==1)
1158 {
1159 m[j+1]=p;
1160 m[j]=q;
1161 }
1162 }
1163 }
1164 return(G);
1165}
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105

◆ tdeg()

int tdeg ( poly  p)

Definition at line 35 of file walkSupport.cc.

36{
37 int res=0;
38 if(p!=NULL) res=pTotaldegree(p);
39 return(res);
40}

Variable Documentation

◆ overflow_error

EXTERN_VAR BOOLEAN overflow_error

Definition at line 15 of file walkSupport.cc.