My Project
Loading...
Searching...
No Matches
syz.h File Reference
#include "misc/mylimits.h"
#include "kernel/structs.h"
#include "polys/monomials/ring.h"
#include "kernel/ideals.h"

Go to the source code of this file.

Data Structures

struct  SObject
 
class  ssyStrategy
 

Macros

#define SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE   8
 
#define SYZ_SHIFT_BASE_LOG   (BIT_SIZEOF_LONG - 1 - SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE)
 
#define SYZ_SHIFT_BASE   (1L << SYZ_SHIFT_BASE_LOG)
 

Typedefs

typedef SObject * SSet
 
typedef SSetSRes
 
typedef ssyStrategysyStrategy
 

Functions

void sySchreyersSyzygiesM (polyset F, int Fmax, polyset *Shdl, int *Smax, BOOLEAN noSort)
 
void sySchreyersSyzygiesB (polyset F, int Fmax, polyset *Shdl, int *Smax, BOOLEAN noSort)
 
resolvente sySchreyerResolvente (ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
 
syStrategy sySchreyer (ideal arg, int maxlength)
 
resolvente syResolvente (ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
 
syStrategy syResolution (ideal arg, int maxlength, intvec *w, BOOLEAN minim)
 
void syMinimizeResolvente (resolvente res, int length, int first)
 
intvecsyBetti (resolvente res, int length, int *regularity, intvec *weights=NULL, BOOLEAN tomin=TRUE, int *row_shift=NULL)
 
ideal syMinBase (ideal arg)
 
BOOLEAN syTestOrder (ideal i)
 
void syReOrderResolventFB (resolvente res, int length, int initial=1)
 
resolvente syLaScala1 (ideal arg, int *length)
 
syStrategy syLaScala3 (ideal arg, int *length)
 
syStrategy syLaScala (ideal arg, int &maxlength, intvec *weights=NULL)
 
syStrategy syHilb (ideal arg, int *length)
 
syStrategy syKosz (ideal arg, int *length)
 
syStrategy syFrank (const ideal arg, const int length, const char *method, const bool use_cache=true, const bool use_tensor_trick=false)
 
void syKillComputation (syStrategy syzstr, ring r=currRing)
 
intvecsyBettiOfComputation (syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
 
int sySize (syStrategy syzstr)
 
int syDim (syStrategy syzstr)
 
syStrategy syCopy (syStrategy syzstr)
 
void syPrint (syStrategy syzstr, const char *currRingName)
 
syStrategy syMinimize (syStrategy syzstr)
 
void syKillEmptyEntres (resolvente res, int length)
 
void syDeletePair (SObject *so)
 
void syInitializePair (SObject *so)
 
void syCopyPair (SObject *argso, SObject *imso)
 
void syCompactifyPairSet (SSet sPairs, int sPlength, int first)
 
void syCompactify1 (SSet sPairs, int *sPlength, int first)
 
SRes syInitRes (ideal arg, int *length, intvec *Tl, intvec *cw=NULL)
 
void syResetShiftedComponents (syStrategy syzstr, int index, int hilb=0)
 
void syEnlargeFields (syStrategy syzstr, int index)
 
void syEnterPair (syStrategy syzstr, SObject *so, int *sPlength, int index)
 
SSet syChosePairs (syStrategy syzstr, int *index, int *howmuch, int *actdeg)
 
int syInitSyzMod (syStrategy syzstr, int index, int init=17)
 
long syReorderShiftedComponents (long *sc, int n)
 
void syGaussForOne (ideal arg, int gen, int ModComp, int from=-1, int till=0)
 
void syEnterPair (SSet sPairs, SObject *so, int *sPlength, int index)
 
resolvente syReorder (resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
 
syStrategy syMres_with_map (ideal arg, int maxlength, intvec *w, ideal &trans)
 
void syMinimize_with_map (syStrategy res, ideal &trans)
 
syStrategy syMinimizeCopy (syStrategy org)
 

Variables

EXTERN_VAR int * currcomponents
 
EXTERN_VAR long * currShiftedComponents
 

Data Structure Documentation

◆ sSObject

struct sSObject

Definition at line 19 of file syz.h.

Data Fields
int ind1
int ind2
poly isNotMinimal
poly lcm
int length
int order
poly p
poly p1
poly p2
int reference
poly syz
int syzind

◆ ssyStrategy

class ssyStrategy

Definition at line 37 of file syz.h.

Data Fields
int ** backcomponents
intvec * betti
kBucket_pt bucket
intvec * cw
int ** elemLength
int ** Firstelem
resolvente fullres
intvec ** hilb_coeffs
int ** Howmuch
int length
short list_length
resolvente minres
resolvente orderedRes
short references
int regularity
resolvente res
intvec * resolution
SRes resPairs
unsigned long ** sev
long ** ShiftedComponents
ring syRing
kBucket_pt syz_bucket
intvec * Tl
int ** truecomponents
intvec ** weights

Macro Definition Documentation

◆ SYZ_SHIFT_BASE

#define SYZ_SHIFT_BASE   (1L << SYZ_SHIFT_BASE_LOG)

Definition at line 18 of file syz.h.

◆ SYZ_SHIFT_BASE_LOG

#define SYZ_SHIFT_BASE_LOG   (BIT_SIZEOF_LONG - 1 - SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE)

Definition at line 17 of file syz.h.

◆ SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE

#define SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE   8

Definition at line 15 of file syz.h.

Typedef Documentation

◆ SRes

typedef SSet* SRes

Definition at line 33 of file syz.h.

◆ SSet

typedef SObject* SSet

Definition at line 32 of file syz.h.

◆ syStrategy

Definition at line 36 of file syz.h.

Function Documentation

◆ syBetti()

intvec * syBetti ( resolvente res,
int length,
int * regularity,
intvec * weights = NULL,
BOOLEAN tomin = TRUE,
int * row_shift = NULL )

Definition at line 783 of file syz.cc.

785{
786//#define BETTI_WITH_ZEROS
787 //tomin = FALSE;
788 int i,j=0,k=0,l,rows,cols,mr;
789 int *temp1,*temp2,*temp3;/*used to compute degrees*/
790 int *tocancel; /*(BOOLEAN)tocancel[i]=element is superfluous*/
791 int r0_len;
792
793 /*------ compute size --------------*/
794 *regularity = -1;
795 cols = length;
796 while ((cols>0)
797 && ((res[cols-1]==NULL)
798 || (idIs0(res[cols-1]))))
799 {
800 cols--;
801 }
802 intvec * result;
803 if (idIs0(res[0]))
804 {
805 if (res[0]==NULL)
806 result = new intvec(1,1,1);
807 else
808 result = new intvec(1,1,res[0]->rank);
809 return result;
810 }
811 intvec *w=NULL;
812 if (weights!=NULL)
813 {
814 if (!idTestHomModule(res[0],currRing->qideal,weights))
815 {
816 WarnS("wrong weights given(3):");weights->show();PrintLn();
817 idHomModule(res[0],currRing->qideal,&w);
818 if (w!=NULL) { w->show();PrintLn();}
819 weights=NULL;
820 }
821 }
822#if 0
823 if (idHomModule(res[0],currRing->qideal,&w)!=isHomog)
824 {
825 WarnS("betti-command: Input is not homogeneous!");
826 weights=NULL;
827 }
828#endif
829 if (weights==NULL) weights=w;
830 else delete w;
831 r0_len=IDELEMS(res[0]);
832 while ((r0_len>0) && (res[0]->m[r0_len-1]==NULL)) r0_len--;
833 #ifdef SHOW_W
834 PrintS("weights:");if (weights!=NULL) weights->show(); else Print("NULL"); PrintLn();
835 #endif
836 int rkl=l = si_max(id_RankFreeModule(res[0],currRing),res[0]->rank);
837 i = 0;
838 while ((i<length) && (res[i]!=NULL))
839 {
840 if (IDELEMS(res[i])>l) l = IDELEMS(res[i]);
841 i++;
842 }
843 temp1 = (int*)omAlloc0((l+1)*sizeof(int));
844 temp2 = (int*)omAlloc((l+1)*sizeof(int));
845 rows = 1;
846 mr = 1;
847 cols++;
848 for (i=0;i<cols-1;i++)
849 {
850 if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
851 memset(temp2,0,(l+1)*sizeof(int));
852 for (j=0;j<IDELEMS(res[i]);j++)
853 {
854 if (res[i]->m[j]!=NULL)
855 {
856 if ((pGetComp(res[i]->m[j])>l)
857 // usual resolutions do not the following, but artifulal built may: (tr. #763)
858 //|| ((i>1) && (res[i-1]->m[pGetComp(res[i]->m[j])-1]==NULL))
859 )
860 {
861 WerrorS("input not a resolution");
862 omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
863 omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
864 return NULL;
865 }
866 temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
867 if (temp2[j+1]-i>rows) rows = temp2[j+1]-i;
868 if (temp2[j+1]-i<mr) mr = temp2[j+1]-i;
869 }
870 }
871 if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
872 temp3 = temp1;
873 temp1 = temp2;
874 temp2 = temp3;
875 }
876 mr--;
877 if (weights!=NULL)
878 {
879 for(j=0;j<weights->length();j++)
880 {
881 if (rows <(*weights)[j]+1) rows=(-mr)+(*weights)[j]+1;
882 }
883 }
884 /*------ computation betti numbers --------------*/
885 rows -= mr;
886 result = new intvec(rows+1,cols,0);
887 if (weights!=NULL)
888 {
889 for(j=0;j<weights->length();j++)
890 {
891 IMATELEM((*result),(-mr)+(*weights)[j]+1,1) ++;
892 //Print("imat(%d,%d)++ -> %d\n",(-mr)+(*weights)[j]+1, 1, IMATELEM((*result),(-mr)+(*weights)[j]+1,1));
893 }
894 }
895 else
896 {
897 (*result)[(-mr)*cols] = /*idRankFreeModule(res[0])*/ rkl;
898 if ((!idIs0(res[0])) && ((*result)[(-mr)*cols]==0))
899 (*result)[(-mr)*cols] = 1;
900 }
901 tocancel = (int*)omAlloc0((rows+1)*sizeof(int));
902 memset(temp1,0,(l+1)*sizeof(int));
903 if (weights!=NULL)
904 {
905 memset(temp2,0,l*sizeof(int));
906 p_SetModDeg(weights, currRing);
907 }
908 else
909 memset(temp2,0,l*sizeof(int));
910 syDetect(res[0],0,TRUE,temp2,tocancel);
911 if (weights!=NULL) p_SetModDeg(NULL, currRing);
912 if (tomin)
913 {
914 //(*result)[(-mr)*cols] -= dummy;
915 for(j=0;j<=rows+mr;j++)
916 {
917 //Print("tocancel[%d]=%d imat(%d,%d)=%d\n",j,tocancel[j],(-mr)+j+1,1,IMATELEM((*result),(-mr)+j+1,1));
918 IMATELEM((*result),(-mr)+j+1,1) -= tocancel[j];
919 }
920 }
921 for (i=0;i<cols-1;i++)
922 {
923 if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
924 memset(temp2,0,l*sizeof(int));
925 for (j=0;j<IDELEMS(res[i]);j++)
926 {
927 if (res[i]->m[j]!=NULL)
928 {
929 temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
930 //(*result)[i+1+(temp2[j+1]-i-1)*cols]++;
931 //if (temp2[j+1]>i) IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
932 IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
933 }
934 else if (i==0)
935 {
936 if (j<r0_len) IMATELEM((*result),-mr,2)++;
937 }
938 }
939 /*------ computation betti numbers, if res not minimal --------------*/
940 if (tomin)
941 {
942 for (j=mr;j<rows+mr;j++)
943 {
944 //(*result)[i+1+j*cols] -= tocancel[j+1];
945 IMATELEM((*result),j+1-mr,i+2) -= tocancel[j+1];
946 }
947 if ((i<length-1) && (res[i+1]!=NULL))
948 {
949 memset(tocancel,0,(rows+1)*sizeof(int));
950 syDetect(res[i+1],i+1,TRUE,temp2,tocancel);
951 for (j=0;j<rows;j++)
952 {
953 //(*result)[i+1+j*cols] -= tocancel[j];
954 IMATELEM((*result),j+1,i+2) -= tocancel[j];
955 }
956 }
957 }
958 temp3 = temp1;
959 temp1 = temp2;
960 temp2 = temp3;
961 for (j=0;j<=rows;j++)
962 {
963 // if (((*result)[i+1+j*cols]!=0) && (j>*regularity)) *regularity = j;
964 if ((IMATELEM((*result),j+1,i+2)!=0) && (j>*regularity)) *regularity = j;
965 }
966 if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
967 }
968 // Print("nach minim:\n"); result->show(); PrintLn();
969 /*------ clean up --------------*/
970 omFreeSize((ADDRESS)tocancel,(rows+1)*sizeof(int));
971 omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
972 omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
973 if ((tomin) && (mr<0)) // deletes the first (zero) line
974 {
975 for (j=1;j<=rows+mr+1;j++)
976 {
977 for (k=1;k<=cols;k++)
978 {
979 IMATELEM((*result),j,k) = IMATELEM((*result),j-mr,k);
980 }
981 }
982 for (j=rows+mr+1;j<=rows+1;j++)
983 {
984 for (k=1;k<=cols;k++)
985 {
986 IMATELEM((*result),j,k) = 0;
987 }
988 }
989 }
990 j = 0;
991 k = 0;
992 for (i=1;i<=result->rows();i++)
993 {
994 for(l=1;l<=result->cols();l++)
995 if (IMATELEM((*result),i,l) != 0)
996 {
997 j = si_max(j, i-1);
998 k = si_max(k, l-1);
999 }
1000 }
1001 intvec * exactresult=new intvec(j+1,k+1,0);
1002 for (i=0;i<exactresult->rows();i++)
1003 {
1004 for (j=0;j<exactresult->cols();j++)
1005 {
1006 IMATELEM(*exactresult,i+1,j+1) = IMATELEM(*result,i+1,j+1);
1007 }
1008 }
1009 if (row_shift!=NULL) *row_shift = mr;
1010 delete result;
1011 return exactresult;
1012}
static int si_max(const int a, const int b)
Definition auxiliary.h:125
#define TRUE
Definition auxiliary.h:101
void * ADDRESS
Definition auxiliary.h:120
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
int k
Definition cfEzgcd.cc:99
void show(int mat=0, int spaces=0) const
Definition intvec.cc:149
int length() const
Definition intvec.h:95
int cols() const
Definition intvec.h:96
int rows() const
Definition intvec.h:97
#define Print
Definition emacs.cc:80
#define WarnS
Definition emacs.cc:78
return result
CanonicalForm res
Definition facAbsFact.cc:60
const CanonicalForm & w
Definition facAbsFact.cc:51
int j
Definition facHensel.cc:110
void WerrorS(const char *s)
Definition feFopen.cc:24
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition ideals.cc:2091
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition ideals.h:96
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
#define IMATELEM(M, I, J)
Definition intvec.h:86
#define omFreeSize(addr, size)
#define omAlloc(size)
#define omAlloc0(size)
#define NULL
Definition omList.c:12
void p_SetModDeg(intvec *w, ring r)
Definition p_polys.cc:3753
static long p_FDeg(const poly p, const ring r)
Definition p_polys.h:382
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define pGetComp(p)
Component.
Definition polys.h:38
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define IDELEMS(i)
@ isHomog
Definition structs.h:33
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
Definition syz.cc:714

◆ syBettiOfComputation()

intvec * syBettiOfComputation ( syStrategy syzstr,
BOOLEAN minim = TRUE,
int * row_shift = NULL,
intvec * weights = NULL )

Don't change the syzstr???

Definition at line 1756 of file syz1.cc.

1758{
1759 int dummy;
1760 BOOLEAN std_weights=TRUE;
1761 if ((weights!=NULL)
1762 && (syzstr->betti!=NULL)
1763 && (syzstr->weights!=NULL) && (syzstr->weights[0]!=NULL))
1764 {
1765 int i;
1766 for(i=weights->length()-1; i>=0; i--)
1767 {
1768 //Print("test %d: %d - %d\n",i,(*weights)[i], (*(syzstr->weights[0]))[i]);
1769 if ((*weights)[i]!=(*(syzstr->weights[0]))[i])
1770 {
1771 std_weights=FALSE;
1772 break;
1773 }
1774 }
1775 }
1776 if ((syzstr->betti!=NULL)
1777 && (std_weights))
1778 {
1779 if (minim || (syzstr->resPairs!=NULL))
1780 return ivCopy(syzstr->betti);
1781 }
1782
1783 resolvente fullres = syzstr->fullres;
1784 resolvente minres = syzstr->minres;
1785 const int length = syzstr->length;
1786
1787 if ((fullres==NULL) && (minres==NULL))
1788 {
1789 if (syzstr->hilb_coeffs==NULL)
1790 { // LA SCALA
1791 fullres = syReorder(syzstr->res, length, syzstr);
1792 }
1793 else
1794 { // HRES
1795 minres = syReorder(syzstr->orderedRes, length, syzstr);
1796 syKillEmptyEntres(minres, length);
1797 }
1798 }
1799
1801
1802 if (fullres!=NULL)
1803 result = syBetti(fullres,length,&dummy,weights,minim,row_shift);
1804 else
1805 result = syBetti(minres,length,&dummy,weights,minim,row_shift);
1806
1807
1808 return result; /// Don't change the syzstr???
1809
1810 // TODO: cleanup these!
1811 if( fullres != NULL && syzstr->fullres == NULL )
1812 syzstr->fullres = fullres;
1813 if( minres != NULL && syzstr->minres == NULL )
1814 syzstr->minres = minres;
1815
1816 if ((result!=NULL)
1817 && ((minim) || (syzstr->resPairs!=NULL))
1818 && std_weights
1819 && (syzstr->betti==NULL))
1820 {
1821 syzstr->betti = ivCopy(result); // cache the result...
1822 }
1823
1824 return result;
1825}
int BOOLEAN
Definition auxiliary.h:88
#define FALSE
Definition auxiliary.h:97
ideal * resolvente
Definition ideals.h:18
intvec * ivCopy(const intvec *o)
Definition intvec.h:146
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy, resolvente totake)
Definition syz1.cc:1641
void syKillEmptyEntres(resolvente res, int length)
Definition syz1.cc:2199
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition syz.cc:783
intvec ** hilb_coeffs
Definition syz.h:46
resolvente minres
Definition syz.h:58
intvec * betti
Definition syz.h:53
resolvente res
Definition syz.h:47
resolvente fullres
Definition syz.h:57
intvec ** weights
Definition syz.h:45
resolvente orderedRes
Definition syz.h:48
int length
Definition syz.h:60
SRes resPairs
Definition syz.h:49

◆ syChosePairs()

SSet syChosePairs ( syStrategy syzstr,
int * index,
int * howmuch,
int * actdeg )

Definition at line 1288 of file syz1.cc.

1289{
1290 return syChosePairsPutIn(syzstr,index,howmuch,actdeg,0,syzstr->length);
1291}
static int index(p_Length length, p_Ord ord)
static SSet syChosePairsPutIn(syStrategy syzstr, int *index, int *howmuch, int *actdeg, int an, int en)
Definition syz1.cc:1181

◆ syCompactify1()

void syCompactify1 ( SSet sPairs,
int * sPlength,
int first )

Definition at line 132 of file syz1.cc.

133{
134 int k=first,kk=0;
135
136 while (k+kk<*sPlength)
137 {
138 if (sPairs[k+kk].lcm!=NULL)
139 {
140 if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
141 k++;
142 }
143 else
144 {
145 kk++;
146 }
147 }
148 while (k<*sPlength)
149 {
150 syInitializePair(&sPairs[k]);
151 k++;
152 }
153 *sPlength -= kk;
154}
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:709
void syCopyPair(SObject *argso, SObject *imso)
Definition syz1.cc:82
void syInitializePair(SObject *so)
Definition syz1.cc:63

◆ syCompactifyPairSet()

void syCompactifyPairSet ( SSet sPairs,
int sPlength,
int first )

Definition at line 104 of file syz1.cc.

105{
106 int k=first,kk=0;
107
108 while (k+kk<sPlength)
109 {
110 if (sPairs[k+kk].lcm!=NULL)
111 {
112 if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
113 k++;
114 }
115 else
116 {
117 kk++;
118 }
119 }
120 while (k<sPlength)
121 {
122 syInitializePair(&sPairs[k]);
123 k++;
124 }
125}

◆ syCopy()

syStrategy syCopy ( syStrategy syzstr)

Definition at line 1885 of file syz1.cc.

1886{
1887 syStrategy result=syzstr;
1888 (result->references)++;
1889 return result;
1890}
ssyStrategy * syStrategy
Definition syz.h:36

◆ syCopyPair()

void syCopyPair ( SObject * argso,
SObject * imso )

Definition at line 82 of file syz1.cc.

83{
84 *imso=*argso;
85 (*argso).p = NULL;
86 (*argso).p1 = NULL;
87 (*argso).p2 = NULL;
88 (*argso).lcm = NULL;
89 (*argso).syz = NULL;
90 (*argso).ind1 = 0;
91 (*argso).ind2 = 0;
92 (*argso).syzind = -1;
93 (*argso).order = 0;
94 (*argso).isNotMinimal = NULL;
95 (*argso).length = -1;
96 (*argso).reference = -1;
97}

◆ syDeletePair()

void syDeletePair ( SObject * so)

Definition at line 44 of file syz1.cc.

45{
46 pDelete(&(*so).p);
47 pDelete(&(*so).lcm);
48 pDelete(&(*so).syz);
49 (*so).p1 = NULL;
50 (*so).p2 = NULL;
51 (*so).ind1 = 0;
52 (*so).ind2 = 0;
53 (*so).syzind = -1;
54 (*so).order = 0;
55 (*so).isNotMinimal = NULL;
56 (*so).length = -1;
57 (*so).reference = -1;
58}
#define pDelete(p_ptr)
Definition polys.h:187

◆ syDim()

int syDim ( syStrategy syzstr)

Definition at line 1850 of file syz1.cc.

1851{
1852 int i,l;
1853 if (syzstr->resPairs!=NULL)
1854 {
1855 SRes rP=syzstr->resPairs;
1856
1857 l = syzstr->length;
1858 while ((l>0) && (rP[l-1]==NULL)) l--;
1859 if (l==0) return -1;
1860 l--;
1861 while (l>=0)
1862 {
1863 i = 0;
1864 while ((i<(*syzstr->Tl)[l]) &&
1865 ((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
1866 (rP[l][i].isNotMinimal!=NULL))
1867 {
1868 i++;
1869 }
1870 if ((i<(*syzstr->Tl)[l]) &&
1871 ((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
1872 (rP[l][i].isNotMinimal==NULL))
1873 return l;
1874 l--;
1875 }
1876 return l;
1877 }
1878 else
1879 return sySize(syzstr);
1880}
int sySize(syStrategy syzstr)
Definition syz1.cc:1830
intvec * Tl
Definition syz.h:50
SSet * SRes
Definition syz.h:33

◆ syEnlargeFields()

void syEnlargeFields ( syStrategy syzstr,
int index )

Definition at line 734 of file syz1.cc.

735{
736 pEnlargeSet(&(syzstr->res[index]->m),IDELEMS(syzstr->res[index]),16);
738 (IDELEMS(syzstr->res[index])+1)*sizeof(int),
739 (IDELEMS(syzstr->res[index])+17)*sizeof(int));
740 syzstr->ShiftedComponents[index]
742 (IDELEMS(syzstr->res[index])+1)*sizeof(long),
743 (IDELEMS(syzstr->res[index])+17)*sizeof(long));
745 (IDELEMS(syzstr->res[index])+1)*sizeof(int),
746 (IDELEMS(syzstr->res[index])+17)*sizeof(int));
747 syzstr->Howmuch[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Howmuch[index],
748 (IDELEMS(syzstr->res[index])+1)*sizeof(int),
749 (IDELEMS(syzstr->res[index])+17)*sizeof(int));
750 syzstr->Firstelem[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Firstelem[index],
751 (IDELEMS(syzstr->res[index])+1)*sizeof(int),
752 (IDELEMS(syzstr->res[index])+17)*sizeof(int));
753 syzstr->elemLength[index]=(int*)omRealloc0Size((ADDRESS)syzstr->elemLength[index],
754 (IDELEMS(syzstr->res[index])+1)*sizeof(int),
755 (IDELEMS(syzstr->res[index])+17)*sizeof(int));
756 syzstr->sev[index]=(unsigned long*)omRealloc0Size((ADDRESS)syzstr->sev[index],
757 (IDELEMS(syzstr->res[index])+1)*sizeof(unsigned long),
758 (IDELEMS(syzstr->res[index])+17)*sizeof(unsigned long));
759 IDELEMS(syzstr->res[index]) += 16;
760 pEnlargeSet(&(syzstr->orderedRes[index]->m),IDELEMS(syzstr->orderedRes[index]),16);
761 IDELEMS(syzstr->orderedRes[index]) += 16;
762}
#define omRealloc0Size(addr, o_size, size)
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3776
int ** backcomponents
Definition syz.h:41
int ** truecomponents
Definition syz.h:39
int ** Firstelem
Definition syz.h:43
int ** elemLength
Definition syz.h:44
unsigned long ** sev
Definition syz.h:59
long ** ShiftedComponents
Definition syz.h:40
int ** Howmuch
Definition syz.h:42

◆ syEnterPair() [1/2]

void syEnterPair ( SSet sPairs,
SObject * so,
int * sPlength,
int index )

Definition at line 985 of file syz1.cc.

986{
987 int ll,k,no=(*so).order,sP=*sPlength,i;
988
989 if ((sP==0) || (sPairs[sP-1].order<=no))
990 ll = sP;
991 else if (sP==1)
992 ll = 0;
993 else
994 {
995 int an=0,en=sP-1;
996 loop
997 {
998 if (an>=en-1)
999 {
1000 if ((sPairs[an].order<=no) && (sPairs[an+1].order>no))
1001 {
1002 ll = an+1;
1003 break;
1004 }
1005 else if ((sPairs[en].order<=no) && (sPairs[en+1].order>no))
1006 {
1007 ll = en+1;
1008 break;
1009 }
1010 else if (sPairs[an].order>no)
1011 {
1012 ll = an;
1013 break;
1014 }
1015 else
1016 {
1017 PrintS("Hier ist was faul!\n");
1018 break;
1019 }
1020 }
1021 i=(an+en) / 2;
1022 if (sPairs[i].order <= no)
1023 an=i;
1024 else
1025 en=i;
1026 }
1027 }
1028 for (k=(*sPlength);k>ll;k--)
1029 {
1030 syCopyPair(&sPairs[k-1],&sPairs[k]);
1031 }
1032 syCopyPair(so,&sPairs[ll]);
1033 (*sPlength)++;
1034}
#define loop
Definition structs.h:71

◆ syEnterPair() [2/2]

void syEnterPair ( syStrategy syzstr,
SObject * so,
int * sPlength,
int index )

Definition at line 1035 of file syz1.cc.

1036{
1037 int ll;
1038
1039 if (*sPlength>=(*syzstr->Tl)[index])
1040 {
1041 SSet temp = (SSet)omAlloc0(((*syzstr->Tl)[index]+16)*sizeof(SObject));
1042 for (ll=0;ll<(*syzstr->Tl)[index];ll++)
1043 {
1044 temp[ll].p = (syzstr->resPairs[index])[ll].p;
1045 temp[ll].p1 = (syzstr->resPairs[index])[ll].p1;
1046 temp[ll].p2 = (syzstr->resPairs[index])[ll].p2;
1047 temp[ll].syz = (syzstr->resPairs[index])[ll].syz;
1048 temp[ll].lcm = (syzstr->resPairs[index])[ll].lcm;
1049 temp[ll].ind1 = (syzstr->resPairs[index])[ll].ind1;
1050 temp[ll].ind2 = (syzstr->resPairs[index])[ll].ind2;
1051 temp[ll].syzind = (syzstr->resPairs[index])[ll].syzind;
1052 temp[ll].order = (syzstr->resPairs[index])[ll].order;
1053 temp[ll].isNotMinimal = (syzstr->resPairs[index])[ll].isNotMinimal;
1054 temp[ll].length = (syzstr->resPairs[index])[ll].length;
1055 temp[ll].reference = (syzstr->resPairs[index])[ll].reference;
1056 }
1057 if (syzstr->resPairs[index] != NULL) // OB: ?????
1058 omFreeSize((ADDRESS)syzstr->resPairs[index],(*syzstr->Tl)[index]*sizeof(SObject));
1059 (*syzstr->Tl)[index] += 16;
1060 syzstr->resPairs[index] = temp;
1061 }
1062 syEnterPair(syzstr->resPairs[index],so,sPlength,index);
1063}
int p
Definition cfModGcd.cc:4086
void syEnterPair(SSet sPairs, SObject *so, int *sPlength, int)
Definition syz1.cc:985
SObject * SSet
Definition syz.h:32

◆ syFrank()

syStrategy syFrank ( const ideal arg,
const int length,
const char * method,
const bool use_cache = true,
const bool use_tensor_trick = false )

Definition at line 792 of file syz4.cc.

794{
796 resolvente res = (resolvente)omAlloc0((length+1)*sizeof(ideal));
797 if (strcmp(method, "frame") != 0)
798 {
799 res[0] = id_Copy(arg, currRing);
800 }
801 else
802 {
803 res[0] = id_Head(arg, currRing);
804 }
805 syzHeadFunction *syzHead;
806 bool do_lifting;
807 bool single_module;
808 set_options(&syzHead, &do_lifting, &single_module, method);
809 int new_length = computeResolution(res, length-1, syzHead, do_lifting,
810 single_module, use_cache, use_tensor_trick);
811 if (new_length < length)
812 {
813 res = (resolvente)omReallocSize(res, (length+1)*sizeof(ideal),
814 (new_length+1)*sizeof(ideal));
815 }
816 if (strcmp(method, "frame") != 0)
817 {
818 insert_ext_induced_LTs(res, new_length, single_module);
819 }
820 result->fullres = res;
821 result->length = new_length;
822 result->list_length = new_length;
823 return result;
824}
ideal id_Copy(ideal h1, const ring r)
copy an ideal
#define omReallocSize(addr, o_size, size)
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
static void set_options(syzHeadFunction **syzHead_ptr, bool *do_lifting_ptr, bool *single_module_ptr, const char *method)
Definition syz4.cc:701
static int computeResolution(resolvente res, const int max_index, syzHeadFunction *syzHead, const bool do_lifting, const bool single_module, const bool use_cache, const bool use_tensor_trick)
Definition syz4.cc:670
static void insert_ext_induced_LTs(const resolvente res, const int length, const bool single_module)
Definition syz4.cc:758
poly syzHeadFunction(ideal, int, int)
Definition syz4.cc:321

◆ syGaussForOne()

void syGaussForOne ( ideal arg,
int gen,
int ModComp,
int from = -1,
int till = 0 )

Definition at line 218 of file syz.cc.

219{
220 int /*k,j,i,*/lu;
221 poly unit1,unit2;
222 poly actWith=syz->m[elnum];
223 syz->m[elnum] = NULL;
224
225 if (from<0) from = 0;
226 if ((till<=0) || (till>IDELEMS(syz))) till = IDELEMS(syz);
228/*--makes Gauss alg. for the column ModComp--*/
229 pTakeOutComp(&(actWith), ModComp, &unit1, &lu);
230 if (lu==1) /*p_IsConstantComp(unit1,currRing)*/
231 {
232 number n_unit1=pGetCoeff(unit1);
233 while (from<till)
234 {
235 poly tmp=syz->m[from];
236 if (/*syz->m[from]*/ tmp!=NULL)
237 {
238 pTakeOutComp(&tmp, ModComp, &unit2, &lu);
239 tmp = p_Mult_nn(tmp,n_unit1,currRing);
240 syz->m[from] = pSub(tmp,
241 pMult(unit2,pCopy(actWith)));
242 }
243 from++;
244 }
245 }
246 else
247 {
248 while (from<till)
249 {
250 poly tmp=syz->m[from];
251 if (/*syz->m[from]*/ tmp!=NULL)
252 {
253 pTakeOutComp(&tmp, ModComp, &unit2, &lu);
254 tmp = pMult(pCopy(unit1),tmp);
255 syz->m[from] = pSub(tmp,
256 pMult(unit2,pCopy(actWith)));
257 }
258 from++;
259 }
260 }
261 pDelete(&actWith);
262 pDelete(&unit1);
263}
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
poly p_Cleardenom(poly p, const ring r)
Definition p_polys.cc:2849
static poly p_Mult_nn(poly p, number n, const ring r)
Definition p_polys.h:960
#define pSub(a, b)
Definition polys.h:288
#define pMult(p, q)
Definition polys.h:208
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 ...
Definition polys.h:339
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition ring.h:554

◆ syHilb()

syStrategy syHilb ( ideal arg,
int * length )

Definition at line 950 of file syz2.cc.

951{
952 int i,j,actdeg=32000,index=0;
953 int howmuch,toSub=0;
954 int maxindex=0,maxdeg=0;
955 ideal temp=NULL;
956 SSet nextPairs;
957 ring origR = currRing;
958 syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
959
960 if ((idIs0(arg)) || (id_RankFreeModule(arg,currRing)>0))
961 {
963 syzstr->length = 1;
964 syzstr->minres[0] = idInit(1,arg->rank);
965 return syzstr;
966 }
967
968 // Creare dp,S ring and change to it
969 syzstr->syRing = rAssure_dp_C(origR);
970 rChangeCurrRing(syzstr->syRing);
971
972 // set initial ShiftedComps
973 currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
974 currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
975
976/*--- initializes the data structures---------------*/
977#ifdef SHOW_CRIT
978 crit = 0;
979 crit1 = 0;
980 spfl = 0;
981 cons_pairs = 0;
982 crit_fails = 0;
983#endif
984 syzstr->length = *length = currRing->N+2;
985 syzstr->Tl = new intvec(*length+1);
986 temp = idInit(IDELEMS(arg),arg->rank);
987 for (i=0;i<IDELEMS(arg);i++)
988 {
989 if (origR != syzstr->syRing)
990 temp->m[i] = prCopyR( arg->m[i], origR, syzstr->syRing);
991 else
992 temp->m[i] = pCopy( arg->m[i]);
993 if (temp->m[i]!=NULL)
994 {
995 j = pTotaldegree(temp->m[i]);
996 if (j<actdeg) actdeg = j;
997 }
998 }
999 idTest(temp);
1000 idSkipZeroes(temp);
1001 syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw);
1002 omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
1003 omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(int));
1004 syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1005 syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1006 syzstr->elemLength = (int**)omAlloc0((*length+1)*sizeof(int*));
1007 syzstr->truecomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
1008 syzstr->backcomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
1009 syzstr->ShiftedComponents = (long**)omAlloc0((*length+1)*sizeof(long*));
1010 syzstr->Howmuch = (int**)omAlloc0((*length+1)*sizeof(int*));
1011 syzstr->Firstelem = (int**)omAlloc0((*length+1)*sizeof(int*));
1012 syzstr->hilb_coeffs = (intvec**)omAlloc0((*length+1)*sizeof(intvec*));
1013 syzstr->sev = (unsigned long **)omAlloc0((*length+1)*sizeof(unsigned long*));
1014 syzstr->bucket = kBucketCreate(currRing);
1016 nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
1017/*--- computes the resolution ----------------------*/
1018 while (nextPairs!=NULL)
1019 {
1020#ifdef SHOW_PROT
1021Print("compute %d Paare im Module %d im Grad %d \n",howmuch,index,actdeg+index);
1022#endif
1023 if (TEST_OPT_PROT) Print("%d",actdeg);
1024 if (TEST_OPT_PROT) Print("(m%d)",index);
1025 if (index==0)
1026 i = syInitSyzMod(syzstr,index,id_RankFreeModule(arg, origR)+1);
1027 else
1028 i = syInitSyzMod(syzstr,index);
1029 j = syInitSyzMod(syzstr,index+1);
1030 if (index>0)
1031 {
1032 syRedNextPairs_Hilb(nextPairs,syzstr,howmuch,index,actdeg,&toSub,&maxindex,&maxdeg);
1033 syzstr->res[index+1]->rank=idElem(syzstr->res[index]);
1034 sySetNewHilb(syzstr,toSub,index,actdeg);
1035 toSub = 0;
1036 syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
1037 }
1038 else
1039 syRedGenerOfCurrDeg_Hilb(syzstr,actdeg,&maxindex,&maxdeg);
1040/*--- creates new pairs -----------------------------*/
1041#ifdef SHOW_PROT
1042Print("Bilde neue Paare in Modul %d!\n",index);
1043#endif
1044 syCreateNewPairs_Hilb(syzstr,index,actdeg);
1045 if (index<(*length)-1)
1046 {
1047#ifdef SHOW_PROT
1048Print("Bilde neue Paare in Modul %d!\n",index+1);
1049#endif
1050 syCreateNewPairs_Hilb(syzstr,index+1,actdeg-1);
1051 }
1052 index++;
1053 nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
1054 }
1055 syReOrdResult_Hilb(syzstr,maxindex,maxdeg);
1056#ifdef SHOW_RESULT
1057PrintS("minimal resolution:\n");
1058for (int ti=1;ti<=*length;ti++)
1059{
1060 if (!idIs0(syzstr->orderedRes[ti])) idPrint(syzstr->orderedRes[ti]);
1061}
1062PrintS("full resolution:\n");
1063for (int ti=1;ti<=*length;ti++)
1064{
1065 if (!idIs0(syzstr->res[ti])) idPrint(syzstr->res[ti]);
1066}
1067#endif
1068#ifdef SHOW_CRIT
1069Print("Criterion %d times applied\n",crit);
1070Print("Criterion1 %d times applied\n",crit1);
1071Print("%d superfluous pairs\n",spfl);
1072Print("%d pairs considered\n",cons_pairs);
1073Print("Criterion fails %d times\n",crit_fails);
1074crit = 0;
1075crit1 = 0;
1076spfl = 0;
1077cons_pairs = 0;
1078crit_fails = 0;
1079#endif
1080 if (temp!=NULL) idDelete(&temp);
1081 kBucketDestroy(&(syzstr->bucket));
1082 kBucketDestroy(&(syzstr->syz_bucket));
1083 if (origR != syzstr->syRing)
1084 rChangeCurrRing(origR);
1085 else
1086 currRing = origR;
1087 if (TEST_OPT_PROT) PrintLn();
1088 return syzstr;
1089}
#define idDelete(H)
delete an ideal
Definition ideals.h:29
#define idPrint(id)
Definition ideals.h:46
#define idTest(id)
Definition ideals.h:47
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition kbuckets.cc:216
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition kbuckets.cc:209
#define omAllocBin(bin)
#define TEST_OPT_PROT
Definition options.h:105
void rChangeCurrRing(ring r)
Definition polys.cc:16
static long pTotaldegree(poly p)
Definition polys.h:283
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition prCopy.cc:34
ring rAssure_dp_C(const ring r)
Definition ring.cc:5119
ideal idInit(int idsize, int rank)
initialise an ideal / module
VAR omBin sip_sideal_bin
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static int idElem(const ideal F)
number of non-zero polys in F
static void syCreateNewPairs_Hilb(syStrategy syzstr, int index, int actdeg)
Definition syz2.cc:65
static void syRedGenerOfCurrDeg_Hilb(syStrategy syzstr, int deg, int *maxindex, int *maxdeg)
Definition syz2.cc:841
void sySetNewHilb(syStrategy syzstr, int toSub, int index, int actord)
Definition syz2.cc:781
static void syReOrdResult_Hilb(syStrategy syzstr, int maxindex, int maxdeg)
Definition syz2.cc:902
static void syRedNextPairs_Hilb(SSet nextPairs, syStrategy syzstr, int howmuch, int index, int actord, int *toSub, int *maxindex, int *maxdeg)
Definition syz2.cc:491
ring syRing
Definition syz.h:56
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
Definition syz1.cc:104
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw=NULL)
Definition syz1.cc:293
EXTERN_VAR long * currShiftedComponents
Definition syz.h:118
kBucket_pt syz_bucket
Definition syz.h:55
EXTERN_VAR int * currcomponents
Definition syz.h:117
intvec * cw
Definition syz.h:52
kBucket_pt bucket
Definition syz.h:54
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
Definition syz1.cc:1288
int syInitSyzMod(syStrategy syzstr, int index, int init=17)
Definition syz1.cc:1459

◆ syInitializePair()

void syInitializePair ( SObject * so)

Definition at line 63 of file syz1.cc.

64{
65 (*so).p = NULL;
66 (*so).lcm = NULL;
67 (*so).syz = NULL;
68 (*so).p1 = NULL;
69 (*so).p2 = NULL;
70 (*so).ind1 = 0;
71 (*so).ind2 = 0;
72 (*so).syzind = -1;
73 (*so).order = 0;
74 (*so).isNotMinimal = NULL;
75 (*so).length = -1;
76 (*so).reference = -1;
77}

◆ syInitRes()

SRes syInitRes ( ideal arg,
int * length,
intvec * Tl,
intvec * cw = NULL )

Definition at line 293 of file syz1.cc.

294{
295 if (idIs0(arg)) return NULL;
296 SRes resPairs = (SRes)omAlloc0(*length*sizeof(SSet));
297 resPairs[0] = (SSet)omAlloc0(IDELEMS(arg)*sizeof(SObject));
298 intvec * iv=NULL;
299 int i,j;
300
301 if (id_RankFreeModule(arg,currRing)==0)
302 {
303 iv = idSort(arg);
304 for (i=0;i<IDELEMS(arg);i++)
305 {
306 (resPairs[0])[i].syz = /*pCopy*/(arg->m[(*iv)[i]-1]);
307 arg->m[(*iv)[i]-1] = NULL;
308 (resPairs[0])[i].order = pTotaldegree((resPairs[0])[i].syz);
309 }
310 }
311 else
312 {
313 iv = new intvec(IDELEMS(arg),1,-1);
314 for (i=0;i<IDELEMS(arg);i++)
315 {
316 (*iv)[i] = pTotaldegree(arg->m[i])+(*cw)[pGetComp(arg->m[i])-1];
317 }
318 for (i=0;i<IDELEMS(arg);i++)
319 {
320 j = syChMin(iv);
321 if (j<0) break;
322 (resPairs[0])[i].syz = arg->m[j];
323 arg->m[j] = NULL;
324 (resPairs[0])[i].order = (*iv)[j];
325 (*iv)[j] = -1;
326 }
327 }
328 if (iv!=NULL) delete iv;
329 (*Tl)[0] = IDELEMS(arg);
330 return resPairs;
331}
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:188
static int syChMin(intvec *iv)
Definition syz1.cc:270

◆ syInitSyzMod()

int syInitSyzMod ( syStrategy syzstr,
int index,
int init = 17 )

Definition at line 1459 of file syz1.cc.

1460{
1461 int result;
1462
1463 if (syzstr->res[index]==NULL)
1464 {
1465 syzstr->res[index] = idInit(init-1,1);
1466 syzstr->truecomponents[index] = (int*)omAlloc0(init*sizeof(int));
1467 syzstr->ShiftedComponents[index] = (long*)omAlloc0(init*sizeof(long));
1468 if (index==0)
1469 {
1470 for (int i=0;i<init;i++)
1471 {
1472 syzstr->truecomponents[0][i] = i;
1473 syzstr->ShiftedComponents[0][i] = (i)*SYZ_SHIFT_BASE;
1474 }
1475 }
1476 syzstr->backcomponents[index] = (int*)omAlloc0(init*sizeof(int));
1477 syzstr->Howmuch[index] = (int*)omAlloc0(init*sizeof(int));
1478 syzstr->Firstelem[index] = (int*)omAlloc0(init*sizeof(int));
1479 syzstr->elemLength[index] = (int*)omAlloc0(init*sizeof(int));
1480 syzstr->orderedRes[index] = idInit(init-1,1);
1481 syzstr->sev[index] = (unsigned long*) omAlloc0(init*sizeof(unsigned long));
1482 result = 0;
1483 }
1484 else
1485 {
1486 result = IDELEMS(syzstr->res[index]);
1487 while ((result>0) && (syzstr->res[index]->m[result-1]==NULL)) result--;
1488 }
1489 return result;
1490}
void init()
Definition lintree.cc:864
#define SYZ_SHIFT_BASE
Definition syz.h:18

◆ syKillComputation()

void syKillComputation ( syStrategy syzstr,
ring r = currRing )

Definition at line 1495 of file syz1.cc.

1496{
1497 if (syzstr->references>0)
1498 {
1499 (syzstr->references)--;
1500 }
1501 else
1502 {
1503 int i,j;
1504 if (syzstr->minres!=NULL)
1505 {
1506 for (i=0;i<syzstr->length;i++)
1507 {
1508 if (syzstr->minres[i]!=NULL)
1509 {
1510 id_Delete(&(syzstr->minres[i]),r);
1511 }
1512 }
1513 omFreeSize((ADDRESS)syzstr->minres,(syzstr->length+1)*sizeof(ideal));
1514 }
1515 if (syzstr->fullres!=NULL)
1516 {
1517 for (i=0;i<syzstr->length;i++)
1518 {
1519 if (syzstr->fullres[i]!=NULL)
1520 {
1521 id_Delete(&(syzstr->fullres[i]),r);
1522 }
1523 }
1524 omFreeSize((ADDRESS)syzstr->fullres,(syzstr->length+1)*sizeof(ideal));
1525 }
1526 if (syzstr->weights!=NULL)
1527 {
1528 for (i=0;i<syzstr->length;i++)
1529 {
1530 if (syzstr->weights[i]!=NULL)
1531 {
1532 delete syzstr->weights[i];
1533 }
1534 }
1535 omFreeSize((ADDRESS)syzstr->weights,syzstr->length*sizeof(intvec*));
1536 }
1537
1538 ring sr=syzstr->syRing;
1539 if (sr==NULL) sr=r;
1540
1541 if (syzstr->resPairs!=NULL)
1542 {
1543 for (i=0;i<syzstr->length;i++)
1544 {
1545 for (j=0;j<(*syzstr->Tl)[i];j++)
1546 {
1547 if ((syzstr->resPairs[i])[j].lcm!=NULL)
1548 p_Delete(&((syzstr->resPairs[i])[j].lcm),sr);
1549 if ((i>0) && ((syzstr->resPairs[i])[j].syz!=NULL))
1550 p_Delete(&((syzstr->resPairs[i])[j].syz),sr);
1551 }
1552 if (syzstr->orderedRes[i]!=NULL)
1553 {
1554 for (j=0;j<IDELEMS(syzstr->orderedRes[i]);j++)
1555 {
1556 syzstr->orderedRes[i]->m[j] = NULL;
1557 }
1558 id_Delete(&(syzstr->orderedRes[i]),sr);
1559 }
1560 if (syzstr->truecomponents[i]!=NULL)
1561 {
1562 omFreeSize((ADDRESS)syzstr->truecomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1563 syzstr->truecomponents[i]=NULL;
1564 omFreeSize((ADDRESS)syzstr->ShiftedComponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(long));
1565 syzstr->ShiftedComponents[i]=NULL;
1566 }
1567 if (syzstr->backcomponents[i]!=NULL)
1568 {
1569 omFreeSize((ADDRESS)syzstr->backcomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1570 syzstr->backcomponents[i]=NULL;
1571 }
1572 if (syzstr->Howmuch[i]!=NULL)
1573 {
1574 omFreeSize((ADDRESS)syzstr->Howmuch[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1575 syzstr->Howmuch[i]=NULL;
1576 }
1577 if (syzstr->Firstelem[i]!=NULL)
1578 {
1579 omFreeSize((ADDRESS)syzstr->Firstelem[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1580 syzstr->Firstelem[i]=NULL;
1581 }
1582 if (syzstr->elemLength[i]!=NULL)
1583 {
1584 omFreeSize((ADDRESS)syzstr->elemLength[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1585 syzstr->elemLength[i]=NULL;
1586 }
1587 if (syzstr->res[i]!=NULL)
1588 {
1589 for (j=0;j<IDELEMS(syzstr->res[i]);j++)
1590 {
1591 if (syzstr->res[i]->m[j]!=NULL)
1592 p_Delete(&(syzstr->res[i]->m[j]),sr);
1593 }
1594 }
1595 if ((syzstr->hilb_coeffs!=NULL)
1596 && (syzstr->hilb_coeffs[i]!=NULL))
1597 delete syzstr->hilb_coeffs[i];
1598 if (syzstr->sev[i] != NULL)
1599 omFreeSize((ADDRESS)syzstr->sev[i], (IDELEMS(syzstr->res[i])+1)*sizeof(unsigned long));
1600 id_Delete(&(syzstr->res[i]),sr);
1601 if (syzstr->resPairs[i] != NULL) // OB: ????
1602 omFreeSize((ADDRESS)syzstr->resPairs[i],(*syzstr->Tl)[i]*sizeof(SObject));
1603 }
1604 omFreeSize((ADDRESS)syzstr->resPairs,syzstr->length*sizeof(SObject*));
1605 omFreeSize((ADDRESS)syzstr->res,(syzstr->length+1)*sizeof(ideal));
1606 omFreeSize((ADDRESS)syzstr->orderedRes,(syzstr->length+1)*sizeof(ideal));
1607 omFreeSize((ADDRESS)syzstr->elemLength,(syzstr->length+1)*sizeof(int*));
1608 omFreeSize((ADDRESS)syzstr->truecomponents,(syzstr->length+1)*sizeof(int*));
1609 omFreeSize((ADDRESS)syzstr->ShiftedComponents,(syzstr->length+1)*sizeof(long*));
1610 if (syzstr->sev != NULL)
1611 omFreeSize(((ADDRESS)syzstr->sev), (syzstr->length+1)*sizeof(unsigned long*));
1612 omFreeSize((ADDRESS)syzstr->backcomponents,(syzstr->length+1)*sizeof(int*));
1613 omFreeSize((ADDRESS)syzstr->Howmuch,(syzstr->length+1)*sizeof(int*));
1614 omFreeSize((ADDRESS)syzstr->Firstelem,(syzstr->length+1)*sizeof(int*));
1615 if (syzstr->hilb_coeffs!=NULL)
1616 omFreeSize((ADDRESS)syzstr->hilb_coeffs,(syzstr->length+1)*sizeof(intvec*));
1617 }
1618 if (syzstr->cw!=NULL)
1619 delete syzstr->cw;
1620 if (syzstr->betti!=NULL)
1621 delete syzstr->betti;
1622 if (syzstr->resolution!=NULL)
1623 delete syzstr->resolution;
1624 if (syzstr->Tl!=NULL)
1625 delete syzstr->Tl;
1626 if ((syzstr->syRing != NULL) && (syzstr->syRing != r))
1627 {
1628 if(syzstr->syRing->typ[1].ord_typ == ro_syzcomp)
1629 rChangeSComps(NULL, NULL, 0, syzstr->syRing);
1630
1631 rDelete(syzstr->syRing);
1632 }
1633 omFreeSize((ADDRESS)syzstr, sizeof(ssyStrategy));
1634 }
1635}
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition ring.cc:4497
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
@ ro_syzcomp
Definition ring.h:60
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
short references
Definition syz.h:63
intvec * resolution
Definition syz.h:51

◆ syKillEmptyEntres()

void syKillEmptyEntres ( resolvente res,
int length )

Definition at line 2199 of file syz1.cc.

2200{
2201 int i,j,jj,k,rj;
2202 intvec * changes;
2203 poly p;
2204 ideal ri;
2205
2206 for (i=0;i<length;i++)
2207 {
2208 ri = res[i];
2209 if (ri!=NULL)
2210 {
2211 rj = IDELEMS(ri);
2212 changes = new intvec(rj+1,1,-1);
2213 while ((rj>0) && (ri->m[rj-1]==NULL)) rj--;
2214 j = k = 0;
2215 while (j+k<rj)
2216 {
2217 if (ri->m[j+k]!=NULL)
2218 {
2219 ri->m[j] = ri->m[j+k];
2220 (*changes)[j+k+1] = j+1;
2221 j++;
2222 }
2223 else
2224 {
2225 k++;
2226 }
2227 }
2228 for (jj=j;jj<rj;jj++)
2229 ri->m[jj] = NULL;
2230 if (res[i+1]!=NULL)
2231 {
2232 ri = res[i+1];
2233 for (j=IDELEMS(ri)-1;j>=0;j--)
2234 {
2235 p = ri->m[j];
2236 while (p!=NULL)
2237 {
2238 pSetComp(p,(*changes)[pGetComp(p)]);
2239 pSetm(p);
2240 pIter(p);
2241 }
2242 }
2243 }
2244 delete changes;
2245 }
2246 }
2247}
#define pIter(p)
Definition monomials.h:37
#define pSetm(p)
Definition polys.h:272
#define pSetComp(p, v)
Definition polys.h:39

◆ syKosz()

syStrategy syKosz ( ideal arg,
int * length )

Definition at line 1766 of file syz3.cc.

1767{
1768 int i,j,jj,k=0,index=0,rk_arg/*,next_syz=0*/;
1769 int crit_comp,t_comp,next_deg,old_tl;
1770 ideal temp=NULL,old_ideal,old_repr;
1771 ring origR = currRing;
1772 poly next_gen;
1773 BOOLEAN isRegular;
1774
1775 discard_pairs = 0;
1776 short_pairs = 0;
1777 if (idIs0(arg)) return NULL;
1778 rk_arg = id_RankFreeModule(arg,currRing);
1779 syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
1780/*--- changes to a Cdp-ring ----------------------------*/
1781 syzstr->syRing = rAssure_C_dp(origR); rChangeCurrRing(syzstr->syRing);
1782/*--- initializes the data structures---------------*/
1783 syzstr->length = *length = (syzstr->syRing->N)+2;
1784 syzstr->regularity = -1;
1785 if (origR!=syzstr->syRing)
1786 temp = idrCopyR(arg, origR, syzstr->syRing);
1787 else
1788 temp = idCopy(arg);
1789 if (rk_arg==0)
1790 {
1791 id_Shift(temp,1,currRing);
1792 }
1793 idSkipZeroes(temp);
1794#ifdef WITH_SORT
1795 if (temp->m[0]!=NULL)
1796 {
1797 int md;
1798 int maxdeg=p_FDeg(temp->m[IDELEMS(temp)-1],currRing);
1799 ideal temp1=idInit(IDELEMS(temp),temp->rank);
1800 for (j=IDELEMS(temp)-2;j>=0;j--)
1801 {
1802 jj = p_FDeg(temp->m[j],currRing);
1803 if (jj>maxdeg) maxdeg = jj;
1804 }
1805 while (!idIs0(temp))
1806 {
1807 md = maxdeg;
1808 for (j=IDELEMS(temp)-1;j>=0;j--)
1809 {
1810 if (temp->m[j]!=NULL)
1811 {
1812 jj = p_FDeg(temp->m[j],currRing);
1813 if (jj<md) md = jj;
1814 }
1815 }
1816 for (j=0;j<IDELEMS(temp);j++)
1817 {
1818 if ((temp->m[j]!=NULL) && (p_FDeg(temp->m[j],currRing)==md))
1819 {
1820 temp1->m[k] = temp->m[j];
1821 temp->m[j] = NULL;
1822 k++;
1823 }
1824 }
1825 }
1826 idDelete(&temp);
1827 temp = temp1;
1828 temp1 = NULL;
1829 }
1830#endif
1831#ifdef USE_REGULARITY
1832 int last_generator=IDELEMS(temp)-1;
1833 while ((last_generator>=0) && (temp->m[last_generator]==NULL))
1834 last_generator--;
1835#endif
1836 syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1837 syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1838 resolvente totake=(resolvente)omAlloc0((*length+1)*sizeof(ideal));
1839 syzstr->Tl = new intvec(*length+1);
1840 syzstr->bucket = kBucketCreate(currRing);
1842 ideal new_generators=idInit(1,si_max(rk_arg,1));
1843 ideal temp_gens,old_std;
1844 syzstr->res[0] = idInit(1,1);
1845 if (rk_arg>1) syzstr->res[0]->rank = rk_arg;
1846 syzstr->orderedRes[0] = idInit(1,1);
1847/*--- computes the resolution ----------------------*/
1848 i = 0;
1849 while (i<IDELEMS(temp))
1850 {
1851 if (temp->m[i]!=NULL)
1852 {
1853 new_generators->m[0] = kNF(syzstr->res[0],currRing->qideal,temp->m[i]);
1854 if (!nIsOne(pGetCoeff(new_generators->m[0])))
1855 pNorm(new_generators->m[0]);
1856 next_deg = p_FDeg(new_generators->m[0],currRing);
1857 next_gen = pCopy(new_generators->m[0]);
1858 }
1859 if (!idIs0(new_generators))
1860 {
1861 index = 0;
1862 while (index<=*length)
1863 {
1864 if (index==0)
1865 {
1866 old_ideal = idCopy(syzstr->res[0]);
1867 old_repr = idCopy(syzstr->orderedRes[0]);
1868 old_tl = (*syzstr->Tl)[0];
1869 old_std = id_Head(syzstr->res[0],currRing);
1870 }
1871 t_comp = (*syzstr->Tl)[index];
1872 if (index==0) crit_comp = t_comp;
1873 temp_gens = syAppendSyz(new_generators,syzstr, index,crit_comp,totake);
1874 crit_comp = t_comp;
1875 if (index==0)
1876 {
1877 isRegular = syIsRegular(old_std,syzstr->res[0],next_deg);
1878#ifndef ONLY_STD
1879 if (isRegular)
1880 syCreateRegularExtension(syzstr,old_ideal,old_repr,old_tl,next_gen,
1881 totake);
1882#ifdef USE_REGULARITY
1883 if ((index==0) && (!isRegular) && (i==last_generator))
1884 {
1885/*----------- we are computing the regularity -----------------------*/
1886 ideal initial=id_Head(syzstr->res[0],currRing);
1887 int len=0,reg=0;
1888 intvec *w=NULL;
1889 ring dp_C_ring = rAssure_dp_C(currRing); rChangeCurrRing(dp_C_ring);
1890 initial = idrMoveR_NoSort(initial, syzstr->syRing, dp_C_ring);
1892 intvec * dummy = syBetti(res,len,&reg, w);
1893 syzstr->regularity = reg+2;
1894 delete dummy;
1895 delete w;
1896 for (j=0;j<len;j++)
1897 {
1898 if (res[j]!=NULL) idDelete(&(res[j]));
1899 }
1900 omFreeSize((ADDRESS)res,len*sizeof(ideal));
1901 idDelete(&initial);
1902 rChangeCurrRing(syzstr->syRing);
1903 rDelete(dp_C_ring);
1904 }
1905#endif
1906#endif
1907 idDelete(&old_ideal);
1908 idDelete(&old_repr);
1909 idDelete(&old_std);
1910 if (TEST_OPT_PROT)
1911 {
1912 if (isRegular)
1913 PrintS("\n regular\n");
1914 else
1915 PrintS("\n not regular\n");
1916 }
1917 if (next_gen!=NULL)
1918 pDelete(&next_gen);
1919 if (isRegular)
1920 {
1921 idDelete(&temp_gens);
1922 break;
1923 }
1924 }
1925 idDelete(&new_generators);
1926 new_generators = temp_gens;
1927#ifdef ONLY_STD
1928 break;
1929#endif
1930 if (idIs0(new_generators)) break;
1931 index++;
1932 }
1933 if (!idIs0(new_generators))
1934 {
1935 for (j=0;j<IDELEMS(new_generators);j++)
1936 {
1937 if (new_generators->m[j]!=NULL)
1938 {
1939 pDelete(&new_generators->m[j]);
1940 new_generators->m[j] = NULL;
1941 }
1942 }
1943 }
1944 }
1945 i++;
1946 }
1947 if (idIs0(new_generators) && new_generators!=NULL) idDelete(&new_generators);
1948 if (temp!=NULL) idDelete(&temp);
1949 kBucketDestroy(&(syzstr->bucket));
1950 kBucketDestroy(&(syzstr->syz_bucket));
1951 index = 0;
1952 syzstr->fullres = syzstr->res;
1953 syzstr->res = NULL;
1954 index = 0;
1955 while ((index<=*length) && (syzstr->fullres[index]!=NULL))
1956 {
1957#ifdef SHOW_RESULT
1958 Print("The %d-th syzygy-module is now:\n",index);
1959 ideal ttt=id_Head(syzstr->fullres[index],currRing);
1960 idShow(ttt);
1961 idDelete(&ttt);
1962 //if (index>0)
1963 //{
1964 //Print("The related module is: \n");
1965 //idPrint(totake[index-1]);
1966 //}
1967 //Print("The %d-th module of the minimal resolution is:\n",index);
1968 if (!idIs0(totake[index]))
1969 idShow(totake[index]);
1970 //Print("with standard basis:\n");
1971 //idPrint(syzstr->fullres[index]);
1972 //if ((index<*length) && (totake[index+1]!=NULL))
1973 //{
1974 //Print("The %d-th syzygy-module is now:\n",index+1);
1975 //idPrint(totake[index+1]);
1976 //matrix m1=idModule2Matrix(totake[index]);
1977 //matrix m2=idModule2Matrix(totake[index+1]);
1978 //matrix m3=mpMult(m1,m2);
1979 //idPrint((ideal)m3);
1980 //}
1981#endif
1982 if (!idIs0(totake[index]))
1983 {
1984 for(i=0;i<IDELEMS(totake[index]);i++)
1985 {
1986 if (totake[index]->m[i]!=NULL)
1987 {
1988 j=0;
1989 while ((j<IDELEMS(syzstr->fullres[index])) &&
1990 ((syzstr->fullres[index]->m[j]==NULL) ||
1991 (!pLmEqual(syzstr->fullres[index]->m[j],totake[index]->m[i])))) j++;
1992 if (j<IDELEMS(syzstr->fullres[index]))
1993 {
1994 pDelete(&totake[index]->m[i]);
1995 totake[index]->m[i] = syzstr->fullres[index]->m[j];
1996 syzstr->fullres[index]->m[j] = NULL;
1997 }
1998 else
1999 {
2000 PrintS("Da ist was faul!!!\n");
2001 Print("Aber: Regularitaet %d, Grad %ld\n",
2002 syzstr->regularity,p_FDeg(totake[index]->m[i],currRing));
2003 }
2004 }
2005 }
2006 idDelete(&syzstr->fullres[index]);
2007 syzstr->fullres[index] = totake[index];
2008 }
2009#ifdef SHOW_RESULT
2010 idShow(syzstr->fullres[index]);
2011#endif
2012 index++;
2013 }
2014 syReorder_Kosz(syzstr);
2015 index = 0;
2016 while ((index<=*length) && (syzstr->orderedRes[index]!=NULL))
2017 {
2018 idDelete(&(syzstr->orderedRes[index]));
2019 index++;
2020 }
2021 if (origR!=syzstr->syRing)
2022 {
2023 rChangeCurrRing(origR);
2024 index = 0;
2025 while ((index<=*length) && (syzstr->fullres[index]!=NULL))
2026 {
2027 syzstr->fullres[index] = idrMoveR(syzstr->fullres[index],syzstr->syRing, origR);
2028 index++;
2029 }
2030 }
2031 delete syzstr->Tl;
2032 syzstr->Tl = NULL;
2033 rDelete(syzstr->syRing);
2034 syzstr->syRing = NULL;
2035 omFreeSize((ADDRESS)totake,(*length+1)*sizeof(ideal));
2036 omFreeSize((ADDRESS)syzstr->orderedRes,(*length+1)*sizeof(ideal));
2037//Print("Pairs to discard: %d\n",discard_pairs);
2038//Print("Pairs shorter reduced: %d\n",short_pairs);
2039//discard_pairs = 0;
2040//short_pairs = 0;
2041 return syzstr;
2042}
ideal idCopy(ideal A)
Definition ideals.h:60
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition initial.cc:30
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3224
#define nIsOne(n)
Definition numbers.h:25
#define pLmEqual(p1, p2)
Definition polys.h:112
void pNorm(poly p)
Definition polys.h:363
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:248
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition prCopy.cc:192
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:261
ring rAssure_C_dp(const ring r)
Definition ring.cc:5129
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
void id_Shift(ideal M, int s, const ring r)
static ideal syAppendSyz(ideal new_generators, syStrategy syzstr, int index, int crit_comp, resolvente totake)
Definition syz3.cc:1690
static void syCreateRegularExtension(syStrategy syzstr, ideal old_ideal, ideal old_repr, int old_tl, poly next_generator, resolvente totake)
Definition syz3.cc:111
void syReorder_Kosz(syStrategy syzstr)
Definition syz3.cc:261
VAR int short_pairs
Definition syz3.cc:49
VAR int discard_pairs
Definition syz3.cc:48
static BOOLEAN syIsRegular(ideal old_ideal, ideal new_ideal, int deg)
Definition syz3.cc:55
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition syz0.cc:855
int regularity
Definition syz.h:61

◆ syLaScala()

syStrategy syLaScala ( ideal arg,
int & maxlength,
intvec * weights = NULL )

Definition at line 2558 of file syz1.cc.

2559{
2560 int i,j,actdeg=32000,index=0;
2561 int howmuch;
2562 ideal temp;
2563 SSet nextPairs;
2564 syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
2565 ring origR = currRing;
2566
2567 if(weights!= NULL)
2568 syzstr->cw = new intvec(weights);
2569 else
2570 syzstr->cw = NULL;
2571
2572 if ((idIs0(arg)) ||
2573 ((id_RankFreeModule(arg,currRing)>0) && (!idTestHomModule(arg, NULL, syzstr->cw))))
2574 {
2576 syzstr->length = 1;
2577 syzstr->minres[0] = idInit(1,arg->rank);
2578 return syzstr;
2579 }
2580
2581
2582 //crit = 0;
2583 //euler = -1;
2584
2585 if( maxlength > 0 )
2586 syzstr->length = maxlength; // = (currRing->N)+2;
2587 else
2588 syzstr->length = maxlength = (currRing->N)+2;
2589
2590 // Creare dp,S ring and change to it
2591 syzstr->syRing = rAssure_dp_S(origR);
2592 assume(syzstr->syRing != origR);
2593 assume(syzstr->syRing->typ[1].ord_typ == ro_syzcomp);
2594 rChangeCurrRing(syzstr->syRing);
2595
2596 // set initial ShiftedComps
2597 currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
2598 currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
2599 for (i=0;i<=arg->rank;i++)
2600 {
2602 currcomponents[i] = i;
2603 }
2605/*--- initializes the data structures---------------*/
2606 syzstr->Tl = new intvec(maxlength);
2607 temp = idInit(IDELEMS(arg),arg->rank);
2608 for (i=0;i<IDELEMS(arg);i++)
2609 {
2610 temp->m[i] = prCopyR( arg->m[i], origR, currRing);
2611 if (temp->m[i]!=NULL)
2612 {
2613 j = pTotaldegree(temp->m[i]);
2614 if (j<actdeg) actdeg = j;
2615 }
2616 }
2617 idTest(temp);
2618 idSkipZeroes(temp);
2619 idTest(temp);
2620 syzstr->resPairs = syInitRes(temp,&maxlength,syzstr->Tl,syzstr->cw);
2621 omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
2622 omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
2623
2624 syzstr->res = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
2625 syzstr->orderedRes = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
2626 syzstr->elemLength = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2627
2628 syzstr->truecomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2629 syzstr->ShiftedComponents = (long**)omAlloc0((maxlength+1)*sizeof(long*));
2630
2631 syzstr->backcomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2632 syzstr->Howmuch = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2633 syzstr->Firstelem = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2634 syzstr->sev = (unsigned long **) omAlloc0((maxlength+1)*sizeof(unsigned long *));
2635
2636 assume( syzstr->length == maxlength );
2637
2638 syzstr->bucket = kBucketCreate(currRing);
2639 int len0=id_RankFreeModule(temp,currRing)+1;
2640
2641 nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2642 //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2643/*--- computes the resolution ----------------------*/
2644 while (nextPairs!=NULL)
2645 {
2646 if (TEST_OPT_PROT) Print("%d",actdeg);
2647 if (TEST_OPT_PROT) Print("(m%d)",index);
2648 if (index==0)
2649 i = syInitSyzMod(syzstr,index,len0);
2650 else
2651 i = syInitSyzMod(syzstr,index);
2652 currcomponents = syzstr->truecomponents[si_max(index-1,0)];
2655 IDELEMS(syzstr->res[si_max(index-1,0)]), currRing);
2656 j = syInitSyzMod(syzstr,index+1);
2657 if (index>0)
2658 {
2659 syRedNextPairs(nextPairs,syzstr,howmuch,index);
2660 syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
2661 }
2662 else
2663 syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
2664/*--- creates new pairs -----------------------------*/
2665 syCreateNewPairs(syzstr,index,i);
2666 if (index<(maxlength-1))
2667 {
2668 syCreateNewPairs(syzstr,index+1,j);
2669 }
2670 index++;
2671 nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2672 //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2673 }
2674 if (temp!=NULL) idDelete(&temp);
2675 kBucketDestroy(&(syzstr->bucket));
2676 if (origR != syzstr->syRing)
2677 rChangeCurrRing(origR);
2678 if (TEST_OPT_PROT) PrintLn();
2679 return syzstr;
2680}
#define assume(x)
Definition mod2.h:389
#define omAlloc0Bin(bin)
ring rAssure_dp_S(const ring r)
Definition ring.cc:5114
EXTERN_VAR omBin char_ptr_bin
Definition structs.h:73
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw)
Definition syz1.cc:293
static void syCreateNewPairs(syStrategy syzstr, int index, int newEl)
Definition syz1.cc:1069
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
Definition syz1.cc:104
static void syRedGenerOfCurrDeg(syStrategy syzstr, int deg, int index)
Definition syz1.cc:915
int syInitSyzMod(syStrategy syzstr, int index, int init)
Definition syz1.cc:1459
static void syRedNextPairs(SSet nextPairs, syStrategy syzstr, int howmuch, int index)
Definition syz1.cc:768
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
Definition syz1.cc:1288

◆ syLaScala1()

resolvente syLaScala1 ( ideal arg,
int * length )

◆ syLaScala3()

syStrategy syLaScala3 ( ideal arg,
int * length )

Definition at line 2432 of file syz1.cc.

2433{
2434 int i,j,actdeg=32000,index=0;
2435 int howmuch;
2436 ideal temp;
2437 SSet nextPairs;
2438 syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
2439 ring origR = currRing;
2440
2441 if ((idIs0(arg)) ||
2442 ((id_RankFreeModule(arg,currRing)>0) && (!idHomModule(arg,NULL,&(syzstr->cw)))))
2443 {
2445 syzstr->length = 1;
2446 syzstr->minres[0] = idInit(1,arg->rank);
2447 return syzstr;
2448 }
2449
2450 //crit = 0;
2451 //euler = -1;
2452 syzstr->length = *length = (currRing->N)+2;
2453
2454 // Creare dp,S ring and change to it
2455 syzstr->syRing = rAssure_dp_S(origR);
2456 assume(syzstr->syRing != origR); // why?
2457 rChangeCurrRing(syzstr->syRing);
2458
2459 // set initial ShiftedComps
2460 currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
2461 currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
2462 for (i=0;i<=arg->rank;i++)
2463 {
2465 currcomponents[i] = i;
2466 }
2468/*--- initializes the data structures---------------*/
2469 syzstr->Tl = new intvec(*length);
2470 temp = idInit(IDELEMS(arg),arg->rank);
2471 for (i=0;i<IDELEMS(arg);i++)
2472 {
2473 temp->m[i] = prCopyR( arg->m[i], origR, syzstr->syRing);
2474 if (temp->m[i]!=NULL)
2475 {
2476 j = pTotaldegree(temp->m[i]);
2477 if (j<actdeg) actdeg = j;
2478 }
2479 }
2480 idTest(temp);
2481 idSkipZeroes(temp);
2482 idTest(temp);
2483 syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw);
2484 omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
2485 omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
2486 syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
2487 syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
2488 syzstr->elemLength = (int**)omAlloc0((*length+1)*sizeof(int*));
2489 syzstr->truecomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
2490 syzstr->ShiftedComponents = (long**)omAlloc0((*length+1)*sizeof(long*));
2491 syzstr->backcomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
2492 syzstr->Howmuch = (int**)omAlloc0((*length+1)*sizeof(int*));
2493 syzstr->Firstelem = (int**)omAlloc0((*length+1)*sizeof(int*));
2494 syzstr->sev = (unsigned long **) omAlloc0((*length+1)*sizeof(unsigned long *));
2495 syzstr->bucket = kBucketCreate(currRing);
2496 int len0=id_RankFreeModule(temp,currRing)+1;
2497
2498 nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2499 //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2500/*--- computes the resolution ----------------------*/
2501 while (nextPairs!=NULL)
2502 {
2503 if (TEST_OPT_PROT) Print("%d",actdeg);
2504 if (TEST_OPT_PROT) Print("(m%d)",index);
2505 if (index==0)
2506 i = syInitSyzMod(syzstr,index,len0);
2507 else
2508 i = syInitSyzMod(syzstr,index);
2509 currcomponents = syzstr->truecomponents[si_max(index-1,0)];
2512 IDELEMS(syzstr->res[si_max(index-1,0)]), currRing);
2513 j = syInitSyzMod(syzstr,index+1);
2514 if (index>0)
2515 {
2516 syRedNextPairs(nextPairs,syzstr,howmuch,index);
2517 syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
2518 }
2519 else
2520 syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
2521/*--- creates new pairs -----------------------------*/
2522 syCreateNewPairs(syzstr,index,i);
2523 if (index<(*length)-1)
2524 {
2525 syCreateNewPairs(syzstr,index+1,j);
2526 }
2527 index++;
2528 nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2529 //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2530 }
2531 if (temp!=NULL) idDelete(&temp);
2532 kBucketDestroy(&(syzstr->bucket));
2533
2534 if (origR != syzstr->syRing)
2535 rChangeCurrRing(origR);
2536
2537 if (TEST_OPT_PROT) PrintLn();
2538
2539 assume(syzstr->minres==NULL); assume(syzstr->fullres ==NULL);
2540 assume(syzstr->resPairs!=NULL); assume(syzstr->hilb_coeffs==NULL);
2541 assume(syzstr->res!=NULL);
2542
2544 syzstr->minres = syReadOutMinimalRes(syzstr);
2545 else
2546 syzstr->fullres = syReorder(syzstr->res, syzstr->length, syzstr); // buggy? (betti...?)
2547
2548 return syzstr;
2549}
#define TEST_OPT_NO_SYZ_MINIM
Definition options.h:126
static resolvente syReadOutMinimalRes(syStrategy syzstr, BOOLEAN computeStd=FALSE)
Definition syz1.cc:2312

◆ syMinBase()

ideal syMinBase ( ideal arg)

Definition at line 1017 of file syz.cc.

1018{
1019 intvec ** weights=NULL;
1020 int leng;
1021 if (idIs0(arg)) return idInit(1,arg->rank);
1022 resolvente res=syResolvente(arg,1,&leng,&weights,TRUE);
1023 ideal result=res[0];
1024 omFreeSize((ADDRESS)res,leng*sizeof(ideal));
1025 if (weights!=NULL)
1026 {
1027 if (*weights!=NULL)
1028 {
1029 delete (*weights);
1030 *weights=NULL;
1031 }
1032 if ((leng>=1) && (*(weights+1)!=NULL))
1033 {
1034 delete *(weights+1);
1035 *(weights+1)=NULL;
1036 }
1037 }
1039 return result;
1040}
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition syz.cc:401

◆ syMinimize()

syStrategy syMinimize ( syStrategy syzstr)

Definition at line 2393 of file syz1.cc.

2394{
2395 if (syzstr->minres==NULL)
2396 {
2397 if (syzstr->resolution!=NULL)
2398 {
2399 // need to clear syzstr->resolution, as we are
2400 // now displaying the minres instead of fullres
2401 delete syzstr->resolution;
2402 syzstr->resolution=NULL;
2403 }
2404 if (syzstr->resPairs!=NULL)
2405 {
2406 if (syzstr->hilb_coeffs==NULL)
2407 {
2408 // La Scala Resolution
2409 syzstr->minres = syReadOutMinimalRes(syzstr);
2410 }
2411 else
2412 { // HRES
2413 syzstr->minres = syReorder(syzstr->orderedRes,syzstr->length,syzstr);
2414 }
2415 }
2416 else if (syzstr->fullres!=NULL)
2417 {
2418 syMinimizeResolvente(syzstr->fullres,syzstr->length,1);
2419 syzstr->minres = syzstr->fullres;
2420 syzstr->fullres = NULL;
2421 }
2422 }
2423 (syzstr->references)++;
2424 return syzstr;
2425}
void syMinimizeResolvente(resolvente res, int length, int first)
Definition syz.cc:367

◆ syMinimize_with_map()

void syMinimize_with_map ( syStrategy res,
ideal & trans )

Definition at line 1185 of file syz.cc.

1186{
1187 ideal *r=res->minres;
1188 if (r==NULL) r=res->fullres;
1189 ideal org=idCopy(r[0]);
1191 r=res->minres;
1192 if (r==NULL) r=res->fullres;
1193 trans=idLift(org,r[0],NULL,TRUE,FALSE,FALSE,NULL);
1194}
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...
Definition ideals.cc:1111
syStrategy syMinimize(syStrategy syzstr)
Definition syz1.cc:2393

◆ syMinimizeCopy()

syStrategy syMinimizeCopy ( syStrategy org)

Definition at line 1196 of file syz.cc.

1197{
1199
1200 result->length=org->length;
1201 if (org->weights!=NULL)
1202 {
1203 result->weights=(intvec**)omAlloc0(org->length*sizeof(intvec*));
1204 for (int i=org->length-1;i>=0;i--)
1205 {
1206 if (org->weights[i]!=NULL)
1207 {
1208 result->weights[i]=ivCopy(org->weights[i]);
1209 }
1210 }
1211 }
1212 result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
1213 resolvente fr = org->minres;
1214 if (fr==NULL) fr=org->fullres;
1215
1216 for (int i=result->length-1;i>=0;i--)
1217 {
1218 if (fr[i]!=NULL)
1219 result->fullres[i] = idCopy(fr[i]);
1220 }
1221 result->list_length=result->length;
1223 return result;
1224}

◆ syMinimizeResolvente()

void syMinimizeResolvente ( resolvente res,
int length,
int first )

Definition at line 367 of file syz.cc.

368{
369 int syzIndex=first;
370 intvec *dummy;
371
372 if (syzIndex<1) syzIndex=1;
373 if ((syzIndex==1) && (!rIsPluralRing(currRing)) && (idHomModule(res[0],currRing->qideal,&dummy)))
374 {
376 delete dummy;
377 return;
378 }
379 while ((syzIndex<length-1) && (res[syzIndex]!=NULL) && (res[syzIndex+1]!=NULL))
380 {
381 syMinStep(res[syzIndex-1],res[syzIndex],FALSE,res[syzIndex+1]);
382 syzIndex++;
383 }
384 if (res[syzIndex]!=NULL)
385 syMinStep(res[syzIndex-1],res[syzIndex]);
386 if (!idIs0(res[0]))
388}
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition ideals.cc:2824
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static void syMinStep1(resolvente res, int length)
Definition syz.cc:296
static void syMinStep(ideal mod, ideal &syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
Definition syz.cc:82

◆ syMres_with_map()

syStrategy syMres_with_map ( ideal arg,
int maxlength,
intvec * w,
ideal & trans )

Definition at line 1176 of file syz.cc.

1177{
1178 syStrategy res=syResolution(arg,maxlength,w,1);
1179 ideal *r=res->minres;
1180 if (r==NULL) r=res->fullres;
1181 trans=idLift(arg,r[0],NULL,TRUE,FALSE,FALSE,NULL);
1182 return res;
1183}
syStrategy syResolution(ideal arg, int maxlength, intvec *w, BOOLEAN minim)
Definition syz.cc:626

◆ syPrint()

void syPrint ( syStrategy syzstr,
const char * currRingName )

Definition at line 1935 of file syz1.cc.

1936{
1937 if ( (syzstr->resPairs==NULL) &&
1938 (syzstr->fullres==NULL) &&
1939 (syzstr->minres==NULL) &&
1940 (syzstr->resolution == NULL) )
1941 {
1942 PrintS("No resolution defined\n");
1943 return;
1944 }
1945
1946 intvec* resolution = syzstr->resolution;
1947
1948 if (resolution==NULL)
1949 {
1950 if (syzstr->resPairs!=NULL)
1951 {
1952 resolution = new intvec(syzstr->length+1);
1953 SRes rP = syzstr->resPairs;
1954// assume(idRankFreeModule(syzstr->res[1], (syzstr->syRing != NULL ? syzstr->syRing : currRing))==syzstr->res[1]->rank);
1955 (*resolution)[0] = syzstr->res[1]->rank;
1956 int k=0;
1957 while ((k<syzstr->length) && (rP[k]!=NULL))
1958 {
1959 int j = 0;
1960 while ((j<(*syzstr->Tl)[k]) &&
1961 ((rP[k][j].lcm!=NULL) || (rP[k][j].syz!=NULL)))
1962 {
1963 if (rP[k][j].isNotMinimal==NULL)
1964 ((*resolution)[k+1])++;
1965 j++;
1966 }
1967 k++;
1968 }
1969 }
1970 else
1971 {
1972 resolution = new intvec(syzstr->length+2);
1973 resolvente rr;
1974 if (syzstr->minres!=NULL)
1975 rr = syzstr->minres;
1976 else
1977 rr = syzstr->fullres;
1978 (*resolution)[0]
1979 = si_max(1,(int)id_RankFreeModule(rr[0],
1980 (syzstr->syRing != NULL ? syzstr->syRing : currRing)));
1981 int k=0;
1982 while ((k<syzstr->length) && (rr[k]!=NULL))
1983 {
1984 (*resolution)[k+1] = idElem(rr[k]);
1985 k++;
1986 }
1987 }
1988 }
1989
1990 int sl=strlen(sn);
1992 int k = 0;
1993 loop
1994 {
1995 if ((k>=resolution->length()) || ((*resolution)[k]==0))
1996 break;
1997 Print("%d",(*resolution)[k]);
1998 syPrintEmptySpaces1(sl+5);
1999 k++;
2000 }
2001 PrintLn();
2002 k = 0;
2003 loop
2004 {
2005 if ((k>=resolution->length()) || ((*resolution)[k]==0))
2006 break;
2007 PrintS(sn);
2008 if (((k+1)>=resolution->length()) || ((*resolution)[(k+1)]==0))
2009 break;
2010 PrintS(" <-- ");
2011 syPrintEmptySpaces((*resolution)[k]);
2012 k++;
2013 }
2014 PrintS("\n\n");
2015 k = 0;
2016 loop
2017 {
2018 if ((k>=resolution->length()) || ((*resolution)[k]==0))
2019 break;
2020 Print("%d",k);
2021 syPrintEmptySpaces1(sl+5+syLengthInt((*resolution)[k])-
2022 syLengthInt(k));
2023 k++;
2024 }
2025 PrintLn();
2026 if (syzstr->minres==NULL)
2027 {
2028 PrintS("resolution not minimized yet\n");
2029 }
2030
2031 if (syzstr->resolution == NULL) syzstr->resolution = resolution;
2032}
static int syLengthInt(int i)
Definition syz1.cc:1919
static void syPrintEmptySpaces1(int i)
Definition syz1.cc:1907
static void syPrintEmptySpaces(int i)
Definition syz1.cc:1895

◆ syReorder()

resolvente syReorder ( resolvente res,
int length,
syStrategy syzstr,
BOOLEAN toCopy = TRUE,
resolvente totake = NULL )

Definition at line 1641 of file syz1.cc.

1643{
1644 int i,j,l;
1645 polyset ri1;
1646 resolvente fullres;
1647 ring origR=syzstr->syRing;
1648 fullres = (resolvente)omAlloc0((length+1)*sizeof(ideal));
1649 if (totake==NULL)
1650 totake = res;
1651 for (i=length-1;i>0;i--)
1652 {
1653 if (res[i]!=NULL)
1654 {
1655 if (i>1)
1656 {
1657 j = IDELEMS(res[i-1]);
1658 while ((j>0) && (res[i-1]->m[j-1]==NULL)) j--;
1659 fullres[i-1] = idInit(IDELEMS(res[i]),j);
1660 ri1 = totake[i-1]->m;
1661 for (j=IDELEMS(res[i])-1;j>=0;j--)
1662 {
1664 poly p = res[i]->m[j];
1665 while (p!=NULL)
1666 {
1667 poly tq;
1668 if (toCopy)
1669 {
1670 if (origR!=NULL)
1671 tq = prHeadR(p,origR, currRing);
1672 else
1673 tq = pHead(p);
1674 pIter(p);
1675 }
1676 else
1677 {
1678 res[i]->m[j] = NULL;
1679 if (origR!=NULL)
1680 {
1681 poly pp=p;
1682 pIter(p);
1683 pNext(pp)=NULL;
1684 tq = prMoveR(pp, origR, currRing);
1685 }
1686 else
1687 {
1688 tq = p;
1689 pIter(p);
1690 pNext(tq) = NULL;
1691 }
1692 }
1693// pWrite(tq);
1694 pTest(tq);
1695 for (l=(currRing->N);l>0;l--)
1696 {
1697 if (origR!=NULL)
1698 pSubExp(tq,l, p_GetExp(ri1[pGetComp(tq)-1],l,origR));
1699 else
1700 pSubExp(tq,l, pGetExp(ri1[pGetComp(tq)-1],l));
1701 }
1702 pSetm(tq);
1703 pTest(tq);
1704 sBucket_Add_m(bucket,tq);
1705 }
1706 int l_dummy;
1707 sBucketClearMerge(bucket, &(fullres[i-1]->m[j]), &l_dummy);
1708 sBucketDestroy(&bucket);
1709 }
1710 }
1711 else
1712 {
1713 if (origR!=NULL)
1714 {
1715 fullres[i-1] = idInit(IDELEMS(res[i]),res[i]->rank);
1716 for (j=IDELEMS(res[i])-1;j>=0;j--)
1717 {
1718 if (toCopy)
1719 fullres[i-1]->m[j] = prCopyR(res[i]->m[j], origR, currRing);
1720 else
1721 {
1722 fullres[i-1]->m[j] = prMoveR(res[i]->m[j], origR, currRing);
1723 res[i]->m[j] = NULL;
1724 }
1725 }
1726 }
1727 else
1728 {
1729 if (toCopy)
1730 fullres[i-1] = idCopy(res[i]);
1731 else
1732 {
1733 fullres[i-1] = res[i];
1734 res[i] = NULL;
1735 }
1736 }
1737 for (j=IDELEMS(fullres[i-1])-1;j>=0;j--)
1738 fullres[i-1]->m[j] = pSortCompCorrect(fullres[i-1]->m[j]);
1739 }
1740 if (!toCopy)
1741 {
1742 if (res[i]!=NULL) idDelete(&res[i]);
1743 }
1744 }
1745 }
1746 if (!toCopy)
1747 omFreeSize((ADDRESS)res,(length+1)*sizeof(ideal));
1748 //syzstr->length = length;
1749 return fullres;
1750}
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition cf_gcd.cc:676
#define pNext(p)
Definition monomials.h:36
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:471
#define pTest(p)
Definition polys.h:415
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
#define pGetExp(p, i)
Exponent.
Definition polys.h:42
#define pSubExp(p, i, v)
Definition polys.h:47
poly * polyset
Definition polys.h:260
#define pSortCompCorrect(p)
Assume: If considered only as poly in any component of p (say, monomials of other components of p are...
Definition polys.h:228
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition prCopy.cc:90
poly prHeadR(poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition prCopy.cc:126
void sBucketClearMerge(sBucket_pt bucket, poly *p, int *length)
Definition sbuckets.cc:237
void sBucketDestroy(sBucket_pt *bucket)
Definition sbuckets.cc:103
void sBucket_Add_m(sBucket_pt bucket, poly p)
Definition sbuckets.cc:173
sBucket_pt sBucketCreate(const ring r)
Definition sbuckets.cc:96
sBucket * sBucket_pt
Definition sbuckets.h:16

◆ syReOrderResolventFB()

void syReOrderResolventFB ( resolvente res,
int length,
int initial = 1 )

Definition at line 740 of file syz0.cc.

741{
742 int syzIndex=length-1,i,j;
743 poly p;
744
745 while ((syzIndex!=0) && (res[syzIndex]==NULL)) syzIndex--;
746 while (syzIndex>=initial)
747 {
748 for(i=0;i<IDELEMS(res[syzIndex]);i++)
749 {
750 p = res[syzIndex]->m[i];
751
752 while (p!=NULL)
753 {
754 if (res[syzIndex-1]->m[pGetComp(p)-1]!=NULL)
755 {
756 for(j=1;j<=(currRing->N);j++)
757 {
759 -pGetExp(res[syzIndex-1]->m[pGetComp(p)-1],j));
760 }
761 }
762 else
763 PrintS("error in the resolvent\n");
764 pSetm(p);
765 pIter(p);
766 }
767 }
768 syzIndex--;
769 }
770}
#define pSetExp(p, i, v)
Definition polys.h:43

◆ syReorderShiftedComponents()

long syReorderShiftedComponents ( long * sc,
int n )

Definition at line 334 of file syz1.cc.

335{
336 long holes = 0;
337 int i;
338 long new_comps = 0, new_space, max;
339
340 // count number of holes
341 for (i=1; i<n; i++)
342 {
343 if (sc[i-1] + 1 < sc[i]) holes++;
344 }
345
346 if (LONG_MAX - SYZ_SHIFT_BASE <= sc[n-1])
347 {
348 // need new components
349 new_comps = (((long) 1) << SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE) - 1;
350 max = LONG_MAX;
351 }
352 else
353 {
354 max = sc[n-1] + SYZ_SHIFT_BASE;
355 }
356
357 // no we arrange things such that
358 // (n - holes) + holes*new_space + new_comps*SYZ_SHIFT_BASE= LONG_MAX
359 new_space = (max - n + holes - new_comps*SYZ_SHIFT_BASE) / holes;
360
361 assume(new_space < SYZ_SHIFT_BASE && new_space >= 4);
362
363 long* tc = ( long*) omAlloc(n*sizeof(long));
364 tc[0] = sc[0];
365 // rearrange things
366 for (i=1; i<n; i++)
367 {
368 if (sc[i-1] + 1 < sc[i])
369 {
370 tc[i] = tc[i-1] + new_space;
371 }
372 else
373 {
374 tc[i] = tc[i-1] + 1;
375 }
376 assume(tc[i] > tc[i-1]);
377 }
378
379 assume(LONG_MAX - SYZ_SHIFT_BASE > tc[n-1]);
380#ifndef SING_NDEBUG
381 for (i=1; i<n; i++)
382 {
383 assume(tc[i] >= 0);
384 assume(tc[i-1] + 1 <= tc[i]);
385 }
386#endif
387
388 memcpy(sc, tc, n*sizeof(long));
389 omFreeSize(tc, n*sizeof(long));
390 return new_space;
391}
static int max(int a, int b)
Definition fast_mult.cc:264
#define SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE
Definition syz.h:15

◆ syResetShiftedComponents()

void syResetShiftedComponents ( syStrategy syzstr,
int index,
int hilb = 0 )

Definition at line 409 of file syz1.cc.

410{
411 assume(index > 0);
412 int i;
413 if (syzstr->res[index] != NULL)
414 {
415 long * prev_s;
416 int* prev_c;
417 int p_length;
418 rGetSComps(&prev_c, &prev_s, &p_length, currRing);
423 IDELEMS(syzstr->res[index-1]), currRing);
424 if (hilb==0)
425 {
426 ideal id = syzstr->res[index];
427 for (i=0; i<IDELEMS(id); i++)
428 {
429 pResetSetm(id->m[i]);
430 }
431 }
432 else if (hilb==1)
433 {
434 assume (index>1);
435 assume (syzstr->resPairs[index-1]!=NULL);
436 SSet Pairs=syzstr->resPairs[index-1];
437 SSet Pairs1=syzstr->resPairs[index];
438 int till=(*syzstr->Tl)[index-1];
439 for (i=0;i<till;i++)
440 {
441 if (Pairs[i].syz!=NULL)
442 pResetSetm(Pairs[i].syz);
443 }
444 till=(*syzstr->Tl)[index];
445 for (i=0;i<till;i++)
446 {
447 if (Pairs1[i].p!=NULL)
448 pResetSetm(Pairs1[i].p);
449 }
450 }
451 currcomponents = prev_c;
452 currShiftedComponents = prev_s;
453 rChangeSComps(prev_c, prev_s, p_length, currRing);
454 }
455}
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
Definition ring.cc:4506
static void pResetSetm(poly p)
Definition syz1.cc:394

◆ syResolution()

syStrategy syResolution ( ideal arg,
int maxlength,
intvec * w,
BOOLEAN minim )

Definition at line 626 of file syz.cc.

627{
628
629#ifdef HAVE_PLURAL
630 const ideal idSaveCurrRingQuotient = currRing->qideal;
631 if( rIsSCA(currRing) )
632 {
634 {
635 currRing->qideal = SCAQuotient(currRing);
636 }
637 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
638 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
639 arg = id_KillSquares(idCopy(arg), m_iFirstAltVar, m_iLastAltVar, currRing, false); // kill squares in input!
640 }
641#endif
642
644
645 if ((w!=NULL) && (!idTestHomModule(arg,currRing->qideal,w))) // is this right in SCA case???
646 {
647 WarnS("wrong weights given(2):");w->show();PrintLn();
648 idHomModule(arg,currRing->qideal,&w);
649 w->show();PrintLn();
650 w=NULL;
651 }
652 if (w!=NULL)
653 {
654 result->weights = (intvec**)omAlloc0Bin(char_ptr_bin);
655 (result->weights)[0] = ivCopy(w);
656 result->length = 1;
657 }
658 resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim);
659 resolvente fr1;
660 if (minim)
661 {
662 result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
663 fr1 = result->minres;
664 }
665 else
666 {
667 result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
668 fr1 = result->fullres;
669 }
670 for (int i=result->length-1;i>=0;i--)
671 {
672 if (fr[i]!=NULL)
673 fr1[i] = fr[i];
674 fr[i] = NULL;
675 }
676 omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
677
678#ifdef HAVE_PLURAL
679 if( rIsSCA(currRing) )
680 {
682 {
683 currRing->qideal = idSaveCurrRingQuotient;
684 }
685 id_Delete(&arg, currRing);
686 }
687#endif
688
689 return result;
690}
static bool rIsSCA(const ring r)
Definition nc.h:190
bool ncExtensions(int iMask)
Definition old.gring.cc:94
const int TESTSYZSCAMASK
Definition nc.h:338
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition sca.cc:1518
ideal SCAQuotient(const ring r)
Definition sca.h:10
static short scaLastAltVar(ring r)
Definition sca.h:25
static short scaFirstAltVar(ring r)
Definition sca.h:18

◆ syResolvente()

resolvente syResolvente ( ideal arg,
int maxlength,
int * length,
intvec *** weights,
BOOLEAN minim )

Definition at line 401 of file syz.cc.

403{
404 BITSET save1;
405 SI_SAVE_OPT1(save1);
406 resolvente newres;
407 tHomog hom=isNotHomog;
408 intvec *w = NULL,**tempW;
409 int i,k,syzIndex = 0,j,rk_arg=si_max(1,(int)id_RankFreeModule(arg,currRing));
410 int Kstd1_OldDeg=Kstd1_deg;
411 BOOLEAN completeMinim;
412 BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
413 BOOLEAN setRegularity=TRUE;
414 int wlength=*length;
415
416 if (maxlength!=-1) *length = maxlength+1;
417 else *length = 5;
418 if ((wlength!=0) && (*length!=wlength))
419 {
420 intvec **wtmp = (intvec**)omAlloc0((*length)*sizeof(intvec*));
421 wtmp[0]=(*weights)[0];
422 omFreeSize((ADDRESS)*weights,wlength*sizeof(intvec*));
423 *weights=wtmp;
424 }
425 resolvente res = (resolvente)omAlloc0((*length)*sizeof(ideal));
426
427/*--- initialize the syzygy-ring -----------------------------*/
428 ring origR = currRing;
429 ring syz_ring = rAssure_SyzComp(origR, TRUE); // will do rChangeCurrRing if needed
430 rSetSyzComp(rk_arg, syz_ring);
431
432 if (syz_ring != origR)
433 {
434 rChangeCurrRing(syz_ring);
435 res[0] = idrCopyR_NoSort(arg, origR, syz_ring);
436 }
437 else
438 {
439 res[0] = idCopy(arg);
440 }
441
442/*--- creating weights for the module components ---------------*/
443 if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
444 {
445 if (!idTestHomModule(res[0],currRing->qideal,(*weights)[0]))
446 {
447 WarnS("wrong weights given(1):"); (*weights)[0]->show();PrintLn();
448 idHomModule(res[0],currRing->qideal,&w);
449 w->show();PrintLn();
450 *weights=NULL;
451 }
452 }
453
454 if ((weights==NULL) || (*weights==NULL) || ((*weights)[0]==NULL))
455 {
456 hom=(tHomog)idHomModule(res[0],currRing->qideal,&w);
457 if (hom==isHomog)
458 {
459 *weights = (intvec**)omAlloc0((*length)*sizeof(intvec*));
460 if (w!=NULL) (*weights)[0] = ivCopy(w);
461 }
462 }
463 else
464 {
465 if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
466 {
467 w = ivCopy((*weights)[0]);
468 hom = isHomog;
469 }
470 }
471
472#ifdef HAVE_PLURAL
474 {
475// quick solution; need theory to apply homog GB stuff for G-Algebras
476 hom = isNotHomog;
477 }
478#endif // HAVE_PLURAL
479
480 if (hom==isHomog)
481 {
482 intvec *w1 = syPrepareModComp(res[0],&w);
483 if (w!=NULL) { delete w;w=NULL; }
484 w = w1;
485 j = 0;
486 while ((j<IDELEMS(res[0])) && (res[0]->m[j]==NULL)) j++;
487 if (j<IDELEMS(res[0]))
488 {
489 if (p_FDeg(res[0]->m[j],currRing)!=pTotaldegree(res[0]->m[j]))
490 setRegularity = FALSE;
491 }
492 }
493 else
494 {
495 setRegularity = FALSE;
496 }
497
498/*--- the main loop --------------------------------------*/
499 while ((res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])) &&
500 ((maxlength==-1) || (syzIndex<=maxlength)))
501 // (syzIndex<maxlength+(int)minim)))
502/*--- compute one step more for minimizing-----------------*/
503 {
504 if (Kstd1_deg!=0) Kstd1_deg++;
505 if (syzIndex+1==*length)
506 {
507 newres = (resolvente)omAlloc0((*length+5)*sizeof(ideal));
508 tempW = (intvec**)omAlloc0((*length+5)*sizeof(intvec*));
509 for (j=0;j<*length;j++)
510 {
511 newres[j] = res[j];
512 if (*weights!=NULL) tempW[j] = (*weights)[j];
513 /*else tempW[j] = NULL;*/
514 }
515 omFreeSize((ADDRESS)res,*length*sizeof(ideal));
516 if (*weights != NULL) omFreeSize((ADDRESS)*weights,*length*sizeof(intvec*));
517 *length += 5;
518 res=newres;
519 *weights = tempW;
520 }
521/*--- interreducing first -----------------------------------*/
522 if (syzIndex>0)
523 {
524 int rkI=id_RankFreeModule(res[syzIndex],currRing);
525 rSetSyzComp(rkI, currRing);
526 }
528 if (minim || (syzIndex!=0))
529 {
530 ideal temp = kInterRedOld(res[syzIndex],currRing->qideal);
531 idDelete(&res[syzIndex]);
532 idSkipZeroes(temp);
533 res[syzIndex] = temp;
534 }
535/*--- computing the syzygy modules --------------------------------*/
536 if ((currRing->qideal==NULL)&&(syzIndex==0)&& (!TEST_OPT_DEGBOUND))
537 {
538 res[/*syzIndex+*/1] = idSyzygies(res[0/*syzIndex*/],hom,&w,FALSE,setRegularity,&Kstd1_deg);
542 }
543 else
544 {
545 res[syzIndex+1] = idSyzygies(res[syzIndex],hom,&w,FALSE);
546 }
547 completeMinim=(syzIndex!=maxlength) || (maxlength ==-1) || (hom!=isHomog);
548 syzIndex++;
549 if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
550
552 {
553 if ((minim)||(syzIndex>1))
554 syMinStep(res[syzIndex-1],res[syzIndex],!completeMinim,NULL,hom);
555 if (!completeMinim)
556 /*minim is TRUE, we are in the module: maxlength, maxlength <>0*/
557 {
558 idDelete(&res[syzIndex]);
559 }
560 }
561/*---creating the iterated weights for module components ---------*/
562 if ((hom == isHomog) && (res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])))
563 {
564//Print("die %d Modulegewichte sind:\n",w1->length());
565//w1->show();
566//PrintLn();
567 int max_comp = id_RankFreeModule(res[syzIndex],currRing);
568 k = max_comp - rGetCurrSyzLimit(currRing);
569 assume(w != NULL);
570 if (w != NULL)
571 w->resize(max_comp+IDELEMS(res[syzIndex]));
572 else
573 w = new intvec(max_comp+IDELEMS(res[syzIndex]));
574 (*weights)[syzIndex] = new intvec(k);
575 for (i=0;i<k;i++)
576 {
577 if (res[syzIndex-1]->m[i]!=NULL) // hs
578 {
579 (*w)[i + rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex-1]->m[i],currRing);
580 if (pGetComp(res[syzIndex-1]->m[i])>0)
582 += (*w)[pGetComp(res[syzIndex-1]->m[i])-1];
583 (*((*weights)[syzIndex]))[i] = (*w)[i+rGetCurrSyzLimit(currRing)];
584 }
585 }
586 for (i=k;i<k+IDELEMS(res[syzIndex]);i++)
587 {
588 if (res[syzIndex]->m[i-k]!=NULL)
589 (*w)[i+rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex]->m[i-k],currRing)
590 +(*w)[pGetComp(res[syzIndex]->m[i-k])-1];
591 }
592 }
593 }
594/*--- end of the main loop --------------------------------------*/
595/*--- deleting the temporare data structures --------------------*/
596 if ((syzIndex!=0) && (res[syzIndex]!=NULL) && (idIs0(res[syzIndex])))
597 idDelete(&res[syzIndex]);
598 if (w !=NULL) delete w;
599
600 Kstd1_deg=Kstd1_OldDeg;
601 if (!oldDegBound)
603
604 for (i=1; i<=syzIndex; i++)
605 {
606 if ((res[i]!=NULL) && ! idIs0(res[i]))
607 {
609 res[i]->rank=idElem(res[i-1]);
610 }
611 }
612/*--- going back to the original ring -------------------------*/
613 if (origR != syz_ring)
614 {
615 rChangeCurrRing(origR); // should not be needed now?
616 for (i=0; i<=syzIndex; i++)
617 {
618 res[i] = idrMoveR_NoSort(res[i], syz_ring, origR);
619 }
620 rDelete(syz_ring);
621 }
622 SI_RESTORE_OPT1(save1);
623 return res;
624}
#define BITSET
Definition auxiliary.h:85
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition ideals.cc:836
ideal kInterRedOld(ideal F, const ideal Q)
Definition kstd1.cc:3451
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
VAR unsigned si_opt_1
Definition options.c:5
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24
#define Sy_bit(x)
Definition options.h:31
#define TEST_OPT_DEGBOUND
Definition options.h:115
#define TEST_OPT_NOTREGULARITY
Definition options.h:122
#define OPT_DEGBOUND
Definition options.h:91
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition prCopy.cc:205
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition ring.cc:4527
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
Definition ring.cc:5302
void rSetSyzComp(int k, const ring r)
Definition ring.cc:5230
static int rGetCurrSyzLimit(const ring r)
Definition ring.h:729
#define rField_is_Ring(R)
Definition ring.h:491
tHomog
Definition structs.h:31
@ isNotHomog
Definition structs.h:32
static intvec * syPrepareModComp(ideal arg, intvec **w)
Definition syz.cc:25

◆ sySchreyer()

syStrategy sySchreyer ( ideal arg,
int maxlength )

Definition at line 1018 of file syz0.cc.

1019{
1020 int rl;
1021 resolvente fr = sySchreyerResolvente(arg,maxlength,&(rl));
1022 if (fr==NULL) return NULL;
1023
1024 // int typ0;
1026 result->length=rl;
1027 result->fullres = (resolvente)omAlloc0((rl /*result->length*/+1)*sizeof(ideal));
1028 for (int i=rl /*result->length*/-1;i>=0;i--)
1029 {
1030 if (fr[i]!=NULL)
1031 {
1032 idSkipZeroes(fr[i]);
1033 result->fullres[i] = fr[i];
1034 fr[i] = NULL;
1035 }
1036 }
1037 if (currRing->qideal!=NULL)
1038 {
1039 for (int i=0; i<rl; i++)
1040 {
1041 if (result->fullres[i]!=NULL)
1042 {
1043 ideal t=kNF(currRing->qideal,NULL,result->fullres[i]);
1044 idDelete(&result->fullres[i]);
1045 result->fullres[i]=t;
1046 if (i<rl-1)
1047 {
1048 for(int j=IDELEMS(t)-1;j>=0; j--)
1049 {
1050 if ((t->m[j]==NULL) && (result->fullres[i+1]!=NULL))
1051 {
1052 for(int k=IDELEMS(result->fullres[i+1])-1;k>=0; k--)
1053 {
1054 if (result->fullres[i+1]->m[k]!=NULL)
1055 {
1056 pDeleteComp(&(result->fullres[i+1]->m[k]),j+1);
1057 }
1058 }
1059 }
1060 }
1061 }
1062 idSkipZeroes(result->fullres[i]);
1063 }
1064 }
1065 if ((rl>maxlength) && (result->fullres[rl-1]!=NULL))
1066 {
1067 idDelete(&result->fullres[rl-1]);
1068 }
1069 }
1070 omFreeSize((ADDRESS)fr,(rl /*result->length*/)*sizeof(ideal));
1071 return result;
1072}
#define pDeleteComp(p, k)
Definition polys.h:361
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial, BOOLEAN)
Definition syz0.cc:855

◆ sySchreyerResolvente()

resolvente sySchreyerResolvente ( ideal arg,
int maxlength,
int * length,
BOOLEAN isMonomial = FALSE,
BOOLEAN notReplace = FALSE )

Definition at line 855 of file syz0.cc.

857{
858 ideal mW=NULL;
859 int i,syzIndex = 0,j=0;
860 intvec * modcomp=NULL,*w=NULL;
861 // int ** wv=NULL;
862 tHomog hom=(tHomog)idHomModule(arg,NULL,&w);
863 ring origR = currRing;
864 ring syRing = NULL;
865
866 if ((!isMonomial) && syTestOrder(arg))
867 {
868 WerrorS("sres only implemented for modules with ordering ..,c or ..,C");
869 return NULL;
870 }
871 *length = 4;
872 resolvente res = (resolvente)omAlloc0(4*sizeof(ideal)),newres;
873 res[0] = idCopy(arg);
874
875 while ((!idIs0(res[syzIndex])) && ((maxlength==-1) || (syzIndex<maxlength)))
876 {
877 i = IDELEMS(res[syzIndex]);
878 //while ((i!=0) && (!res[syzIndex]->m[i-1])) i--;
879 if (syzIndex+1==*length)
880 {
881 newres = (resolvente)omAlloc0((*length+4)*sizeof(ideal));
882 // for (j=0;j<*length+4;j++) newres[j] = NULL;
883 for (j=0;j<*length;j++) newres[j] = res[j];
884 omFreeSize((ADDRESS)res,*length*sizeof(ideal));
885 *length += 4;
886 res=newres;
887 }
888
889 if ((hom==isHomog)|| (rHasGlobalOrdering(origR)))
890 {
891 if (syzIndex==0) syInitSort(res[0],&modcomp);
892
893 if ((syzIndex==0) && !rRing_has_CompLastBlock(currRing))
894 res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW,FALSE);
895 else
896 res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW);
897
898 if (errorreported)
899 {
900 for (j=0;j<*length;j++) idDelete( &res[j] );
901 omFreeSize((ADDRESS)res,*length*sizeof(ideal));
902 return NULL;
903 }
904
905 mW = res[syzIndex];
906 }
907//idPrint(res[syzIndex+1]);
908
909 if ( /*(*/ syzIndex==0 /*)*/ )
910 {
911 if ((hom==isHomog)|| (rHasGlobalOrdering(origR)))
912 {
913 syRing = rAssure_CompLastBlock(origR, TRUE);
914 if (syRing != origR)
915 {
916 rChangeCurrRing(syRing);
917 for (i=0; i<IDELEMS(res[1]); i++)
918 {
919 res[1]->m[i] = prMoveR( res[1]->m[i], origR, syRing);
920 }
921 }
922 idTest(res[1]);
923 }
924 else
925 {
926 syRing = rAssure_SyzComp_CompLastBlock(origR);
927 if (syRing != origR)
928 {
929 rChangeCurrRing(syRing);
930 for (i=0; i<IDELEMS(res[0]); i++)
931 {
932 res[0]->m[i] = prMoveR( res[0]->m[i], origR, syRing);
933 }
934 }
935 idTest(res[0]);
936 }
937 }
938 if ((hom!=isHomog) && (rHasLocalOrMixedOrdering(origR)))
939 {
940 if (syzIndex==0) syInitSort(res[0],&modcomp);
941 res[syzIndex+1] = sySchreyersSyzygiesFM(res[syzIndex],&modcomp);
942 if (errorreported)
943 {
944 for (j=0;j<*length;j++) idDelete( &res[j] );
945 omFreeSize((ADDRESS)res,*length*sizeof(ideal));
946 return NULL;
947 }
948 }
949 syzIndex++;
950 if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
951 }
952 //syPrintResolution(res,1,*length);
953 if ((hom!=isHomog) && (rHasLocalOrMixedOrdering(origR)))
954 {
955 syzIndex = 1;
956 while ((syzIndex < *length) && (!idIs0(res[syzIndex])))
957 {
958 id_Shift(res[syzIndex],-rGetMaxSyzComp(syzIndex, currRing),currRing);
959 syzIndex++;
960 }
961 }
962 if ((hom==isHomog) || (rHasGlobalOrdering(origR)))
963 syzIndex = 1;
964 else
965 syzIndex = 0;
966 syReOrderResolventFB(res,*length,syzIndex+1);
967 if (/*ringOrderChanged:*/ origR!=syRing && syRing != NULL)
968 {
969 rChangeCurrRing(origR);
970 // Thomas: Here I assume that all (!) polys of res live in tmpR
971 while ((syzIndex < *length) && (res[syzIndex]))
972 {
973 for (i=0;i<IDELEMS(res[syzIndex]);i++)
974 {
975 if (res[syzIndex]->m[i])
976 {
977 res[syzIndex]->m[i] = prMoveR( res[syzIndex]->m[i], syRing, origR);
978 }
979 }
980 syzIndex++;
981 }
982// j = 0; while (currRing->order[j]!=0) j++; // What was this for???!
983 rDelete(syRing);
984 }
985 else
986 {
987 // Thomas -- are you sure that you have to "reorder" here?
988 while ((syzIndex < *length) && (res[syzIndex]))
989 {
990 for (i=0;i<IDELEMS(res[syzIndex]);i++)
991 {
992 if (res[syzIndex]->m[i])
993 res[syzIndex]->m[i] = pSortCompCorrect(res[syzIndex]->m[i]);
994 }
995 syzIndex++;
996 }
997 }
998 if ((hom==isHomog) || (rHasGlobalOrdering(origR)))
999 {
1000 if (res[1]!=NULL)
1001 {
1003 for (i=0;i<IDELEMS(res[1]);i++)
1004 {
1005 if (res[1]->m[i])
1006 res[1]->m[i] = pSort(res[1]->m[i]);
1007 }
1008 }
1009 }
1010 //syPrintResolution(res,0,*length);
1011
1012 //syMergeSortResolventFB(res,*length);
1013 if (modcomp!=NULL) delete modcomp;
1014 if (w!=NULL) delete w;
1015 return res;
1016}
VAR short errorreported
Definition feFopen.cc:23
#define pSort(p)
Definition polys.h:219
BOOLEAN rRing_has_CompLastBlock(const ring r)
Definition ring.cc:5329
ring rAssure_SyzComp_CompLastBlock(const ring r)
makes sure that c/C ordering is last ordering and SyzIndex is first
Definition ring.cc:4841
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
Definition ring.cc:4786
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
static BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:768
static ideal sySchreyersSyzygiesFB(ideal arg, intvec **modcomp, ideal mW, BOOLEAN redTail=TRUE)
Definition syz0.cc:499
static void syInitSort(ideal arg, intvec **modcomp)
Definition syz0.cc:23
static ideal sySchreyersSyzygiesFM(ideal arg, intvec **modcomp)
Definition syz0.cc:162
void syReOrderResolventFB(resolvente res, int length, int initial)
Definition syz0.cc:740
BOOLEAN syTestOrder(ideal M)
Definition syz0.cc:829

◆ sySchreyersSyzygiesB()

void sySchreyersSyzygiesB ( polyset F,
int Fmax,
polyset * Shdl,
int * Smax,
BOOLEAN noSort )

◆ sySchreyersSyzygiesM()

void sySchreyersSyzygiesM ( polyset F,
int Fmax,
polyset * Shdl,
int * Smax,
BOOLEAN noSort )

◆ sySize()

int sySize ( syStrategy syzstr)

Definition at line 1830 of file syz1.cc.

1831{
1832 resolvente r=syzstr->res;
1833 if (r==NULL)
1834 r = syzstr->fullres;
1835 if (r==NULL)
1836 r = syzstr->minres;
1837 if (r==NULL)
1838 {
1839 WerrorS("No resolution found");
1840 return 0;
1841 }
1842 int i=syzstr->length;
1843 while ((i>0) && (r[i-1]==NULL)) i--;
1844 return i;
1845}

◆ syTestOrder()

BOOLEAN syTestOrder ( ideal i)

Definition at line 829 of file syz0.cc.

830{
832 if (i == 0) return FALSE;
833 int j=0;
834
835 while ((currRing->order[j]!=ringorder_c) && (currRing->order[j]!=ringorder_C))
836 j++;
837 if (currRing->order[j+1]!=0)
838 return TRUE;
839 return FALSE;
840}
@ ringorder_C
Definition ring.h:74
@ ringorder_c
Definition ring.h:73
#define M
Definition sirandom.c:25

Variable Documentation

◆ currcomponents

EXTERN_VAR int* currcomponents

Definition at line 117 of file syz.h.

◆ currShiftedComponents

EXTERN_VAR long* currShiftedComponents

Definition at line 118 of file syz.h.