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)
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)
void syFix (syStrategy r)

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 787 of file syz.cc.

789{
790//#define BETTI_WITH_ZEROS
791 //tomin = FALSE;
792 int i,j=0,k=0,l,rows,cols,mr;
793 int *temp1,*temp2,*temp3;/*used to compute degrees*/
794 int *tocancel; /*(BOOLEAN)tocancel[i]=element is superfluous*/
795 int r0_len;
796
797 /*------ compute size --------------*/
798 *regularity = -1;
799 cols = length;
800 while ((cols>0)
801 && ((res[cols-1]==NULL)
802 || (idIs0(res[cols-1]))))
803 {
804 cols--;
805 }
806 intvec * result;
807 if (idIs0(res[0]))
808 {
809 if (res[0]==NULL)
810 result = new intvec(1,1,1);
811 else
812 result = new intvec(1,1,res[0]->rank);
813 return result;
814 }
815 intvec *w=NULL;
816 if (weights!=NULL)
817 {
818 if (!idTestHomModule(res[0],currRing->qideal,weights))
819 {
820 WarnS("wrong weights given(3):");weights->show();PrintLn();
821 idHomModule(res[0],currRing->qideal,&w);
822 if (w!=NULL) { w->show();PrintLn();}
823 weights=NULL;
824 }
825 }
826#if 0
827 if (idHomModule(res[0],currRing->qideal,&w)!=isHomog)
828 {
829 WarnS("betti-command: Input is not homogeneous!");
830 weights=NULL;
831 }
832#endif
833 if (weights==NULL) weights=w;
834 else delete w;
835 r0_len=IDELEMS(res[0]);
836 while ((r0_len>0) && (res[0]->m[r0_len-1]==NULL)) r0_len--;
837 #ifdef SHOW_W
838 PrintS("weights:");if (weights!=NULL) weights->show(); else Print("NULL"); PrintLn();
839 #endif
840 int rkl=l = si_max(id_RankFreeModule(res[0],currRing),res[0]->rank);
841 i = 0;
842 while ((i<length) && (res[i]!=NULL))
843 {
844 if (IDELEMS(res[i])>l) l = IDELEMS(res[i]);
845 i++;
846 }
847 temp1 = (int*)omAlloc0((l+1)*sizeof(int));
848 temp2 = (int*)omAlloc((l+1)*sizeof(int));
849 rows = 1;
850 mr = 1;
851 cols++;
852 for (i=0;i<cols-1;i++)
853 {
854 if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
855 memset(temp2,0,(l+1)*sizeof(int));
856 for (j=0;j<IDELEMS(res[i]);j++)
857 {
858 if (res[i]->m[j]!=NULL)
859 {
860 if ((pGetComp(res[i]->m[j])>l)
861 // usual resolutions do not the following, but artifulal built may: (tr. #763)
862 //|| ((i>1) && (res[i-1]->m[pGetComp(res[i]->m[j])-1]==NULL))
863 )
864 {
865 WerrorS("input not a resolution");
866 omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
867 omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
868 return NULL;
869 }
870 temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
871 if (temp2[j+1]-i>rows) rows = temp2[j+1]-i;
872 if (temp2[j+1]-i<mr) mr = temp2[j+1]-i;
873 }
874 }
875 if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
876 temp3 = temp1;
877 temp1 = temp2;
878 temp2 = temp3;
879 }
880 mr--;
881 if (weights!=NULL)
882 {
883 for(j=0;j<weights->length();j++)
884 {
885 if (rows <(*weights)[j]+1) rows=(-mr)+(*weights)[j]+1;
886 }
887 }
888 /*------ computation betti numbers --------------*/
889 rows -= mr;
890 result = new intvec(rows+1,cols,0);
891 if (weights!=NULL)
892 {
893 for(j=0;j<weights->length();j++)
894 {
895 IMATELEM((*result),(-mr)+(*weights)[j]+1,1) ++;
896 //Print("imat(%d,%d)++ -> %d\n",(-mr)+(*weights)[j]+1, 1, IMATELEM((*result),(-mr)+(*weights)[j]+1,1));
897 }
898 }
899 else
900 {
901 (*result)[(-mr)*cols] = /*idRankFreeModule(res[0])*/ rkl;
902 if ((!idIs0(res[0])) && ((*result)[(-mr)*cols]==0))
903 (*result)[(-mr)*cols] = 1;
904 }
905 tocancel = (int*)omAlloc0((rows+1)*sizeof(int));
906 memset(temp1,0,(l+1)*sizeof(int));
907 if (weights!=NULL)
908 {
909 memset(temp2,0,l*sizeof(int));
910 p_SetModDeg(weights, currRing);
911 }
912 else
913 memset(temp2,0,l*sizeof(int));
914 syDetect(res[0],0,TRUE,temp2,tocancel);
915 if (weights!=NULL) p_SetModDeg(NULL, currRing);
916 if (tomin)
917 {
918 //(*result)[(-mr)*cols] -= dummy;
919 for(j=0;j<=rows+mr;j++)
920 {
921 //Print("tocancel[%d]=%d imat(%d,%d)=%d\n",j,tocancel[j],(-mr)+j+1,1,IMATELEM((*result),(-mr)+j+1,1));
922 IMATELEM((*result),(-mr)+j+1,1) -= tocancel[j];
923 }
924 }
925 for (i=0;i<cols-1;i++)
926 {
927 if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
928 memset(temp2,0,l*sizeof(int));
929 for (j=0;j<IDELEMS(res[i]);j++)
930 {
931 if (res[i]->m[j]!=NULL)
932 {
933 temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
934 //(*result)[i+1+(temp2[j+1]-i-1)*cols]++;
935 //if (temp2[j+1]>i) IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
936 IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
937 }
938 else if (i==0)
939 {
940 if (j<r0_len) IMATELEM((*result),-mr,2)++;
941 }
942 }
943 /*------ computation betti numbers, if res not minimal --------------*/
944 if (tomin)
945 {
946 for (j=mr;j<rows+mr;j++)
947 {
948 //(*result)[i+1+j*cols] -= tocancel[j+1];
949 IMATELEM((*result),j+1-mr,i+2) -= tocancel[j+1];
950 }
951 if ((i<length-1) && (res[i+1]!=NULL))
952 {
953 memset(tocancel,0,(rows+1)*sizeof(int));
954 syDetect(res[i+1],i+1,TRUE,temp2,tocancel);
955 for (j=0;j<rows;j++)
956 {
957 //(*result)[i+1+j*cols] -= tocancel[j];
958 IMATELEM((*result),j+1,i+2) -= tocancel[j];
959 }
960 }
961 }
962 temp3 = temp1;
963 temp1 = temp2;
964 temp2 = temp3;
965 for (j=0;j<=rows;j++)
966 {
967 // if (((*result)[i+1+j*cols]!=0) && (j>*regularity)) *regularity = j;
968 if ((IMATELEM((*result),j+1,i+2)!=0) && (j>*regularity)) *regularity = j;
969 }
970 if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
971 }
972 // Print("nach minim:\n"); result->show(); PrintLn();
973 /*------ clean up --------------*/
974 omFreeSize((ADDRESS)tocancel,(rows+1)*sizeof(int));
975 omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
976 omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
977 if ((tomin) && (mr<0)) // deletes the first (zero) line
978 {
979 for (j=1;j<=rows+mr+1;j++)
980 {
981 for (k=1;k<=cols;k++)
982 {
983 IMATELEM((*result),j,k) = IMATELEM((*result),j-mr,k);
984 }
985 }
986 for (j=rows+mr+1;j<=rows+1;j++)
987 {
988 for (k=1;k<=cols;k++)
989 {
990 IMATELEM((*result),j,k) = 0;
991 }
992 }
993 }
994 j = 0;
995 k = 0;
996 for (i=1;i<=result->rows();i++)
997 {
998 for(l=1;l<=result->cols();l++)
999 if (IMATELEM((*result),i,l) != 0)
1000 {
1001 j = si_max(j, i-1);
1002 k = si_max(k, l-1);
1003 }
1004 }
1005 intvec * exactresult=new intvec(j+1,k+1,0);
1006 for (i=0;i<exactresult->rows();i++)
1007 {
1008 for (j=0;j<exactresult->cols();j++)
1009 {
1010 IMATELEM(*exactresult,i+1,j+1) = IMATELEM(*result,i+1,j+1);
1011 }
1012 }
1013 if (row_shift!=NULL) *row_shift = mr;
1014 delete result;
1015 return exactresult;
1016}
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:2125
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:3798
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:288
void PrintLn()
Definition reporter.cc:314
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:718

◆ syBettiOfComputation()

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

Don't change the syzstr???

Definition at line 1757 of file syz1.cc.

1759{
1760 int dummy;
1761 BOOLEAN std_weights=TRUE;
1762 if ((weights!=NULL)
1763 && (syzstr->betti!=NULL)
1764 && (syzstr->weights!=NULL) && (syzstr->weights[0]!=NULL))
1765 {
1766 int i;
1767 for(i=weights->length()-1; i>=0; i--)
1768 {
1769 //Print("test %d: %d - %d\n",i,(*weights)[i], (*(syzstr->weights[0]))[i]);
1770 if ((*weights)[i]!=(*(syzstr->weights[0]))[i])
1771 {
1772 std_weights=FALSE;
1773 break;
1774 }
1775 }
1776 }
1777 if ((syzstr->betti!=NULL)
1778 && (std_weights))
1779 {
1780 if (minim || (syzstr->resPairs!=NULL))
1781 return ivCopy(syzstr->betti);
1782 }
1783
1784 resolvente fullres = syzstr->fullres;
1785 resolvente minres = syzstr->minres;
1786 const int length = syzstr->length;
1787
1788 if ((fullres==NULL) && (minres==NULL))
1789 {
1790 if (syzstr->hilb_coeffs==NULL)
1791 { // LA SCALA
1792 fullres = syReorder(syzstr->res, length, syzstr);
1793 }
1794 else
1795 { // HRES
1796 minres = syReorder(syzstr->orderedRes, length, syzstr);
1797 syKillEmptyEntres(minres, length);
1798 }
1799 }
1800
1802
1803 if (fullres!=NULL)
1804 result = syBetti(fullres,length,&dummy,weights,minim,row_shift);
1805 else
1806 result = syBetti(minres,length,&dummy,weights,minim,row_shift);
1807
1808
1809 return result; /// Don't change the syzstr???
1810
1811 // TODO: cleanup these!
1812 if( fullres != NULL && syzstr->fullres == NULL )
1813 syzstr->fullres = fullres;
1814 if( minres != NULL && syzstr->minres == NULL )
1815 syzstr->minres = minres;
1816
1817 if ((result!=NULL)
1818 && ((minim) || (syzstr->resPairs!=NULL))
1819 && std_weights
1820 && (syzstr->betti==NULL))
1821 {
1822 syzstr->betti = ivCopy(result); // cache the result...
1823 }
1824
1825 return result;
1826}
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:1642
void syKillEmptyEntres(resolvente res, int length)
Definition syz1.cc:2200
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition syz.cc:787
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 1289 of file syz1.cc.

1290{
1291 return syChosePairsPutIn(syzstr,index,howmuch,actdeg,0,syzstr->length);
1292}
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:1182

◆ 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 1886 of file syz1.cc.

1887{
1888 syStrategy result=syzstr;
1889 (result->references)++;
1890 return result;
1891}
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 1851 of file syz1.cc.

1852{
1853 int i,l;
1854 if (syzstr->resPairs!=NULL)
1855 {
1856 SRes rP=syzstr->resPairs;
1857
1858 l = syzstr->length;
1859 while ((l>0) && (rP[l-1]==NULL)) l--;
1860 if (l==0) return -1;
1861 l--;
1862 while (l>=0)
1863 {
1864 i = 0;
1865 while ((i<(*syzstr->Tl)[l]) &&
1866 ((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
1867 (rP[l][i].isNotMinimal!=NULL))
1868 {
1869 i++;
1870 }
1871 if ((i<(*syzstr->Tl)[l]) &&
1872 ((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
1873 (rP[l][i].isNotMinimal==NULL))
1874 return l;
1875 l--;
1876 }
1877 return l;
1878 }
1879 else
1880 return sySize(syzstr);
1881}
int sySize(syStrategy syzstr)
Definition syz1.cc:1831
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:3821
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 ll=0; /*avoid compiler warning*/
1019 break;
1020 }
1021 }
1022 i=(an+en) / 2;
1023 if (sPairs[i].order <= no)
1024 an=i;
1025 else
1026 en=i;
1027 }
1028 }
1029 for (k=(*sPlength);k>ll;k--)
1030 {
1031 syCopyPair(&sPairs[k-1],&sPairs[k]);
1032 }
1033 syCopyPair(so,&sPairs[ll]);
1034 (*sPlength)++;
1035}
#define loop
Definition structs.h:71

◆ syEnterPair() [2/2]

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

Definition at line 1036 of file syz1.cc.

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

◆ syFix()

void syFix ( syStrategy r)

Definition at line 1230 of file syz.cc.

1231{
1232 if (r->fullres==NULL)
1233 {
1234 if(r->minres==NULL)
1235 {
1236 return;
1237 }
1238 }
1239 int found=-1;
1240 for(int i=1;i<r->length;i++)
1241 {
1242 // search (0)
1243 if((r->fullres!=NULL) && (r->fullres[i]!=NULL))
1244 {
1245 if (idIs0(r->fullres[i])) {found=i;break;}
1246 }
1247 if((r->fullres!=NULL) && (r->fullres[i]==NULL))
1248 break;
1249 if((r->minres!=NULL) && (r->minres[i]!=NULL))
1250 {
1251 if (idIs0(r->minres[i])) {found=i;break;}
1252 }
1253 if((r->minres!=NULL) && (r->minres[i]==NULL))
1254 break;
1255 }
1256 if (found>0) // delete trailing stuff
1257 {
1258 for(int i=found+1;i<r->length;i++)
1259 {
1260 if ((r->fullres!=NULL) && (r->fullres[i]!=NULL))
1262 if ((r->minres!=NULL) && (r->minres[i]!=NULL))
1263 id_Delete(&r->minres[i],currRing);
1264 }
1265 r->list_length=found;
1266 }
1267 else
1268 {
1269 // append (0)
1270 for(int i=1;i<r->length;i++)
1271 {
1272 if ((r->fullres!=NULL) && (r->fullres[i]==NULL))
1273 {
1274 r->fullres[i]=idInit(1,IDELEMS(r->fullres[i-1]));
1275 if ((r->minres!=NULL) && (r->minres[i-1]==NULL))
1276 {
1277 r->minres[i]=idInit(1,IDELEMS(r->minres[i-1]));
1278 }
1279 break;
1280 }
1281 else
1282 {
1283 if ((r->minres!=NULL) && (r->minres[i]==NULL))
1284 {
1285 r->minres[i]=idInit(1,IDELEMS(r->minres[i-1]));
1286 break;
1287 }
1288 }
1289 }
1290 }
1291}
bool found
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
short list_length
Definition syz.h:62

◆ 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:2893
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:559

◆ 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
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:1289
int syInitSyzMod(syStrategy syzstr, int index, int init=17)
Definition syz1.cc:1460

◆ 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 1460 of file syz1.cc.

1461{
1462 int result;
1463
1464 if (syzstr->res[index]==NULL)
1465 {
1466 syzstr->res[index] = idInit(init-1,1);
1467 syzstr->truecomponents[index] = (int*)omAlloc0(init*sizeof(int));
1468 syzstr->ShiftedComponents[index] = (long*)omAlloc0(init*sizeof(long));
1469 if (index==0)
1470 {
1471 for (int i=0;i<init;i++)
1472 {
1473 syzstr->truecomponents[0][i] = i;
1474 syzstr->ShiftedComponents[0][i] = (i)*SYZ_SHIFT_BASE;
1475 }
1476 }
1477 syzstr->backcomponents[index] = (int*)omAlloc0(init*sizeof(int));
1478 syzstr->Howmuch[index] = (int*)omAlloc0(init*sizeof(int));
1479 syzstr->Firstelem[index] = (int*)omAlloc0(init*sizeof(int));
1480 syzstr->elemLength[index] = (int*)omAlloc0(init*sizeof(int));
1481 syzstr->orderedRes[index] = idInit(init-1,1);
1482 syzstr->sev[index] = (unsigned long*) omAlloc0(init*sizeof(unsigned long));
1483 result = 0;
1484 }
1485 else
1486 {
1487 result = IDELEMS(syzstr->res[index]);
1488 while ((result>0) && (syzstr->res[index]->m[result-1]==NULL)) result--;
1489 }
1490 return result;
1491}
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 1496 of file syz1.cc.

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

◆ syKillEmptyEntres()

void syKillEmptyEntres ( resolvente res,
int length )

Definition at line 2200 of file syz1.cc.

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

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

◆ syLaScala1()

resolvente syLaScala1 ( ideal arg,
int * length )

◆ syLaScala3()

syStrategy syLaScala3 ( ideal arg,
int * length )

Definition at line 2433 of file syz1.cc.

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

◆ syMinBase()

ideal syMinBase ( ideal arg)

Definition at line 1021 of file syz.cc.

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

◆ syMinimize()

syStrategy syMinimize ( syStrategy syzstr)

Definition at line 2394 of file syz1.cc.

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

1190{
1191 ideal *r=res->minres;
1192 if (r==NULL) r=res->fullres;
1193 ideal org=idCopy(r[0]);
1195 r=res->minres;
1196 if (r==NULL) r=res->fullres;
1197 trans=idLift(org,r[0],NULL,TRUE,FALSE,FALSE,NULL);
1198}
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:1109
syStrategy syMinimize(syStrategy syzstr)
Definition syz1.cc:2394

◆ syMinimizeCopy()

syStrategy syMinimizeCopy ( syStrategy org)

Definition at line 1200 of file syz.cc.

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

◆ 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 if((length>0) && (res[length]!=NULL) && idIs0(res[length]))
390}
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition ideals.cc:2858
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 1180 of file syz.cc.

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

◆ syPrint()

void syPrint ( syStrategy syzstr,
const char * currRingName )

Definition at line 1936 of file syz1.cc.

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

◆ syReorder()

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

Definition at line 1642 of file syz1.cc.

1644{
1645 int i,j,l;
1646 polyset ri1;
1647 resolvente fullres;
1648 ring origR=syzstr->syRing;
1649 fullres = (resolvente)omAlloc0((length+1)*sizeof(ideal));
1650 if (totake==NULL)
1651 totake = res;
1652 for (i=length-1;i>0;i--)
1653 {
1654 if (res[i]!=NULL)
1655 {
1656 if (i>1)
1657 {
1658 j = IDELEMS(res[i-1]);
1659 while ((j>0) && (res[i-1]->m[j-1]==NULL)) j--;
1660 fullres[i-1] = idInit(IDELEMS(res[i]),j);
1661 ri1 = totake[i-1]->m;
1662 for (j=IDELEMS(res[i])-1;j>=0;j--)
1663 {
1665 poly p = res[i]->m[j];
1666 while (p!=NULL)
1667 {
1668 poly tq;
1669 if (toCopy)
1670 {
1671 if (origR!=NULL)
1672 tq = prHeadR(p,origR, currRing);
1673 else
1674 tq = pHead(p);
1675 pIter(p);
1676 }
1677 else
1678 {
1679 res[i]->m[j] = NULL;
1680 if (origR!=NULL)
1681 {
1682 poly pp=p;
1683 pIter(p);
1684 pNext(pp)=NULL;
1685 tq = prMoveR(pp, origR, currRing);
1686 }
1687 else
1688 {
1689 tq = p;
1690 pIter(p);
1691 pNext(tq) = NULL;
1692 }
1693 }
1694// pWrite(tq);
1695 pTest(tq);
1696 for (l=(currRing->N);l>0;l--)
1697 {
1698 if (origR!=NULL)
1699 pSubExp(tq,l, p_GetExp(ri1[pGetComp(tq)-1],l,origR));
1700 else
1701 pSubExp(tq,l, pGetExp(ri1[pGetComp(tq)-1],l));
1702 }
1703 pSetm(tq);
1704 pTest(tq);
1705 sBucket_Add_m(bucket,tq);
1706 }
1707 int l_dummy;
1708 sBucketClearMerge(bucket, &(fullres[i-1]->m[j]), &l_dummy);
1709 sBucketDestroy(&bucket);
1710 }
1711 }
1712 else
1713 {
1714 if (origR!=NULL)
1715 {
1716 fullres[i-1] = idInit(IDELEMS(res[i]),res[i]->rank);
1717 for (j=IDELEMS(res[i])-1;j>=0;j--)
1718 {
1719 if (toCopy)
1720 fullres[i-1]->m[j] = prCopyR(res[i]->m[j], origR, currRing);
1721 else
1722 {
1723 fullres[i-1]->m[j] = prMoveR(res[i]->m[j], origR, currRing);
1724 res[i]->m[j] = NULL;
1725 }
1726 }
1727 }
1728 else
1729 {
1730 if (toCopy)
1731 fullres[i-1] = idCopy(res[i]);
1732 else
1733 {
1734 fullres[i-1] = res[i];
1735 res[i] = NULL;
1736 }
1737 }
1738 for (j=IDELEMS(fullres[i-1])-1;j>=0;j--)
1739 fullres[i-1]->m[j] = pSortCompCorrect(fullres[i-1]->m[j]);
1740 }
1741 if (!toCopy)
1742 {
1743 if (res[i]!=NULL) idDelete(&res[i]);
1744 }
1745 }
1746 }
1747 if (!toCopy)
1748 omFreeSize((ADDRESS)res,(length+1)*sizeof(ideal));
1749 //syzstr->length = length;
1750 return fullres;
1751}
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

◆ 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 625 of file syz.cc.

626{
627
628#ifdef HAVE_PLURAL
629 const ideal idSaveCurrRingQuotient = currRing->qideal;
630 if( rIsSCA(currRing) )
631 {
633 {
634 currRing->qideal = SCAQuotient(currRing);
635 }
636 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
637 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
638 arg = id_KillSquares(idCopy(arg), m_iFirstAltVar, m_iLastAltVar, currRing, false); // kill squares in input!
639 }
640#endif
641
643
644 if ((w!=NULL) && (!idTestHomModule(arg,currRing->qideal,w))) // is this right in SCA case???
645 {
646 WarnS("wrong weights given(2):");w->show();PrintLn();
647 idHomModule(arg,currRing->qideal,&w);
648 w->show();PrintLn();
649 w=NULL;
650 }
651 if (w!=NULL)
652 {
653 result->weights = (intvec**)omAlloc0Bin(char_ptr_bin);
654 (result->weights)[0] = ivCopy(w);
655 result->length = 1;
656 }
657 resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim);
658 resolvente fr1;
659 if (minim)
660 {
661 result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
662 fr1 = result->minres;
663 }
664 else
665 {
666 result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
667 fr1 = result->fullres;
668 }
669 for (int i=result->length-1;i>=0;i--)
670 {
671 if (fr[i]!=NULL)
672 fr1[i] = fr[i];
673 fr[i] = NULL;
674 }
675 for (int i=result->length-1;i>0;i--)
676 {
677 if (fr1[i]!=NULL)
678 fr1[i]->rank=IDELEMS(fr1[i-1]);
679 }
680 omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
681
682#ifdef HAVE_PLURAL
683 if( rIsSCA(currRing) )
684 {
686 {
687 currRing->qideal = idSaveCurrRingQuotient;
688 }
689 id_Delete(&arg, currRing);
690 }
691#endif
692
693 return result;
694}
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 403 of file syz.cc.

405{
406 BITSET save1;
407 SI_SAVE_OPT1(save1);
408 resolvente newres;
409 tHomog hom=isNotHomog;
410 intvec *w = NULL,**tempW;
411 int i,k,syzIndex = 0,j,rk_arg=si_max(1,(int)id_RankFreeModule(arg,currRing));
412 int Kstd1_OldDeg=Kstd1_deg;
413 BOOLEAN completeMinim;
414 BOOLEAN setRegularity=TRUE;
415 int wlength=*length;
416
417 if (maxlength!=-1) *length = maxlength+1;
418 else *length = 5;
419 if ((wlength!=0) && (*length!=wlength))
420 {
421 intvec **wtmp = (intvec**)omAlloc0((*length)*sizeof(intvec*));
422 wtmp[0]=(*weights)[0];
423 omFreeSize((ADDRESS)*weights,wlength*sizeof(intvec*));
424 *weights=wtmp;
425 }
426 resolvente res = (resolvente)omAlloc0((*length)*sizeof(ideal));
427
428/*--- initialize the syzygy-ring -----------------------------*/
429 ring origR = currRing;
430 ring syz_ring = rAssure_SyzComp(origR, TRUE); // will do rChangeCurrRing if needed
431 rSetSyzComp(rk_arg, syz_ring);
432
433 if (syz_ring != origR)
434 {
435 rChangeCurrRing(syz_ring);
436 res[0] = idrCopyR_NoSort(arg, origR, syz_ring);
437 }
438 else
439 {
440 res[0] = idCopy(arg);
441 }
442
443/*--- creating weights for the module components ---------------*/
444 if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
445 {
446 if (!idTestHomModule(res[0],currRing->qideal,(*weights)[0]))
447 {
448 WarnS("wrong weights given(1):"); (*weights)[0]->show();PrintLn();
449 idHomModule(res[0],currRing->qideal,&w);
450 w->show();PrintLn();
451 *weights=NULL;
452 }
453 }
454
455 if ((weights==NULL) || (*weights==NULL) || ((*weights)[0]==NULL))
456 {
457 hom=(tHomog)idHomModule(res[0],currRing->qideal,&w);
458 if (hom==isHomog)
459 {
460 *weights = (intvec**)omAlloc0((*length)*sizeof(intvec*));
461 if (w!=NULL) (*weights)[0] = ivCopy(w);
462 }
463 }
464 else
465 {
466 if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
467 {
468 w = ivCopy((*weights)[0]);
469 hom = isHomog;
470 }
471 }
472
473#ifdef HAVE_PLURAL
475 {
476// quick solution; need theory to apply homog GB stuff for G-Algebras
477 hom = isNotHomog;
478 }
479#endif // HAVE_PLURAL
480
481 if (hom==isHomog)
482 {
483 intvec *w1 = syPrepareModComp(res[0],&w);
484 if (w!=NULL) { delete w;w=NULL; }
485 w = w1;
486 j = 0;
487 while ((j<IDELEMS(res[0])) && (res[0]->m[j]==NULL)) j++;
488 if (j<IDELEMS(res[0]))
489 {
490 if (p_FDeg(res[0]->m[j],currRing)!=pTotaldegree(res[0]->m[j]))
491 setRegularity = FALSE;
492 }
493 }
494 else
495 {
496 setRegularity = FALSE;
497 }
498
499/*--- the main loop --------------------------------------*/
500 while ((res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])) &&
501 ((maxlength==-1) || (syzIndex<=maxlength)))
502 // (syzIndex<maxlength+(int)minim)))
503/*--- compute one step more for minimizing-----------------*/
504 {
505 if (Kstd1_deg!=0) Kstd1_deg++;
506 if (syzIndex+1==*length)
507 {
508 newres = (resolvente)omAlloc0((*length+5)*sizeof(ideal));
509 tempW = (intvec**)omAlloc0((*length+5)*sizeof(intvec*));
510 for (j=0;j<*length;j++)
511 {
512 newres[j] = res[j];
513 if (*weights!=NULL) tempW[j] = (*weights)[j];
514 /*else tempW[j] = NULL;*/
515 }
516 omFreeSize((ADDRESS)res,*length*sizeof(ideal));
517 if (*weights != NULL) omFreeSize((ADDRESS)*weights,*length*sizeof(intvec*));
518 *length += 5;
519 res=newres;
520 *weights = tempW;
521 }
522/*--- interreducing first -----------------------------------*/
523 if (syzIndex>0)
524 {
525 int rkI=id_RankFreeModule(res[syzIndex],currRing);
526 rSetSyzComp(rkI, currRing);
527 }
529 if (minim || (syzIndex!=0))
530 {
531 ideal temp = kInterRedOld(res[syzIndex],currRing->qideal);
532 idDelete(&res[syzIndex]);
533 idSkipZeroes(temp);
534 res[syzIndex] = temp;
535 }
536/*--- computing the syzygy modules --------------------------------*/
537 if ((currRing->qideal==NULL)&&(syzIndex==0)&& (!TEST_OPT_DEGBOUND))
538 {
539 res[/*syzIndex+*/1] = idSyzygies(res[0/*syzIndex*/],hom,&w,FALSE,setRegularity,&Kstd1_deg);
543 }
544 else
545 {
546 res[syzIndex+1] = idSyzygies(res[syzIndex],hom,&w,FALSE);
547 }
548 completeMinim=(syzIndex!=maxlength) || (maxlength ==-1) || (hom!=isHomog);
549 syzIndex++;
550 if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
551
553 {
554 if ((minim)||(syzIndex>1))
555 syMinStep(res[syzIndex-1],res[syzIndex],!completeMinim,NULL,hom);
556 if (!completeMinim)
557 /*minim is TRUE, we are in the module: maxlength, maxlength <>0*/
558 {
559 idDelete(&res[syzIndex]);
560 }
561 }
562/*---creating the iterated weights for module components ---------*/
563 if ((hom == isHomog) && (res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])))
564 {
565//Print("die %d Modulegewichte sind:\n",w1->length());
566//w1->show();
567//PrintLn();
568 int max_comp = id_RankFreeModule(res[syzIndex],currRing);
569 k = max_comp - rGetCurrSyzLimit(currRing);
570 assume(w != NULL);
571 if (w != NULL)
572 w->resize(max_comp+IDELEMS(res[syzIndex]));
573 else
574 w = new intvec(max_comp+IDELEMS(res[syzIndex]));
575 (*weights)[syzIndex] = new intvec(k);
576 for (i=0;i<k;i++)
577 {
578 if (res[syzIndex-1]->m[i]!=NULL) // hs
579 {
580 (*w)[i + rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex-1]->m[i],currRing);
581 if (pGetComp(res[syzIndex-1]->m[i])>0)
583 += (*w)[pGetComp(res[syzIndex-1]->m[i])-1];
584 (*((*weights)[syzIndex]))[i] = (*w)[i+rGetCurrSyzLimit(currRing)];
585 }
586 }
587 for (i=k;i<k+IDELEMS(res[syzIndex]);i++)
588 {
589 if (res[syzIndex]->m[i-k]!=NULL)
590 (*w)[i+rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex]->m[i-k],currRing)
591 +(*w)[pGetComp(res[syzIndex]->m[i-k])-1];
592 }
593 }
594 }
595/*--- end of the main loop --------------------------------------*/
596/*--- deleting the temporare data structures --------------------*/
597 if ((syzIndex!=0) && (res[syzIndex]!=NULL) && (idIs0(res[syzIndex])))
598 idDelete(&res[syzIndex]);
599 if (w !=NULL) delete w;
600
601 Kstd1_deg=Kstd1_OldDeg;
602
603 for (i=1; i<=syzIndex; i++)
604 {
605 if ((res[i]!=NULL) && ! idIs0(res[i]))
606 {
608 res[i]->rank=idElem(res[i-1]);
609 }
610 }
611/*--- going back to the original ring -------------------------*/
612 if (origR != syz_ring)
613 {
614 rChangeCurrRing(origR); // should not be needed now?
615 for (i=0; i<=syzIndex; i++)
616 {
617 res[i] = idrMoveR_NoSort(res[i], syz_ring, origR);
618 }
619 rDelete(syz_ring);
620 }
621 SI_RESTORE_OPT1(save1);
622 return res;
623}
#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:834
ideal kInterRedOld(ideal F, const ideal Q)
Definition kstd1.cc:3457
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:734
#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 BOOLEAN inf_length=(maxlength==0);
1022 if (inf_length) maxlength=rVar(currRing)+2;
1023 resolvente fr = sySchreyerResolvente(arg,maxlength,&(rl));
1024 if (fr==NULL) return NULL;
1025
1026 // int typ0;
1028 result->length=rl;
1029 result->fullres = (resolvente)omAlloc0((rl /*result->length*/+1)*sizeof(ideal));
1030 for (int i=rl /*result->length*/-1;i>=0;i--)
1031 {
1032 if (fr[i]!=NULL)
1033 {
1034 idSkipZeroes(fr[i]);
1035 result->fullres[i] = fr[i];
1036 fr[i] = NULL;
1037 }
1038 }
1039 if (currRing->qideal!=NULL)
1040 {
1041 for (int i=0; i<rl; i++)
1042 {
1043 if (result->fullres[i]!=NULL)
1044 {
1045 ideal t=kNF(currRing->qideal,NULL,result->fullres[i]);
1046 idDelete(&result->fullres[i]);
1047 result->fullres[i]=t;
1048 if (i<rl-1)
1049 {
1050 for(int j=IDELEMS(t)-1;j>=0; j--)
1051 {
1052 if ((t->m[j]==NULL) && (result->fullres[i+1]!=NULL))
1053 {
1054 for(int k=IDELEMS(result->fullres[i+1])-1;k>=0; k--)
1055 {
1056 if (result->fullres[i+1]->m[k]!=NULL)
1057 {
1058 pDeleteComp(&(result->fullres[i+1]->m[k]),j+1);
1059 }
1060 }
1061 }
1062 }
1063 }
1064 idSkipZeroes(result->fullres[i]);
1065 }
1066 }
1067 if ((rl>maxlength) && (result->fullres[rl-1]!=NULL))
1068 {
1069 idDelete(&result->fullres[rl-1]);
1070 }
1071 }
1072 if (inf_length)
1073 {
1074 int i=0;
1075 loop
1076 {
1077 if(result->fullres[i]!=NULL)
1078 {
1079 if(idIs0(result->fullres[i])) // delete everything after pos i
1080 {
1081 for(int j=i+1;j<=rl;j++)
1082 {
1083 if(result->fullres[j]!=NULL) idDelete(&result->fullres[j]);
1084 }
1085 rl=i;
1086 break;
1087 }
1088 }
1089 i++;
1090 if (i>rl) break;
1091 }
1092 result->length=rl;
1093 if (!idIs0(result->fullres[rl])) // add trailing 0-ideal
1094 {
1095 if(result->fullres[rl+1]==NULL)
1096 {
1097 result->fullres[rl+1]=idInit(1,1);
1098 result->length=rl+1;
1099 }
1100 }
1101 }
1102
1103 omFreeSize((ADDRESS)fr,(rl /*result->length*/)*sizeof(ideal));
1104 return result;
1105}
#define pDeleteComp(p, k)
Definition polys.h:361
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:603
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((*length)*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:774
static BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:773
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 1831 of file syz1.cc.

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

◆ 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.