30 int* Components,
long* ShiftedComponents);
56 (*so).isNotMinimal =
NULL;
75 (*so).isNotMinimal =
NULL;
95 (*argso).isNotMinimal =
NULL;
97 (*argso).reference = -1;
109 while (
k+kk<sPlength)
137 while (
k+kk<*sPlength)
166 static int syzcomp2dpc_test(poly p1, poly p2)
168 long c1, c2, cc1, cc2, ccc1, ccc2, ec1, ec2;
175 ec1 = p1->exp[
currRing->typ[1].data.syzcomp.place];
176 ec2 = p2->exp[
currRing->typ[1].data.syzcomp.place];
180 Warn(
"Shifted comp of p1 out of sync. should %d, is %d", ccc1, ec1);
185 Warn(
"Shifted comp of p2 out of sync. should %d, is %d", ccc2, ec2);
203 if (o1 > o2)
return 1;
204 if (o1 < o2)
return -1;
220 if (o1==o2)
return 0;
279 if ((
j<0) || ((*iv)[
i]<
j))
307 (resPairs[0])[
i].syz = (arg->m[(*iv)[
i]-1]);
308 arg->m[(*iv)[
i]-1] =
NULL;
323 (resPairs[0])[
i].syz = arg->m[
j];
325 (resPairs[0])[
i].order = (*iv)[
j];
329 if (iv!=
NULL)
delete iv;
339 long new_comps = 0, new_space,
max;
344 if (sc[
i-1] + 1 < sc[
i]) holes++;
362 assume(new_space < SYZ_SHIFT_BASE && new_space >= 4);
364 long* tc = (
long*)
omAlloc(n*
sizeof(
long));
369 if (sc[
i-1] + 1 < sc[
i])
371 tc[
i] = tc[
i-1] + new_space;
439 int till=(*syzstr->
Tl)[
index-1];
442 if (Pairs[
i].syz!=
NULL)
480 if (realcomp==0) realcomp=1;
493 if (trind1[orc]>tc+1)
break;
494 else if (trind1[orc] == tc+1)
507 WerrorS(
"orderedRes to small");
518 if ((LONG_MAX - same_comp) <= shind[ie-1])
521 assume((LONG_MAX - same_comp) > shind[ie-1]);
527 assume(ie == 1 || shind[ie-1] > 0);
528 shind[ie] = shind[ie-1] + same_comp;
540 if ((same_comp && prev + 2 >=
next) || (!same_comp &&
next - prev < 4))
545 assume((same_comp && prev + 2 <
next) || (!same_comp &&
next - prev >= 4));
551 for (
k=ie;
k >
j+1;
k--) shind[
k] = shind[
k-1];
556 shind[
j+1] = prev + 1;
557 assume(shind[
j+1] + 1 < shind[
j+2]);
563 shind[
j+1] = prev + ((
next - prev) >> 1);
564 assume (shind[
j] + 1 < shind[
j+1] && shind[
j+1] + 1 < shind[
j+2]);
592 trind[
k] = trind[
k-1];
593 trind[realcomp] =
j+1;
598 #ifdef OLD_PAIR_ORDER
600 int howmuch,
int index)
602 int i=howmuch-1,i1=0,
l,ll;
621 while ((
l<ll) && (!isDivisible))
625 isDivisible = isDivisible ||
641 spSpolyCreate(tso.p2, tso.p1,
NULL,spSpolyLoop_General);
651 int howmuch,
int index)
653 int i=howmuch-1,i1=0,i2,i3,
l,ll;
672 while ((
l<ll) && (!isDivisible))
676 isDivisible = isDivisible ||
702 for (i1=0;i1<howmuch;i1++)
713 if (((*spl)[i1]>=0) && ((*spl)[i1]<(*spl)[i2]))
721 (*result)[i3] = i2+1;
770 int howmuch,
int index)
788 if ((nextPairs==
NULL) || (howmuch==0))
return;
790 while ((ks>0) && (syzstr->
res[
index+1]->m[ks-1]==
NULL)) ks--;
796 tso = nextPairs[(*spl1)[
i]-1];
797 if ((tso.p1!=
NULL) && (tso.p2!=
NULL))
803 tso.syz =
pHead(tso.lcm);
878 tso.isNotMinimal =
p;
893 syzstr->
res[
index+1]->m[ks] = tso.syz;
904 nextPairs[(*spl1)[
i]-1] = tso;
923 while ((
i<(*syzstr->
Tl)[
index-1]) && (((sPairs)[
i].syz==
NULL) ||
924 ((sPairs)[
i].order<deg)))
926 if ((
i>=(*syzstr->
Tl)[
index-1]) || ((sPairs)[
i].order>deg))
return;
927 while ((
i<(*syzstr->
Tl)[
index-1]) && (((sPairs)[
i].syz==
NULL) ||
928 ((sPairs)[
i].order==deg)))
930 if ((sPairs)[
i].syz!=
NULL)
934 ((sPairs)[
i].syz!=
NULL))
948 if ((sPairs)[
i].syz !=
NULL)
957 if ((sPairs)[
i].isNotMinimal==
NULL)
967 (sPairs)[
i].syzind =
k;
977 (sPairs)[
i].syzind = -1;
988 int ll,
k,no=(*so).order,sP=*sPlength,
i;
990 if ((sP==0) || (sPairs[sP-1].order<=no))
1001 if ((sPairs[an].order<=no) && (sPairs[an+1].order>no))
1006 else if ((sPairs[en].order<=no) && (sPairs[en+1].order>no))
1011 else if (sPairs[an].order>no)
1018 PrintS(
"Hier ist was faul!\n");
1023 if (sPairs[
i].order <= no)
1029 for (
k=(*sPlength);
k>ll;
k--)
1040 if (*sPlength>=(*syzstr->
Tl)[
index])
1043 for (ll=0;ll<(*syzstr->
Tl)[
index];ll++)
1054 temp[ll].isNotMinimal = (syzstr->
resPairs[
index])[ll].isNotMinimal;
1056 temp[ll].reference = (syzstr->
resPairs[
index])[ll].reference;
1075 int first,pos,jj,j1;
1081 while ((
k>0) && (rs[
k-1]==
NULL))
k--;
1082 if (newEl>=
k)
return;
1090 for (
j=newEl;
j<
k;
j++)
1095 for (
i=first;
i<pos;
i++)
1128 for (
i=first;
i<pos;
i++)
1136 for (ll=0;ll<(*syzstr->
Tl)[
index];ll++)
1147 temp[ll].isNotMinimal = (syzstr->
resPairs[
index])[ll].isNotMinimal;
1154 tso.lcm =
p = nPm[ii];
1165 tso.order += (*syzstr->
cw)[jj-1];
1172 tso.isNotMinimal =
NULL;
1183 int *howmuch,
int * actdeg,
int an,
int en)
1185 int newdeg=*actdeg,newindex=-1,
i,t,sldeg;
1195 sldeg = (*actdeg)+*
index;
1203 if ((resPairs[*
index])[
i].order == sldeg)
1209 && ((resPairs[*
index])[
i].order == sldeg))
1226 if ((resPairs[*
index])[
i].order == sldeg)
1232 && ((resPairs[*
index])[
i].order == *actdeg))
1259 if ((resPairs[*
index])[
i].order > t)
1260 t = (resPairs[*
index])[
i].order;
1262 if ((t>*actdeg+*
index) && ((newdeg==*actdeg) || (t<newdeg+*
index)))
1305 int *howmuch,
int * actdeg,
int mindeg)
1437 Print(
"In module %d: \n",
j);
1450 Print(
"%d elements of degree %ld\n",
i,deg);
1471 for (
int i=0;
i<init;
i++)
1482 syzstr->
sev[
index] = (
unsigned long*)
omAlloc0(init*
sizeof(
unsigned long));
1546 for (
j=0;
j<(*syzstr->
Tl)[
i];
j++)
1622 delete syzstr->
betti;
1649 ring origR=syzstr->
syRing;
1662 ri1 = totake[
i-1]->m;
1708 fullres[
i-1]->m[
j] = q;
1733 fullres[
i-1] =
res[
i];
1769 if ((*weights)[
i]!=(*(syzstr->
weights[0]))[
i])
1787 if ((fullres==
NULL) && (minres==
NULL))
1839 WerrorS(
"No resolution found");
1843 while ((
i>0) && (r[
i-1]==
NULL))
i--;
1858 while ((
l>0) && (rP[
l-1]==
NULL))
l--;
1859 if (
l==0)
return -1;
1864 while ((
i<(*syzstr->
Tl)[
l]) &&
1866 (rP[
l][
i].isNotMinimal!=
NULL))
1870 if ((
i<(*syzstr->
Tl)[
l]) &&
1872 (rP[
l][
i].isNotMinimal==
NULL))
1942 PrintS(
"No resolution defined\n");
1948 if (resolution==
NULL)
1955 (*resolution)[0] = syzstr->
res[1]->rank;
1960 while ((
j<(*syzstr->
Tl)[
k]) &&
1963 if (rP[
k][
j].isNotMinimal==
NULL)
1964 ((*resolution)[
k+1])++;
1984 (*resolution)[
k+1] =
idElem(rr[
k]);
1995 if ((
k>=resolution->
length()) || ((*resolution)[
k]==0))
1997 Print(
"%d",(*resolution)[
k]);
2005 if ((
k>=resolution->
length()) || ((*resolution)[
k]==0))
2008 if (((
k+1)>=resolution->
length()) || ((*resolution)[(
k+1)]==0))
2019 if ((
k>=resolution->
length()) || ((*resolution)[
k]==0))
2029 PrintS(
"resolution not minimized yet\n");
2041 static poly syStripOut(poly
p,
intvec * toStrip)
2043 if (toStrip==
NULL)
return p;
2101 poly tempStripped=
NULL;
2105 while ((ii<ordn->
length()) && ((*ordn)[ii]!=-1) &&
2106 (sPairs[(*ordn)[ii]].syzind!=toMin))
2113 if (sPairs[
i].isNotMinimal!=
NULL)
2117 pisN = sPairs[
i].isNotMinimal;
2155 int ii=0,
i,tc,lp,ltS=-1;
2158 poly tempStripped=
NULL;
2162 while ((ii<ordn->
length()) && ((*ordn)[ii]!=-1) &&
2163 (sPairs[(*ordn)[ii]].syzind!=toMin))
2170 if (sPairs[
i].isNotMinimal!=
NULL)
2214 changes =
new intvec(rj+1,1,-1);
2215 while ((rj>0) && (ri->m[rj-1]==
NULL)) rj--;
2221 ri->m[
j] = ri->m[
j+
k];
2222 (*changes)[
j+
k+1] =
j+1;
2230 for (jj=
j;jj<rj;jj++)
2261 for (
int i=(*syzstr->
Tl)[
index-1]-1;
i>=0;
i--)
2279 int i,
j=0,
k=-1,
l,ii;
2286 if (sPairs[
i].syzind>
k)
2290 l = sPairs[
i].syzind;
2295 if (sPairs[
i].syzind<
l)
2297 l = sPairs[
i].syzind;
2324 tres[0] = syzstr->
res[1];
2352 if ((sPairs[
i].isNotMinimal==
NULL) && (sPairs[
i].
lcm!=
NULL))
2354 l = sPairs[
i].syzind;
2371 for (
i=(*syzstr->
Tl)[0]-1;
i>=0;
i--)
2373 if (sPairs[
i].syzind>=0)
2375 tres[1]->m[sPairs[
i].syzind] =
pCopy(syzstr->
res[1]->m[sPairs[
i].syzind]);
2464 for (
i=0;
i<=arg->rank;
i++)
2476 if (temp->m[
i]!=
NULL)
2479 if (
j<actdeg) actdeg =
j;
2503 while (nextPairs!=
NULL)
2536 if (origR != syzstr->
syRing)
2588 syzstr->
length = maxlength;
2601 for (
i=0;
i<=arg->rank;
i++)
2608 syzstr->
Tl =
new intvec(maxlength);
2613 if (temp->m[
i]!=
NULL)
2616 if (
j<actdeg) actdeg =
j;
2636 syzstr->
sev = (
unsigned long **)
omAlloc0((maxlength+1)*
sizeof(
unsigned long *));
2646 while (nextPairs!=
NULL)
2668 if (
index<(maxlength-1))
2678 if (origR != syzstr->
syRing)
static int si_max(const int a, const int b)
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
static int max(int a, int b)
void WerrorS(const char *s)
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
#define idDelete(H)
delete an ideal
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
static BOOLEAN length(leftv result, leftv arg)
intvec * ivCopy(const intvec *o)
KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
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 kBucketTakeOutComp(kBucket_pt bucket, long comp, poly *r_p, int *l)
void kBucketDestroy(kBucket_pt *bucket_pt)
void kBucketInit(kBucket_pt bucket, poly lm, int length)
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)
#define omRealloc0Size(addr, o_size, size)
#define omMemcpyW(p1, p2, l)
#define TEST_OPT_NO_SYZ_MINIM
static int index(p_Length length, p_Ord ord)
void pEnlargeSet(poly **p, int l, int increment)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
static void p_Delete(poly *p, const ring r)
static unsigned pLength(poly a)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void rChangeCurrRing(ring r)
Compatiblity 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 pSetCoeff(p, n)
deletes old coeff before setting the new one
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
#define pGetOrder(p)
Order.
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
#define pGetExp(p, i)
Exponent.
void pNorm(poly p, const ring R=currRing)
#define pInit()
allocates a new monomial and initializes everything to 0
void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R=currRing)
Splits *p into two polys: *q which consists of all monoms with component == comp and *p of all other ...
#define pCopy(p)
return a copy of the poly
#define pSortCompCorrect(p)
Assume: If considerd only as poly in any component of p (say, monomials of other components of p are ...
#define pLmDivisibleByNoComp(a, b)
like pLmDivisibleBy, does not check components
poly prMoveR(poly &p, ring src_r, ring dest_r)
poly prHeadR(poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
poly prCopyR(poly p, ring src_r, ring dest_r)
void PrintS(const char *s)
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
void rDelete(ring r)
unconditionally deletes fields in r
ring rAssure_dp_S(const ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int idElem(const ideal F)
count non-zero elements
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 SSet syChosePairsPutIn(syStrategy syzstr, int *index, int *howmuch, int *actdeg, int an, int en)
poly syRedtail(poly p, syStrategy syzstr, int index)
void syCopyPair(SObject *argso, SObject *imso)
void syPrint(syStrategy syzstr, const char *sn)
void syEnterPair(SSet sPairs, SObject *so, int *sPlength, int)
void syKillComputation(syStrategy syzstr, ring r)
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw)
static void syCreateNewPairs(syStrategy syzstr, int index, int newEl)
static poly syStripOutCopy(poly p, intvec *toStrip)
static poly syMinimizeP1(int toMin, syStrategy syzstr, intvec *ordn, int index, intvec *toStrip)
int syDim(syStrategy syzstr)
syStrategy syMinimize(syStrategy syzstr)
syStrategy syCopy(syStrategy syzstr)
static intvec * syLinStrat(SSet nextPairs, syStrategy syzstr, int howmuch, int index)
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
int sySize(syStrategy syzstr)
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy, resolvente totake)
static void syRedGenerOfCurrDeg(syStrategy syzstr, int deg, int index)
void syCompactify1(SSet sPairs, int *sPlength, int first)
static intvec * syToStrip(syStrategy syzstr, int index)
int syInitSyzMod(syStrategy syzstr, int index, int init)
void syKillEmptyEntres(resolvente res, int length)
static int syLengthInt(int i)
static void syPrintEmptySpaces1(int i)
void syEnlargeFields(syStrategy syzstr, int index)
void p_Setm_Syz(poly p, ring r, int *Components, long *ShiftedComponents)
static void pResetSetm(poly p)
void syInitializePair(SObject *so)
static int syChMin(intvec *iv)
long syReorderShiftedComponents(long *sc, int n)
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim, int *row_shift, intvec *weights)
long * currShiftedComponents
static void syRedNextPairs(SSet nextPairs, syStrategy syzstr, int howmuch, int index)
static BOOLEAN syOrder(poly p, syStrategy syzstr, int index, int realcomp)
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
static intvec * syOrdPairs(SSet sPairs, int length)
void syDeletePair(SObject *so)
syStrategy syLaScala(ideal arg, int &maxlength, intvec *weights)
static resolvente syReadOutMinimalRes(syStrategy syzstr, BOOLEAN computeStd=FALSE)
void syResetShiftedComponents(syStrategy syzstr, int index, int hilb)
syStrategy syLaScala3(ideal arg, int *length)
static void syPrintEmptySpaces(int i)
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
void syMinimizeResolvente(resolvente res, int length, int first)
#define SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE
long ** ShiftedComponents