772{
773
774
775 int i,
j=0,
k=0,
l,rows,cols,mr;
776 int *temp1,*temp2,*temp3;
777 int *tocancel;
778 int r0_len;
779
780
781 *regularity = -1;
783 while ((cols>0)
786 {
787 cols--;
788 }
791 {
794 else
797 }
800 {
802 {
807 }
808 }
809#if 0
811 {
812 WarnS(
"betti-command: Input is not homogeneous!");
814 }
815#endif
816 if (weights==
NULL) weights=
w;
819 while ((r0_len>0) && (
res[0]->
m[r0_len-1]==
NULL)) r0_len--;
820 #ifdef SHOW_W
822 #endif
826 {
829 }
830 temp1 = (
int*)
omAlloc0((
l+1)*
sizeof(int));
831 temp2 = (
int*)
omAlloc((
l+1)*
sizeof(int));
832 rows = 1;
833 mr = 1;
834 cols++;
835 for (
i=0;
i<cols-1;
i++)
836 {
838 memset(temp2,0,(
l+1)*
sizeof(
int));
840 {
842 {
844
845
846 )
847 {
848 WerrorS(
"input not a resolution");
852 }
854 if (temp2[
j+1]-
i>rows) rows = temp2[
j+1]-
i;
855 if (temp2[
j+1]-
i<mr) mr = temp2[
j+1]-
i;
856 }
857 }
859 temp3 = temp1;
860 temp1 = temp2;
861 temp2 = temp3;
862 }
863 mr--;
865 {
867 {
868 if (rows <(*weights)[
j]+1) rows=(-mr)+(*weights)[
j]+1;
869 }
870 }
871
872 rows -= mr;
875 {
877 {
879
880 }
881 }
882 else
883 {
884 (*result)[(-mr)*cols] = rkl;
885 if ((!
idIs0(
res[0])) && ((*result)[(-mr)*cols]==0))
886 (*
result)[(-mr)*cols] = 1;
887 }
888 tocancel = (
int*)
omAlloc0((rows+1)*
sizeof(int));
889 memset(temp1,0,(
l+1)*
sizeof(
int));
891 {
892 memset(temp2,0,
l*
sizeof(
int));
894 }
895 else
896 memset(temp2,0,
l*
sizeof(
int));
899 if (tomin)
900 {
901
902 for(
j=0;
j<=rows+mr;
j++)
903 {
904
906 }
907 }
908 for (
i=0;
i<cols-1;
i++)
909 {
911 memset(temp2,0,
l*
sizeof(
int));
913 {
915 {
917
918
920 }
922 {
924 }
925 }
926
927 if (tomin)
928 {
929 for (
j=mr;
j<rows+mr;
j++)
930 {
931
933 }
935 {
936 memset(tocancel,0,(rows+1)*sizeof(int));
939 {
940
942 }
943 }
944 }
945 temp3 = temp1;
946 temp1 = temp2;
947 temp2 = temp3;
948 for (
j=0;
j<=rows;
j++)
949 {
950
952 }
954 }
955
956
960 if ((tomin) && (mr<0))
961 {
962 for (
j=1;
j<=rows+mr+1;
j++)
963 {
964 for (
k=1;
k<=cols;
k++)
965 {
967 }
968 }
969 for (
j=rows+mr+1;
j<=rows+1;
j++)
970 {
971 for (
k=1;
k<=cols;
k++)
972 {
974 }
975 }
976 }
980 {
983 {
986 }
987 }
989 for (
i=0;
i<exactresult->
rows();
i++)
990 {
991 for (
j=0;
j<exactresult->
cols();
j++)
992 {
994 }
995 }
996 if (row_shift!=
NULL) *row_shift = mr;
998 return exactresult;
999}
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)
VAR 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)