40#define poly_write(p) wrp(p);PrintLn()
70 int r1,r2=0,rr,
l=(*syzstr->
Tl)[
index];
83 while ((rr>=0) && ((syzstr->
resPairs[
index])[rr].order==actdeg)
115 while ((tcp!=
NULL) &&
116 ((tcp->first_poly!=
i)||(tcp->second_poly!=r1))) tcp = tcp->next;
158 tcp->second_poly =
i;
207 tso.lcm =
p = nP->m[
i];
218 tso.order += (*syzstr->
cw)[jj-1];
225 tso.isNotMinimal = (poly)1;
241 tso.syz =
pAdd(
pp,tso.syz);
245Print(
"erzeuge Paar im Modul %d,%d mit: \n",
index,tso.order);
290 memset(&tso,0,
sizeof(tso));
302 tso.order += (*syzstr->
cw)[jj-1];
309 tso.isNotMinimal =
NULL;
312 tso.syz =
pHead(syz);
315 tso.lcm =
pHead(tso.syz);
319Print(
"erzeuge Halbpaar im Module %d,%d mit: \n",
index,tso.order);
339#ifndef USE_HEURISTIC2
342 (*result)[i1] = i1+1;
347 while ((ll>0) && (o_r->m[ll-1]==
NULL)) ll--;
353 while ((
l<ll) && (!isDivisible))
357 isDivisible = isDivisible ||
365Print(
"streiche Paar im Modul %d,%d mit: \n",
index,nextPairs[
i].order);
373 if (*secondpairs==
NULL) *secondpairs =
new intvec(howmuch);
374 (**secondpairs)[i2] =
i+1;
404 if (redWith==
NULL)
return toRed;
408 while ((
j>0) && (redWith->m[
j-1]==
NULL))
j--;
409 if ((toRed==
NULL) || (
j==0))
return toRed;
427 if (toRed==
NULL)
break;
434 if ((
i>=
j) || (q==
NULL))
break;
451 if (q!=
NULL)
PrintS(
"Hier ist was schief gelaufen!\n");
469 (*tempV)[
i] = (*arg)[
i+ii];
480 (*
result)[ii] = (*tempV)[ii];
492 int howmuch,
int index,
int actord,
int* toSub,
493 int *maxindex,
int *maxdeg)
508 int there_are_superfluous=0;
514 if ((nextPairs==
NULL) || (howmuch==0))
return;
516 while ((ks>0) && (syzstr->
res[
index+1]->m[ks-1]==
NULL)) ks--;
519 ((redset[kres-1].
p==
NULL) || (redset[kres-1].order>actord))) kres--;
520 while ((kres<(*syzstr->
Tl)[
index]) &&
521 (redset[kres-1].order!=0) && (redset[kres-1].order<=actord)) kres++;
531 if (actord<temp1_hilb->
length())
533 toGo = (*temp1_hilb)[actord];
535Print(
"\nStze toGo im Modul %d und Grad %d auf: %d\n",1,actord-1,toGo);
546Print(
"\nStze toGo im Modul %d und Grad %d auf: %d\n",
index,actord-1,toGo);
570 nextPairs[kk].p = nextPairs[kk].syz = nextPairs[kk].lcm =
NULL;
585 if (spl1!=
NULL)
delete spl1;
589 if ((tso.p1!=
NULL) && (tso.p2!=
NULL))
597PrintS(
"reduziere Paar mit: \n");
612 && ((redset[
j].ind1!=tso.ind1) || (redset[
j].ind2!=tso.ind2)))
626 redset[
j].length,
NULL);
650PrintS(
"erhalte Paar mit: \n");
658Print(
" mit index %d, %d ",tso.ind1,tso.ind2);
691 if (actord-
index>*maxdeg) *maxdeg = actord-
index;
700 if (there_are_superfluous>=0)
707 if (tso.ind2==nextPairs[jj].ind2)
711 for (j2=
j;j2<spl1->
length()-1;j2++)
713 (*spl1)[j2] = (*spl1)[j2+1];
723 if (there_are_superfluous==0) there_are_superfluous = 1;
735 tso.p = tso.syz = tso.lcm =
NULL;
745Print(
"naechstes i ist: %d",
i);
749 if ((kk<0) && (there_are_superfluous>0))
753 spl1 = ivStrip(spl2);
757 there_are_superfluous = -1;
763 if ((kk<0) && (toGo>0))
778 if (spl3!=
NULL)
delete spl3;
801 if (actord+1<temp_hilb->
length())
804Print(
"\nSetze fuer Modul %d im Grad %d die Wert: \n",
index+1,actord);
805(temp_hilb)->
show(0,0);
808 for (
int j=
k;
j>actord;
j--)
819Print(
"\nSubtrahiere im Modul %d im Grad %d den Wert: %d\n",
index,actord-1,toSub);
827 for (
int j=cont_hilb->
length()-1;
j>actord;
j--)
849 while ((
i<(*syzstr->
Tl)[0]) && (((sPairs)[
i].syz==
NULL) ||
850 ((sPairs)[
i].order<deg)))
852 if ((
i>=(*syzstr->
Tl)[0]) || ((sPairs)[
i].order>deg))
return;
853 while ((
i<(*syzstr->
Tl)[0]) && (((sPairs)[
i].syz==
NULL) ||
854 ((sPairs)[
i].order==deg)))
856 if ((sPairs)[
i].syz!=
NULL)
859PrintS(
"reduziere Erzeuger: \n");
864PrintS(
"erhalte Erzeuger: \n");
868 if ((sPairs)[
i].syz !=
NULL)
877 if ((sPairs)[
i].isNotMinimal==
NULL)
879 PrintS(
"\nminimal generator: ");
885 res->m[
k] = (sPairs)[
i].syz;
890 if (1>*maxindex) *maxindex = 1;
891 if (deg-1>*maxdeg) *maxdeg = deg-1;
909 (*syzstr->
betti)[0] = 1;
916 while ((
k>0) && (toreor->m[
k-1]==
NULL))
k--;
919 for (
int j=0;
j<
k;
j++)
922 reor->m[
j] = toreor->m[
j];
926 for (
int j=0;
j<togo;
j++)
931 while ((
l<
k) && (syzstr->
res[
i]->m[
j]!=reor->m[
l]))
l++;
934 toreor->m[
m] = reor->m[
l];
954 int maxindex=0,maxdeg=0;
989 if (origR != syzstr->
syRing)
992 temp->m[
i] =
pCopy( arg->m[
i]);
993 if (temp->m[
i]!=
NULL)
996 if (
j<actdeg) actdeg =
j;
1018 while (nextPairs!=
NULL)
1021Print(
"compute %d Paare im Module %d im Grad %d \n",howmuch,
index,actdeg+
index);
1042Print(
"Bilde neue Paare in Modul %d!\n",
index);
1048Print(
"Bilde neue Paare in Modul %d!\n",
index+1);
1057PrintS(
"minimal resolution:\n");
1058for (
int ti=1;ti<=*
length;ti++)
1062PrintS(
"full resolution:\n");
1063for (
int ti=1;ti<=*
length;ti++)
1069Print(
"Criterion %d times applied\n",crit);
1070Print(
"Criterion1 %d times applied\n",crit1);
1071Print(
"%d superfluous pairs\n",spfl);
1072Print(
"%d pairs considered\n",cons_pairs);
1073Print(
"Criterion fails %d times\n",crit_fails);
1083 if (origR != syzstr->
syRing)
static int si_min(const int a, const int b)
void resize(int new_length)
void show(int mat=0, int spaces=0) const
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
static int show(unsigned long offset, char *close)
intvec * hFirstSeries(ideal A, intvec *module_w, ideal Q, intvec *wdegree)
#define idDelete(H)
delete an ideal
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static BOOLEAN length(leftv result, leftv arg)
#define IMATELEM(M, I, J)
KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, poly spNoether)
Bpoly == Bpoly - m*p; where m is a monom Does not destroy p and m assume (*l <= 0 || pLength(p) == *l...
void kBucketDestroy(kBucket_pt *bucket_pt)
void kBucketInit(kBucket_pt bucket, poly lm, int length)
poly kBucketExtractLm(kBucket_pt bucket)
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
const poly kBucketGetLm(kBucket_pt bucket)
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
#define omFreeSize(addr, size)
static int index(p_Length length, p_Ord ord)
static int pLength(poly a)
static long p_FDeg(const poly p, const ring r)
#define __p_Mult_nn(p, n, r)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatibility layer for legacy polynomial operations (over currRing)
static long pTotaldegree(poly p)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
#define pGetComp(p)
Component.
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
#define pGetExp(p, i)
Exponent.
#define pCopy(p)
return a copy of the poly
#define pLmDivisibleByNoComp(a, b)
like pLmDivisibleBy, does not check components
poly prCopyR(poly p, ring src_r, ring dest_r)
void PrintS(const char *s)
ring rAssure_dp_C(const ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static int idElem(const ideal F)
number of non-zero polys in F
syStrategy syHilb(ideal arg, int *length)
static void syCreateNewPairs_Hilb(syStrategy syzstr, int index, int actdeg)
static void syRedGenerOfCurrDeg_Hilb(syStrategy syzstr, int deg, int *maxindex, int *maxdeg)
void sySetNewHilb(syStrategy syzstr, int toSub, int index, int actord)
static void syReOrdResult_Hilb(syStrategy syzstr, int maxindex, int maxdeg)
static intvec * syLinStrat2(SSet nextPairs, syStrategy syzstr, int howmuch, int index, intvec **secondpairs)
static void syOrder_Hilb(poly p, syStrategy syzstr, int index)
void sySPRedSyz(syStrategy syzstr, sSObject redWith, poly q=NULL)
static poly syRed_Hilb(poly toRed, syStrategy syzstr, int index)
static void syRedNextPairs_Hilb(SSet nextPairs, syStrategy syzstr, int howmuch, int index, int actord, int *toSub, int *maxindex, int *maxdeg)
static void syHalfPair(poly syz, int newEl, syStrategy syzstr, int index)
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw=NULL)
EXTERN_VAR long * currShiftedComponents
void syCompactify1(SSet sPairs, int *sPlength, int first)
EXTERN_VAR int * currcomponents
void syEnlargeFields(syStrategy syzstr, int index)
void syEnterPair(syStrategy syzstr, SObject *so, int *sPlength, int index)
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
long ** ShiftedComponents
void syDeletePair(SObject *so)
int syInitSyzMod(syStrategy syzstr, int index, int init=17)