37 int maxxx = (*w)->
length();
53 if (arg->m[
i-maxxx]!=
NULL)
66 (**w)[
i+1] = (*w1)[
i+maxxx];
91 poly Unit1,Unit2,actWith;
92 int len,
i,
j,ModComp,
m,
k,
l;
105 while ((
j>0) && (!syz->m[
j-1]))
j--;
114 for (
l=
k;
l<
j-1;
l++) syz->m[
l] = syz->m[
l+1];
128 while ((
j>0) && (syz->m[
j-1]==
NULL))
j--;
132 while ((
i<
j) && (!existsUnit))
148 if ((len==0) ||((
l>0) && (
l<len)))
157 if (len>0) existsUnit =
TRUE;
169 for (
k=
i;
k<
j-1;
k++) syz->m[
k] = syz->m[
k+1];
187 syz->m[
k] =
pSub(syz->m[
k],
192 syz->m[
l] = syz->m[
l+1];
204 pDelete(&(
mod->m[ModComp-1 - curr_syz_limit]));
227 poly actWith=syz->m[elnum];
229 if (from<0) from = 0;
231 syz->m[elnum] =
NULL;
237 poly tmp=syz->m[from];
242 syz->m[from] =
pSub(tmp,
312 if (reddeg0->m[
i]!=
NULL)
317 (*have_del)[
j-1] = 1;
325 j = to_del->length();
328 if ((*to_del)[
j-1]==1)
351 if (to_del!=
NULL)
delete to_del;
365 if (syzIndex<1) syzIndex=1;
372 while ((syzIndex<length-1) && (
res[syzIndex]!=
NULL) && (
res[syzIndex+1]!=
NULL))
411 if (maxlength!=-1) *length = maxlength+1;
413 if ((wlength!=0) && (*length!=wlength))
416 wtmp[0]=(*weights)[0];
427 if (syz_ring != origR)
438 if ((weights!=
NULL) && (*weights!=
NULL)&& ((*weights)[0]!=
NULL))
442 WarnS(
"wrong weights given(1):"); (*weights)[0]->show();
PrintLn();
449 if ((weights==
NULL) || (*weights==
NULL) || ((*weights)[0]==
NULL))
460 if ((weights!=
NULL) && (*weights!=
NULL)&& ((*weights)[0]!=
NULL))
473 #endif // HAVE_PLURAL 485 setRegularity =
FALSE;
490 setRegularity =
FALSE;
495 ((maxlength==-1) || (syzIndex<=maxlength)))
500 if (syzIndex+1==*length)
504 for (
j=0;
j<*length;
j++)
507 if (*weights!=
NULL) tempW[
j] = (*weights)[
j];
523 if (minim || (syzIndex!=0))
528 res[syzIndex] = temp;
543 completeMinim=(syzIndex!=maxlength) || (maxlength ==-1) || (hom!=
isHomog);
549 if ((minim)||(syzIndex>1))
570 (*weights)[syzIndex] =
new intvec(
k);
600 for (
i=1;
i<=syzIndex;
i++)
608 if (origR != syz_ring)
611 for (
i=0;
i<=syzIndex;
i++)
626 const ideal idSaveCurrRingQuotient =
currRing->qideal;
689 currRing->qideal = idSaveCurrRingQuotient;
710 q = outp =
pHead(inp);
724 int i,
j,
k, subFromRank=0;
727 if (
idIs0(
id))
return 0;
734 while ((
i>0) && (temp->m[
i-1]==
NULL))
i--;
741 while ((
j<
i) && (temp->m[
j]==
NULL))
j++;
749 if ((
k>=0) && (
index==0)) subFromRank++;
757 while ((
j<
i) && (temp->m[
j]==
NULL))
j++;
778 (*tocancel)[
i-1] = tocan[
i-1];
796 int i,
j=0,
k=0,
l,rows,cols,mr;
797 int *temp1,*temp2,*temp3;
833 Warn(
"betti-command: Input is not homogeneous!");
837 if (weights==
NULL) weights=
w;
840 while ((r0_len>0) && (
res[0]->
m[r0_len-1]==
NULL)) r0_len--;
851 temp1 = (
int*)
omAlloc0((
l+1)*
sizeof(int));
852 temp2 = (
int*)
omAlloc((
l+1)*
sizeof(int));
856 for (
i=0;
i<cols-1;
i++)
859 memset(temp2,0,(
l+1)*
sizeof(
int));
869 WerrorS(
"input not a resolvent");
875 if (temp2[
j+1]-
i>rows) rows = temp2[
j+1]-
i;
876 if (temp2[
j+1]-
i<mr) mr = temp2[
j+1]-
i;
889 if (rows <(*weights)[
j]+1) rows=(-mr)+(*weights)[
j]+1;
905 (*result)[(-mr)*cols] = rkl;
906 if ((!
idIs0(
res[0])) && ((*result)[(-mr)*cols]==0))
907 (*
result)[(-mr)*cols] = 1;
909 tocancel = (
int*)
omAlloc0((rows+1)*
sizeof(int));
910 memset(temp1,0,(
l+1)*
sizeof(
int));
913 memset(temp2,0,
l*
sizeof(
int));
917 memset(temp2,0,
l*
sizeof(
int));
923 for(
j=0;
j<=rows+mr;
j++)
929 for (
i=0;
i<cols-1;
i++)
932 memset(temp2,0,
l*
sizeof(
int));
950 for (
j=mr;
j<rows+mr;
j++)
957 memset(tocancel,0,(rows+1)*
sizeof(
int));
969 for (
j=0;
j<=rows;
j++)
981 if ((tomin) && (mr<0))
983 for (
j=1;
j<=rows+mr+1;
j++)
985 for (
k=1;
k<=cols;
k++)
990 for (
j=rows+mr+1;
j<=rows+1;
j++)
992 for (
k=1;
k<=cols;
k++)
1010 for (
i=0;
i<exactresult->
rows();
i++)
1012 for (
j=0;
j<exactresult->
cols();
j++)
1017 if (row_shift!=
NULL) *row_shift = mr;
1040 if ((leng>=1) && (*(weights+1)!=
NULL))
1042 delete *(weights+1);
1060 int i,
j,
k,rsmin=0,rsmax=0,rs=0;
1066 for (
i=1;
i<length;
i++)
1068 if (weights[
i] !=
NULL)
1070 for (
j=1;
j<(weights[
i])->length();
j++)
1072 if ((*(weights[
i]))[
j]-
i<rsmin) rsmin = (*(weights[
i]))[
j]-
i;
1073 if ((*(weights[
i]))[
j]-
i>rsmax) rsmax = (*(weights[
i]))[
j]-
i;
1078 while (weights[
i] !=
NULL)
i++;
1085 if (
k>rsmax) rsmax =
k;
1086 if (
k<rsmin) rsmin =
k;
1089 for (
j=1;
j<(weights[0])->length();
j++)
1091 if ((*weights[0])[
j]>rsmax) rsmax = (*weights[0])[
j];
1092 if ((*weights[0])[
j]<rsmin) rsmin = (*weights[0])[
j];
1098 tocancel =
new intvec(rs);
1100 if (
res[0]->rank==0)
1106 for (
i=1;
i<(weights[0])->length();
i++)
1110 while (weights[
i]!=
NULL)
1112 for (
j=1;
j<(weights[
i])->length();
j++)
1131 tocancel =
new intvec(1);
1135 (*result)[0] =
res[0]->rank;
1136 for (
i=0;
i<length;
i++)
1155 for (
j=0;
j<rs-1;
j++)
1164 (*result)[
i+1] -= (*tocancel)[0];
1165 (*result)[
i+2] -= (*tocancel)[0];
1171 for(
i=rsmin;
i<=rsmax;
i++)
#define TEST_OPT_NOTREGULARITY
void p_SetModDeg(intvec *w, ring r)
ideal SCAQuotient(const ring r)
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
#define TEST_OPT_DEGBOUND
#define idDelete(H)
delete an ideal
Compatiblity layer for legacy polynomial operations (over currRing)
void syMinimizeResolvente(resolvente res, int length, int first)
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
static int rGetCurrSyzLimit(const ring r)
#define omFreeSize(addr, size)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
intvec * ivCopy(const intvec *o)
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
#define pVectorHasUnitB(p, k)
syStrategy syResolution(ideal arg, int maxlength, intvec *w, BOOLEAN minim)
void WerrorS(const char *s)
static void syMinStep1(resolvente res, int length)
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
#define pGetComp(p)
Component.
static BOOLEAN rField_has_simple_inverse(const ring r)
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void id_Shift(ideal M, int s, const ring r)
#define pVectorHasUnit(p, k, l)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define TEST_OPT_NO_SYZ_MINIM
static long pTotaldegree(poly p)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
bool ncExtensions(int iMask)
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
static poly sypCopyConstant(poly inp)
static long p_FDeg(const poly p, const ring r)
static void syDeleteAbove1(ideal up, int k)
static int si_max(const int a, const int b)
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
ideal kInterRedOld(ideal F, ideal Q)
void PrintS(const char *s)
static void syDeleteAbove(ideal up, int k)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static short scaFirstAltVar(ring r)
static int index(p_Length length, p_Ord ord)
void rSetSyzComp(int k, const ring r)
void rChangeCurrRing(ring r)
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
ideal idInit(int idsize, int rank)
initialise an ideal / module
static void syMinStep(ideal mod, ideal syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
ideal id_Jet(ideal i, int d, const ring R)
static BOOLEAN rField_is_Ring(const ring r)
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
BOOLEAN rHasGlobalOrdering(const ring r)
void rDelete(ring r)
unconditionally deletes fields in r
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 ...
void show(int mat=0, int spaces=0) const
static short scaLastAltVar(ring r)
static bool rIsSCA(const ring r)
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
#define pDeleteComp(p, k)
#define IMATELEM(M, I, J)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
poly p_Cleardenom(poly p, const ring r)
void syKillEmptyEntres(resolvente res, int length)
#define SI_RESTORE_OPT1(A)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
static intvec * syPrepareModComp(ideal arg, intvec **w)
ideal syMinBase(ideal arg)
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
#define pCopy(p)
return a copy of the poly