32 int maxxx = (*w)->
length();
48 if (arg->m[
i-maxxx]!=
NULL)
61 (**w)[
i+1] = (*w1)[
i+maxxx];
85 poly Unit1,Unit2,actWith;
86 int len,
i,
j,ModComp,
m,
k,
l;
100 while ((
j>0) && (!syz->m[
j-1]))
j--;
109 for (
l=
k;
l<
j-1;
l++) syz->m[
l] = syz->m[
l+1];
125 while ((
j>0) && (syz->m[
j-1]==
NULL))
j--;
127 if (bHasGlobalOrdering)
129 while ((
i<
j) && (!existsUnit))
145 if ((len==0) ||((
l>0) && (
l<len)))
154 if (len>0) existsUnit =
TRUE;
166 for (
k=
i;
k<
j-1;
k++) syz->m[
k] = syz->m[
k+1];
184 syz->m[
k] =
pSub(syz->m[
k],
189 syz->m[
l] = syz->m[
l+1];
201 pDelete(&(
mod->m[ModComp-1 - curr_syz_limit]));
222 poly actWith=syz->m[elnum];
223 syz->m[elnum] =
NULL;
225 if (from<0) from = 0;
235 poly tmp=syz->m[from];
240 syz->m[from] =
pSub(tmp,
250 poly tmp=syz->m[from];
255 syz->m[from] =
pSub(tmp,
313 if (reddeg0->m[
i]!=
NULL)
318 (*have_del)[
j-1] = 1;
326 j = to_del->length();
329 if ((*to_del)[
j-1]==1)
357 if (to_del!=
NULL)
delete to_del;
364 if (to_del!=
NULL)
delete to_del;
372 if (syzIndex<1) syzIndex=1;
416 if (maxlength!=-1) *
length = maxlength+1;
418 if ((wlength!=0) && (*
length!=wlength))
421 wtmp[0]=(*weights)[0];
432 if (syz_ring != origR)
443 if ((weights!=
NULL) && (*weights!=
NULL)&& ((*weights)[0]!=
NULL))
447 WarnS(
"wrong weights given(1):"); (*weights)[0]->show();
PrintLn();
454 if ((weights==
NULL) || (*weights==
NULL) || ((*weights)[0]==
NULL))
465 if ((weights!=
NULL) && (*weights!=
NULL)&& ((*weights)[0]!=
NULL))
490 setRegularity =
FALSE;
495 setRegularity =
FALSE;
500 ((maxlength==-1) || (syzIndex<=maxlength)))
512 if (*weights!=
NULL) tempW[
j] = (*weights)[
j];
528 if (minim || (syzIndex!=0))
533 res[syzIndex] = temp;
547 completeMinim=(syzIndex!=maxlength) || (maxlength ==-1) || (hom!=
isHomog);
553 if ((minim)||(syzIndex>1))
574 (*weights)[syzIndex] =
new intvec(
k);
604 for (
i=1;
i<=syzIndex;
i++)
613 if (origR != syz_ring)
616 for (
i=0;
i<=syzIndex;
i++)
630 const ideal idSaveCurrRingQuotient =
currRing->qideal;
683 currRing->qideal = idSaveCurrRingQuotient;
702 q = outp =
pHead(inp);
716 int i,
j,
k, subFromRank=0;
719 if (
idIs0(
id))
return 0;
726 while ((
i>0) && (temp->m[
i-1]==
NULL))
i--;
733 while ((
j<
i) && (temp->m[
j]==
NULL))
j++;
741 if ((
k>=0) && (
index==0)) subFromRank++;
749 while ((
j<
i) && (temp->m[
j]==
NULL))
j++;
766 deg[
i-1] = (*degrees)[
i-1]-rsmin;
770 (*tocancel)[
i-1] = tocan[
i-1];
788 int i,
j=0,
k=0,
l,rows,cols,mr;
789 int *temp1,*temp2,*temp3;
825 WarnS(
"betti-command: Input is not homogeneous!");
829 if (weights==
NULL) weights=
w;
832 while ((r0_len>0) && (
res[0]->
m[r0_len-1]==
NULL)) r0_len--;
843 temp1 = (
int*)
omAlloc0((
l+1)*
sizeof(
int));
844 temp2 = (
int*)
omAlloc((
l+1)*
sizeof(
int));
848 for (
i=0;
i<cols-1;
i++)
851 memset(temp2,0,(
l+1)*
sizeof(
int));
861 WerrorS(
"input not a resolution");
867 if (temp2[
j+1]-
i>rows) rows = temp2[
j+1]-
i;
868 if (temp2[
j+1]-
i<mr) mr = temp2[
j+1]-
i;
881 if (rows <(*weights)[
j]+1) rows=(-mr)+(*weights)[
j]+1;
897 (*result)[(-mr)*cols] = rkl;
899 (*result)[(-mr)*cols] = 1;
901 tocancel = (
int*)
omAlloc0((rows+1)*
sizeof(
int));
902 memset(temp1,0,(
l+1)*
sizeof(
int));
905 memset(temp2,0,
l*
sizeof(
int));
909 memset(temp2,0,
l*
sizeof(
int));
915 for(
j=0;
j<=rows+mr;
j++)
921 for (
i=0;
i<cols-1;
i++)
924 memset(temp2,0,
l*
sizeof(
int));
942 for (
j=mr;
j<rows+mr;
j++)
949 memset(tocancel,0,(rows+1)*
sizeof(
int));
961 for (
j=0;
j<=rows;
j++)
973 if ((tomin) && (mr<0))
975 for (
j=1;
j<=rows+mr+1;
j++)
977 for (
k=1;
k<=cols;
k++)
982 for (
j=rows+mr+1;
j<=rows+1;
j++)
984 for (
k=1;
k<=cols;
k++)
1002 for (
i=0;
i<exactresult->
rows();
i++)
1004 for (
j=0;
j<exactresult->
cols();
j++)
1009 if (row_shift!=
NULL) *row_shift = mr;
1032 if ((leng>=1) && (*(weights+1)!=
NULL))
1034 delete *(weights+1);
1052 int i,
j,
k,rsmin=0,rsmax=0,rs=0;
1060 if (weights[
i] !=
NULL)
1062 for (
j=1;
j<(weights[
i])->length();
j++)
1064 if ((*(weights[
i]))[
j]-
i<rsmin) rsmin = (*(weights[
i]))[
j]-
i;
1065 if ((*(weights[
i]))[
j]-
i>rsmax) rsmax = (*(weights[
i]))[
j]-
i;
1070 while (weights[
i] !=
NULL)
i++;
1077 if (
k>rsmax) rsmax =
k;
1078 if (
k<rsmin) rsmin =
k;
1081 for (
j=1;
j<(weights[0])->length();
j++)
1083 if ((*weights[0])[
j]>rsmax) rsmax = (*weights[0])[
j];
1084 if ((*weights[0])[
j]<rsmin) rsmin = (*weights[0])[
j];
1090 tocancel =
new intvec(rs);
1092 if (
res[0]->rank==0)
1098 for (
i=1;
i<(weights[0])->length();
i++)
1102 while (weights[
i]!=
NULL)
1104 for (
j=1;
j<(weights[
i])->length();
j++)
1123 tocancel =
new intvec(1);
1127 (*result)[0] =
res[0]->rank;
1147 for (
j=0;
j<rs-1;
j++)
1156 (*result)[
i+1] -= (*tocancel)[0];
1157 (*result)[
i+2] -= (*tocancel)[0];
1163 for(
i=rsmin;
i<=rsmax;
i++)
1179 ideal *r=
res->minres;
1187 ideal *r=
res->minres;
static int si_max(const int a, const int b)
void show(int mat=0, int spaces=0) const
void WerrorS(const char *s)
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
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...
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, 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 BOOLEAN length(leftv result, leftv arg)
intvec * ivCopy(const intvec *o)
#define IMATELEM(M, I, J)
ideal kInterRedOld(ideal F, const ideal Q)
static bool rIsSCA(const ring r)
bool ncExtensions(int iMask)
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
#define __p_GetComp(p, r)
#define omFreeSize(addr, size)
#define SI_RESTORE_OPT1(A)
#define TEST_OPT_DEGBOUND
#define TEST_OPT_NOTREGULARITY
#define TEST_OPT_NO_SYZ_MINIM
static int index(p_Length length, p_Ord ord)
poly p_Cleardenom(poly p, const ring r)
void p_SetModDeg(intvec *w, ring r)
static long p_FDeg(const poly p, const ring r)
static poly p_Mult_nn(poly p, number n, const ring 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 pLmIsConstantComp(p)
like above, except that p must be != NULL
#define pDeleteComp(p, k)
#define pGetComp(p)
Component.
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
#define pVectorHasUnitB(p, k)
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 pVectorHasUnit(p, k, l)
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
void PrintS(const char *s)
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
void rDelete(ring r)
unconditionally deletes fields in r
void rSetSyzComp(int k, const ring r)
static BOOLEAN rHasGlobalOrdering(const ring r)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static int rGetCurrSyzLimit(const ring r)
static BOOLEAN rField_has_simple_inverse(const ring r)
#define rField_is_Ring(R)
ideal SCAQuotient(const ring r)
static short scaLastAltVar(ring r)
static short scaFirstAltVar(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 idSkipZeroes0(ideal ide)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
ideal id_Jet0(const ideal i, const ring R)
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void id_Shift(ideal M, int s, const ring r)
static int idElem(const ideal F)
number of non-zero polys in F
EXTERN_VAR omBin char_ptr_bin
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
syStrategy syMres_with_map(ideal arg, int maxlength, intvec *w, ideal &trans)
syStrategy syResolution(ideal arg, int maxlength, intvec *w, BOOLEAN minim)
syStrategy syMinimizeCopy(syStrategy org)
static poly sypCopyConstant(poly inp)
static void syMinStep1(resolvente res, int length)
static void syMinStep(ideal mod, ideal &syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
ideal syMinBase(ideal arg)
static intvec * syPrepareModComp(ideal arg, intvec **w)
void syMinimize_with_map(syStrategy res, ideal &trans)
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
static void syDeleteAbove1(ideal up, int k)
static void syDeleteAbove(ideal up, int k)
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
void syMinimizeResolvente(resolvente res, int length, int first)
syStrategy syMinimize(syStrategy syzstr)
void syKillEmptyEntres(resolvente res, int length)