776 int i,
j=0,
k=0,
l,rows,cols,mr;
777 int *temp1,*temp2,*temp3;
813 WarnS(
"betti-command: Input is not homogeneous!");
817 if (weights==
NULL) weights=
w;
820 while ((r0_len>0) && (
res[0]->
m[r0_len-1]==
NULL)) r0_len--;
831 temp1 = (
int*)
omAlloc0((
l+1)*
sizeof(int));
832 temp2 = (
int*)
omAlloc((
l+1)*
sizeof(int));
836 for (
i=0;
i<cols-1;
i++)
839 memset(temp2,0,(
l+1)*
sizeof(
int));
849 WerrorS(
"input not a resolution");
855 if (temp2[
j+1]-
i>rows) rows = temp2[
j+1]-
i;
856 if (temp2[
j+1]-
i<mr) mr = temp2[
j+1]-
i;
869 if (rows <(*weights)[
j]+1) rows=(-mr)+(*weights)[
j]+1;
885 (*result)[(-mr)*cols] = rkl;
886 if ((!
idIs0(
res[0])) && ((*result)[(-mr)*cols]==0))
887 (*
result)[(-mr)*cols] = 1;
889 tocancel = (
int*)
omAlloc0((rows+1)*
sizeof(int));
890 memset(temp1,0,(
l+1)*
sizeof(
int));
893 memset(temp2,0,
l*
sizeof(
int));
897 memset(temp2,0,
l*
sizeof(
int));
903 for(
j=0;
j<=rows+mr;
j++)
909 for (
i=0;
i<cols-1;
i++)
912 memset(temp2,0,
l*
sizeof(
int));
930 for (
j=mr;
j<rows+mr;
j++)
937 memset(tocancel,0,(rows+1)*
sizeof(
int));
949 for (
j=0;
j<=rows;
j++)
961 if ((tomin) && (mr<0))
963 for (
j=1;
j<=rows+mr+1;
j++)
965 for (
k=1;
k<=cols;
k++)
970 for (
j=rows+mr+1;
j<=rows+1;
j++)
972 for (
k=1;
k<=cols;
k++)
990 for (
i=0;
i<exactresult->
rows();
i++)
992 for (
j=0;
j<exactresult->
cols();
j++)
997 if (row_shift!=
NULL) *row_shift = mr;
static int si_max(const int a, const int b)
void show(int mat=0, int spaces=0) const
void WerrorS(const char *s)
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
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)
#define IMATELEM(M, I, J)
#define omFreeSize(addr, size)
void p_SetModDeg(intvec *w, ring r)
static long p_FDeg(const poly p, const ring r)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
#define pGetComp(p)
Component.
void PrintS(const char *s)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)