My Project
Loading...
Searching...
No Matches
syz1.cc File Reference
#include "kernel/mod2.h"
#include "misc/mylimits.h"
#include "misc/options.h"
#include "misc/intvec.h"
#include "coeffs/numbers.h"
#include "polys/monomials/ring.h"
#include "polys/kbuckets.h"
#include "polys/prCopy.h"
#include "kernel/polys.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/kutil.h"
#include "kernel/combinatorics/stairc.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/syz.h"

Go to the source code of this file.

Functions

void p_Setm_Syz (poly p, ring r, int *Components, long *ShiftedComponents)
 
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)
 
poly syRedtail (poly p, syStrategy syzstr, int index)
 
static int syChMin (intvec *iv)
 
SRes syInitRes (ideal arg, int *length, intvec *Tl, intvec *cw)
 
long syReorderShiftedComponents (long *sc, int n)
 
static void pResetSetm (poly p)
 
void syResetShiftedComponents (syStrategy syzstr, int index, int hilb)
 
static BOOLEAN syOrder (poly p, syStrategy syzstr, int index, int realcomp)
 
static intvecsyLinStrat (SSet nextPairs, syStrategy syzstr, int howmuch, int index)
 
void syEnlargeFields (syStrategy syzstr, int index)
 
static void syRedNextPairs (SSet nextPairs, syStrategy syzstr, int howmuch, int index)
 
static void syRedGenerOfCurrDeg (syStrategy syzstr, int deg, int index)
 
void syEnterPair (SSet sPairs, SObject *so, int *sPlength, int)
 
void syEnterPair (syStrategy syzstr, SObject *so, int *sPlength, int index)
 
static void syCreateNewPairs (syStrategy syzstr, int index, int newEl)
 
static SSet syChosePairsPutIn (syStrategy syzstr, int *index, int *howmuch, int *actdeg, int an, int en)
 
SSet syChosePairs (syStrategy syzstr, int *index, int *howmuch, int *actdeg)
 
int syInitSyzMod (syStrategy syzstr, int index, int init)
 
void syKillComputation (syStrategy syzstr, ring r)
 
resolvente syReorder (resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy, resolvente totake)
 
intvecsyBettiOfComputation (syStrategy syzstr, BOOLEAN minim, int *row_shift, intvec *weights)
 
int sySize (syStrategy syzstr)
 
int syDim (syStrategy syzstr)
 
syStrategy syCopy (syStrategy syzstr)
 
static void syPrintEmptySpaces (int i)
 
static void syPrintEmptySpaces1 (int i)
 
static int syLengthInt (int i)
 
void syPrint (syStrategy syzstr, const char *sn)
 
static poly syStripOutCopy (poly p, intvec *toStrip)
 
static poly syMinimizeP1 (int toMin, syStrategy syzstr, intvec *ordn, int index, intvec *toStrip)
 
void syKillEmptyEntres (resolvente res, int length)
 
static intvecsyToStrip (syStrategy syzstr, int index)
 
static intvecsyOrdPairs (SSet sPairs, int length)
 
static resolvente syReadOutMinimalRes (syStrategy syzstr, BOOLEAN computeStd=FALSE)
 
syStrategy syMinimize (syStrategy syzstr)
 
syStrategy syLaScala3 (ideal arg, int *length)
 
syStrategy syLaScala (ideal arg, int &maxlength, intvec *weights)
 

Variables

VAR int * currcomponents =NULL
 
VAR long * currShiftedComponents =NULL
 

Function Documentation

◆ p_Setm_Syz()

void p_Setm_Syz ( poly p,
ring r,
int * Components,
long * ShiftedComponents )
extern

Definition at line 530 of file p_polys.cc.

531{
532 _components = Components;
533 _componentsShifted = ShiftedComponents;
535 p_Setm_General(p, r);
537}
int p
Definition cfModGcd.cc:4086
STATIC_VAR int _componentsExternal
Definition p_polys.cc:148
STATIC_VAR long * _componentsShifted
Definition p_polys.cc:147
void p_Setm_General(poly p, const ring r)
Definition p_polys.cc:158
STATIC_VAR int * _components
Definition p_polys.cc:146

◆ pResetSetm()

static void pResetSetm ( poly p)
static

Definition at line 394 of file syz1.cc.

395{
396#ifdef PDEBUG
397 poly q = p;
398#endif
399 while (p!= NULL)
400 {
401 pSetm(p);
402 pIter(p);
403 }
404#ifdef PDEBUG
405 pTest(q);
406#endif
407}
#define pIter(p)
Definition monomials.h:37
#define NULL
Definition omList.c:12
#define pTest(p)
Definition polys.h:415
#define pSetm(p)
Definition polys.h:272

◆ syBettiOfComputation()

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

Don't change the syzstr???

Definition at line 1756 of file syz1.cc.

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

◆ syChMin()

static int syChMin ( intvec * iv)
static

Definition at line 270 of file syz1.cc.

271{
272 int i,j=-1,r=-1;
273
274 for (i=iv->length()-1;i>=0;i--)
275 {
276 if ((*iv)[i]>=0)
277 {
278 if ((j<0) || ((*iv)[i]<j))
279 {
280 j = (*iv)[i];
281 r = i;
282 }
283 }
284 }
285 return r;
286}
int j
Definition facHensel.cc:110

◆ syChosePairs()

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

Definition at line 1288 of file syz1.cc.

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

◆ syChosePairsPutIn()

static SSet syChosePairsPutIn ( syStrategy syzstr,
int * index,
int * howmuch,
int * actdeg,
int an,
int en )
static

Definition at line 1181 of file syz1.cc.

1183{
1184 int newdeg=*actdeg,newindex=-1,i,t,sldeg;
1185 SSet result;
1186 SRes resPairs=syzstr->resPairs;
1187
1188 if (an>syzstr->length) return NULL;
1189 if (en>syzstr->length) en=syzstr->length;
1190 while (*index<en)
1191 {
1192 if (resPairs[*index]!=NULL)
1193 {
1194 sldeg = (*actdeg)+*index;
1195 i = 0;
1196 if (*index!=0)
1197 {
1198 while ((i<(*syzstr->Tl)[*index]))
1199 {
1200 if ((resPairs[*index])[i].lcm!=NULL)
1201 {
1202 if ((resPairs[*index])[i].order == sldeg)
1203 {
1204 result = &(resPairs[*index])[i];
1205 *howmuch =1;
1206 i++;
1207 while ((i<(*syzstr->Tl)[*index]) && ((resPairs[*index])[i].lcm!=NULL)
1208 && ((resPairs[*index])[i].order == sldeg))
1209 {
1210 i++;
1211 (*howmuch)++;
1212 }
1213 return result;
1214 }
1215 }
1216 i++;
1217 }
1218 }
1219 else
1220 {
1221 while ((i<(*syzstr->Tl)[*index]))
1222 {
1223 if ((resPairs[*index])[i].syz!=NULL)
1224 {
1225 if ((resPairs[*index])[i].order == sldeg)
1226 {
1227 result = &(resPairs[*index])[i];
1228 (*howmuch) =1;
1229 i++;
1230 while ((i<(*syzstr->Tl)[*index]) && ((resPairs[*index])[i].syz!=NULL)
1231 && ((resPairs[*index])[i].order == *actdeg))
1232 {
1233 i++;
1234 (*howmuch)++;
1235 }
1236 return result;
1237 }
1238 }
1239 i++;
1240 }
1241 }
1242 }
1243 (*index)++;
1244 }
1245 *index = an;
1246 //if (TEST_OPT_PROT) Print("(Euler:%d)",euler);
1247 while (*index<en)
1248 {
1249 if (resPairs[*index]!=NULL)
1250 {
1251 i = 0;
1252 while ((i<(*syzstr->Tl)[*index]))
1253 {
1254 t = *actdeg+*index;
1255 if (((resPairs[*index])[i].lcm!=NULL) ||
1256 ((resPairs[*index])[i].syz!=NULL))
1257 {
1258 if ((resPairs[*index])[i].order > t)
1259 t = (resPairs[*index])[i].order;
1260 }
1261 if ((t>*actdeg+*index) && ((newdeg==*actdeg) || (t<newdeg+*index)))
1262 {
1263 newdeg = t-*index;
1264 newindex = *index;
1265 break;
1266 }
1267 i++;
1268 }
1269 }
1270 (*index)++;
1271 }
1272 if (newdeg>*actdeg)
1273 {
1274 *actdeg = newdeg;
1275 *index = newindex;
1276 return syChosePairsPutIn(syzstr,index,howmuch,actdeg,an,en);
1277 }
1278 else return NULL;
1279}
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:709
intvec * Tl
Definition syz.h:50
SSet * SRes
Definition syz.h:33
SObject * SSet
Definition syz.h:32

◆ 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 k
Definition cfEzgcd.cc:99
void syCopyPair(SObject *argso, SObject *imso)
Definition syz1.cc:82
void syInitializePair(SObject *so)
Definition syz1.cc:63

◆ syCompactifyPairSet()

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

Definition at line 104 of file syz1.cc.

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

◆ syCopy()

syStrategy syCopy ( syStrategy syzstr)

Definition at line 1885 of file syz1.cc.

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

◆ syCopyPair()

void syCopyPair ( SObject * argso,
SObject * imso )

Definition at line 82 of file syz1.cc.

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

◆ syCreateNewPairs()

static void syCreateNewPairs ( syStrategy syzstr,
int index,
int newEl )
static

Definition at line 1069 of file syz1.cc.

1070{
1071 SSet temp;
1072 SObject tso;
1073 int i,ii,j,k=IDELEMS(syzstr->res[index]),l=(*syzstr->Tl)[index],ll;
1074 int first,pos,jj,j1;
1075 int * bci=syzstr->backcomponents[index];
1076 poly p,q;
1077 polyset rs=syzstr->res[index]->m,nPm;
1078
1079
1080 while ((k>0) && (rs[k-1]==NULL)) k--;
1081 if (newEl>=k) return;
1082
1083 long * ShiftedComponents = syzstr->ShiftedComponents[index];
1084 int* Components = syzstr->truecomponents[index];
1085
1086 ideal nP=idInit(k,syzstr->res[index]->rank);
1087 nPm=nP->m;
1088 while ((l>0) && ((syzstr->resPairs[index])[l-1].p1==NULL)) l--;
1089 for (j=newEl;j<k;j++)
1090 {
1091 q = rs[j];
1092 first = syzstr->Firstelem[index-1][pGetComp(q)]-1;
1093 pos = first+syzstr->Howmuch[index-1][pGetComp(q)];
1094 for (i=first;i<pos;i++)
1095 {
1096 jj = bci[i];
1097 if (jj>=j) break;
1098 p = pOne();
1099 pLcm(rs[jj],q,p);
1100 pSetComp(p,j+1);
1101 p_Setm_Syz(p, currRing, Components, ShiftedComponents);
1102 ii = first;
1103 loop
1104 {
1105 j1 = bci[ii];
1106 if (nPm[j1]!=NULL)
1107 {
1108 if (pLmDivisibleByNoComp(nPm[j1],p))
1109 {
1110 pDelete(&p);
1111 break;
1112 }
1113 else if (pLmDivisibleByNoComp(p,nPm[j1]))
1114 {
1115 pDelete(&(nPm[j1]));
1116 //break;
1117 }
1118 }
1119 ii++;
1120 if (ii>=pos) break;
1121 }
1122 if (p!=NULL)
1123 {
1124 nPm[jj] = p;
1125 }
1126 }
1127 for (i=first;i<pos;i++)
1128 {
1129 ii = bci[i];
1130 if (nPm[ii]!=NULL)
1131 {
1132 if (l>=(*syzstr->Tl)[index])
1133 {
1134 temp = (SSet)omAlloc0(((*syzstr->Tl)[index]+16)*sizeof(SObject));
1135 for (ll=0;ll<(*syzstr->Tl)[index];ll++)
1136 {
1137 temp[ll].p = (syzstr->resPairs[index])[ll].p;
1138 temp[ll].p1 = (syzstr->resPairs[index])[ll].p1;
1139 temp[ll].p2 = (syzstr->resPairs[index])[ll].p2;
1140 temp[ll].syz = (syzstr->resPairs[index])[ll].syz;
1141 temp[ll].lcm = (syzstr->resPairs[index])[ll].lcm;
1142 temp[ll].ind1 = (syzstr->resPairs[index])[ll].ind1;
1143 temp[ll].ind2 = (syzstr->resPairs[index])[ll].ind2;
1144 temp[ll].syzind = (syzstr->resPairs[index])[ll].syzind;
1145 temp[ll].order = (syzstr->resPairs[index])[ll].order;
1146 temp[ll].isNotMinimal = (syzstr->resPairs[index])[ll].isNotMinimal;
1147 }
1148 if (syzstr->resPairs[index] != NULL) // OB: ????
1149 omFreeSize((ADDRESS)syzstr->resPairs[index],(*syzstr->Tl)[index]*sizeof(SObject));
1150 (*syzstr->Tl)[index] += 16;
1151 syzstr->resPairs[index] = temp;
1152 }
1153 tso.lcm = p = nPm[ii];
1154 nPm[ii] = NULL;
1155 tso.order = pTotaldegree(p);
1156 if ((syzstr->cw!=NULL) && (index>0) && (pGetComp(q)>0))
1157 {
1158 int ii=index-1,jj=pGetComp(q);
1159 while (ii>0)
1160 {
1161 jj = pGetComp(syzstr->res[ii]->m[jj-1]);
1162 ii--;
1163 }
1164 tso.order += (*syzstr->cw)[jj-1];
1165 }
1166 tso.p1 = rs[ii];
1167 tso.p2 = q;
1168 tso.ind1 = ii;
1169 tso.ind2 = j;
1170 tso.syzind = -1;
1171 tso.isNotMinimal = NULL;
1172 tso.p = NULL;
1173 tso.syz = NULL;
1174 syEnterPair(syzstr->resPairs[index],&tso,&l,index);
1175 }
1176 }
1177 }
1178 idDelete(&nP);
1179}
void * ADDRESS
Definition auxiliary.h:120
int l
Definition cfEzgcd.cc:100
#define idDelete(H)
delete an ideal
Definition ideals.h:29
#define omFreeSize(addr, size)
#define omAlloc0(size)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
static long pTotaldegree(poly p)
Definition polys.h:283
#define pDelete(p_ptr)
Definition polys.h:187
#define pGetComp(p)
Component.
Definition polys.h:38
#define pSetComp(p, v)
Definition polys.h:39
#define pOne()
Definition polys.h:316
poly * polyset
Definition polys.h:260
#define pLcm(a, b, m)
Definition polys.h:296
#define pLmDivisibleByNoComp(a, b)
like pLmDivisibleBy, does not check components
Definition polys.h:143
ideal idInit(int idsize, int rank)
initialise an ideal / module
#define IDELEMS(i)
#define loop
Definition structs.h:71
void syEnterPair(SSet sPairs, SObject *so, int *sPlength, int)
Definition syz1.cc:985
void p_Setm_Syz(poly p, ring r, int *Components, long *ShiftedComponents)
Definition p_polys.cc:530
intvec * cw
Definition syz.h:52
int ** backcomponents
Definition syz.h:41
int ** truecomponents
Definition syz.h:39
int ** Firstelem
Definition syz.h:43
long ** ShiftedComponents
Definition syz.h:40
int ** Howmuch
Definition syz.h:42

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

◆ syDim()

int syDim ( syStrategy syzstr)

Definition at line 1850 of file syz1.cc.

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

◆ syEnlargeFields()

void syEnlargeFields ( syStrategy syzstr,
int index )

Definition at line 734 of file syz1.cc.

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

◆ syEnterPair() [1/2]

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

Definition at line 985 of file syz1.cc.

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

◆ syEnterPair() [2/2]

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

Definition at line 1035 of file syz1.cc.

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

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

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}
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:188
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
static int syChMin(intvec *iv)
Definition syz1.cc:270

◆ syInitSyzMod()

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

Definition at line 1459 of file syz1.cc.

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

◆ syKillComputation()

void syKillComputation ( syStrategy syzstr,
ring r )

Definition at line 1495 of file syz1.cc.

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

◆ syKillEmptyEntres()

void syKillEmptyEntres ( resolvente res,
int length )

Definition at line 2199 of file syz1.cc.

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

◆ syLaScala()

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

Definition at line 2558 of file syz1.cc.

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

◆ syLaScala3()

syStrategy syLaScala3 ( ideal arg,
int * length )

Definition at line 2432 of file syz1.cc.

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

◆ syLengthInt()

static int syLengthInt ( int i)
static

Definition at line 1919 of file syz1.cc.

1920{
1921 int j=0;
1922
1923 if (i==0) return 1;
1924 while (i!=0)
1925 {
1926 j++;
1927 i = i/10;
1928 }
1929 return j;
1930}

◆ syLinStrat()

static intvec * syLinStrat ( SSet nextPairs,
syStrategy syzstr,
int howmuch,
int index )
static

Definition at line 649 of file syz1.cc.

651{
652 int i=howmuch-1,i1=0,i2,i3,l,ll;
653 int ** Fin=syzstr->Firstelem;
654 int ** Hin=syzstr->Howmuch;
655 ideal o_r=syzstr->orderedRes[index+1];
656 intvec *result=new intvec(howmuch+1);
657 intvec *spl=new intvec(howmuch,1,-1);
658 BOOLEAN isDivisible;
659 SObject tso;
660
661 while (i>=0)
662 {
663 tso = nextPairs[i];
664 isDivisible = FALSE;
665 if (syzstr->res[index+1]!=NULL)
666 {
667 l = Fin[index][pGetComp(tso.lcm)]-1;
668 if (l>=0)
669 {
670 ll = l+Hin[index][pGetComp(tso.lcm)];
671 while ((l<ll) && (!isDivisible))
672 {
673 if (o_r->m[l]!=NULL)
674 {
675 isDivisible = isDivisible ||
676 pLmDivisibleByNoComp(o_r->m[l],tso.lcm);
677 }
678 l++;
679 }
680 }
681 }
682 if (isDivisible)
683 {
684 syDeletePair(&nextPairs[i]);
685 //crit++;
686 }
687 else
688 {
689 pTest(tso.p2);
690 pTest(tso.p1);
691 nextPairs[i].p =
692 ksOldCreateSpoly(tso.p2, tso.p1,NULL);
693 (*spl)[i] = pLength(nextPairs[i].p);
694 }
695 i--;
696 }
697 i3 = 0;
698 loop
699 {
700 i2 = -1;
701 for (i1=0;i1<howmuch;i1++)
702 {
703 if (i2==-1)
704 {
705 if ((*spl)[i1]!=-1)
706 {
707 i2 = i1;
708 }
709 }
710 else
711 {
712 if (((*spl)[i1]>=0) && ((*spl)[i1]<(*spl)[i2]))
713 {
714 i2 = i1;
715 }
716 }
717 }
718 if (i2>=0)
719 {
720 (*result)[i3] = i2+1;
721 (*spl)[i2] = -1;
722 i3++;
723 }
724 else
725 {
726 break;
727 }
728 }
729 delete spl;
730 return result;
731}
KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
Definition kInline.h:1191
static int pLength(poly a)
Definition p_polys.h:190
void syDeletePair(SObject *so)
Definition syz1.cc:44

◆ syMinimize()

syStrategy syMinimize ( syStrategy syzstr)

Definition at line 2393 of file syz1.cc.

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

◆ syMinimizeP1()

static poly syMinimizeP1 ( int toMin,
syStrategy syzstr,
intvec * ordn,
int index,
intvec * toStrip )
static

Definition at line 2151 of file syz1.cc.

2153{
2154 int ii=0,i,tc,lp,ltS=-1;
2155 poly p,mp=NULL,pp;
2156 SSet sPairs=syzstr->resPairs[index];
2157 poly tempStripped=NULL;
2158
2159 pp = syStripOutCopy(syzstr->res[index+1]->m[toMin],toStrip);
2160 kBucketInit(syzstr->bucket,pp,-1);
2161 while ((ii<ordn->length()) && ((*ordn)[ii]!=-1) &&
2162 (sPairs[(*ordn)[ii]].syzind!=toMin))
2163 {
2164 ii++;
2165 }
2166 while (ii>=0)
2167 {
2168 i = (*ordn)[ii];
2169 if (sPairs[i].isNotMinimal!=NULL)
2170 {
2171 tempStripped =
2172 syStripOutCopy(syzstr->res[index+1]->m[sPairs[i].syzind],toStrip);
2173 tc = pGetComp(sPairs[i].isNotMinimal);
2174 int lu;
2175 pTakeOutComp(&tempStripped,tc,&p,&lu);
2176 kBucketTakeOutComp(syzstr->bucket,tc,&mp,&lp);
2177 mp = pDivideM(mp,p);
2178 while (mp!=NULL)
2179 {
2180 p = pNext(mp);
2181 pNext(mp) = NULL;
2182 ltS = -1;
2183 kBucket_Minus_m_Mult_p(syzstr->bucket,mp,tempStripped,&ltS);
2184 pDelete(&mp);
2185 mp = p;
2186 }
2187 pDelete(&mp);
2188 pDelete(&tempStripped);
2189 }
2190 ii--;
2191 }
2192 kBucketClear(syzstr->bucket,&pp,&lp);
2193 return pp;
2194}
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition cf_gcd.cc:676
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition kbuckets.cc:521
void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, poly spNoether)
Bpoly == Bpoly - m*p; where m is a monom Does not destroy p and m assume (*l <= 0 || pLength(p) == *l...
Definition kbuckets.cc:722
void kBucketTakeOutComp(kBucket_pt bucket, long comp, poly *r_p, int *l)
Definition kbuckets.cc:1032
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition kbuckets.cc:493
#define pNext(p)
Definition monomials.h:36
#define pDivideM(a, b)
Definition polys.h:295
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
static poly syStripOutCopy(poly p, intvec *toStrip)
Definition syz1.cc:2066

◆ syOrder()

static BOOLEAN syOrder ( poly p,
syStrategy syzstr,
int index,
int realcomp )
static

Definition at line 461 of file syz1.cc.

463{
464 int i=IDELEMS(syzstr->res[index-1])+1,j=0,k,tc,orc,ie=realcomp-1;
465 int *trind1=syzstr->truecomponents[index-1];
466 int *trind=syzstr->truecomponents[index];
467 long *shind=syzstr->ShiftedComponents[index];
468 int *bc=syzstr->backcomponents[index];
469 int *F1=syzstr->Firstelem[index-1];
470 int *H1=syzstr->Howmuch[index-1];
471 polyset o_r=syzstr->orderedRes[index]->m;
472 BOOLEAN ret = FALSE;
473
474 // if != 0, then new element can go into same component
475 // i.e., we do not need to leave space in shifted components
476 long same_comp = 0;
477
478 if (p==NULL) return FALSE;
479 if (realcomp==0) realcomp=1;
480
481 if (index>1)
482 tc = trind1[pGetComp(p)]-1;
483 else
484 tc = pGetComp(p)-1;
485 loop //while ((j<ie) && (trind1[orc]<=tc+1))
486 {
487 if (j>=ie)
488 break;
489 else
490 {
491 orc = pGetComp(o_r[j]);
492 if (trind1[orc]>tc+1) break;
493 else if (trind1[orc] == tc+1)
494 {
495 same_comp = 1;
496 }
497 else
498 {
499 assume(same_comp == 0);
500 }
501 j += H1[orc];
502 }
503 }
504 if (j>ie)
505 {
506 WerrorS("orderedRes to small");
507 return FALSE;
508 }
509 ie++;
510 if (j == (ie -1))
511 {
512 // new element is the last in ordered module
513 if (same_comp == 0)
514 same_comp = SYZ_SHIFT_BASE;
515
516 // test whether we have enough space for new shifted component
517 if ((LONG_MAX - same_comp) <= shind[ie-1])
518 {
519 long new_space = syReorderShiftedComponents(shind, ie);
520 assume((LONG_MAX - same_comp) > shind[ie-1]);
521 ret = TRUE;
522 if (TEST_OPT_PROT) Print("(T%ld)", new_space);
523 }
524
525 // yes, then set new shifted component
526 assume(ie == 1 || shind[ie-1] > 0);
527 shind[ie] = shind[ie-1] + same_comp;
528 }
529 else
530 {
531 // new element must come in between
532 // i.e. at place j+1
533 long prev, next;
534
535 // test whether new component can get shifted value
536 prev = shind[j];
537 next = shind[j+1];
538 assume(next > prev);
539 if ((same_comp && prev + 2 >= next) || (!same_comp && next - prev < 4))
540 {
541 long new_space = syReorderShiftedComponents(shind, ie);
542 prev = shind[j];
543 next = shind[j+1];
544 assume((same_comp && prev + 2 < next) || (!same_comp && next - prev >= 4));
545 ret = TRUE;
546 if (TEST_OPT_PROT) Print("(B%ld)", new_space);
547 }
548
549 // make room for insertion of j+1 shifted component
550 for (k=ie; k > j+1; k--) shind[k] = shind[k-1];
551
552 if (same_comp)
553 {
554 // can simply add one
555 shind[j+1] = prev + 1;
556 assume(shind[j+1] + 1 < shind[j+2]);
557 }
558 else
559 {
560 // need to leave more breathing room - i.e. value goes in
561 // between
562 shind[j+1] = prev + ((next - prev) >> 1);
563 assume (shind[j] + 1 < shind[j+1] && shind[j+1] + 1 < shind[j+2]);
564 }
565 }
566
567 if (o_r[j]!=NULL)
568 {
569 for (k=ie-1;k>j;k--)
570 {
571 o_r[k] = o_r[k-1];
572 bc[k] = bc[k-1];
573 }
574 }
575 o_r[j] = p;
576 bc[j] = realcomp-1;
577 (H1[pGetComp(p)])++;
578 for (k=0;k<i;k++)
579 {
580 if (F1[k]>j)
581 (F1[k])++;
582 }
583 if (F1[pGetComp(p)]==0)
584 F1[pGetComp(p)]=j+1;
585 for (k=0;k<IDELEMS((syzstr->res)[index]);k++)
586 {
587 if (trind[k]>j)
588 trind[k] += 1;
589 }
590 for (k=IDELEMS((syzstr->res)[index])-1;k>realcomp;k--)
591 trind[k] = trind[k-1];
592 trind[realcomp] = j+1;
593 return ret;
594}
void WerrorS(const char *s)
Definition feFopen.cc:24
ListNode * next
Definition janet.h:31
long syReorderShiftedComponents(long *sc, int n)
Definition syz1.cc:334
int F1(int a1, int &r1)
F1.

◆ syOrdPairs()

static intvec * syOrdPairs ( SSet sPairs,
int length )
static

Definition at line 2274 of file syz1.cc.

2275{
2276 intvec * result=new intvec(length,1,-1);
2277 int i,j=0,k=-1,l,ii;
2278
2279 loop
2280 {
2281 l = -1;
2282 for(i=0;i<length;i++)
2283 {
2284 if (sPairs[i].syzind>k)
2285 {
2286 if (l==-1)
2287 {
2288 l = sPairs[i].syzind;
2289 ii = i;
2290 }
2291 else
2292 {
2293 if (sPairs[i].syzind<l)
2294 {
2295 l = sPairs[i].syzind;
2296 ii = i;
2297 }
2298 }
2299 }
2300 }
2301 if (l==-1) break;
2302 (*result)[j] = ii;
2303 j++;
2304 k = l;
2305 }
2306 return result;
2307}

◆ syPrint()

void syPrint ( syStrategy syzstr,
const char * sn )

Definition at line 1935 of file syz1.cc.

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

◆ syPrintEmptySpaces()

static void syPrintEmptySpaces ( int i)
static

Definition at line 1895 of file syz1.cc.

1896{
1897 if (i!=0)
1898 {
1899 PrintS(" ");
1901 }
1902}

◆ syPrintEmptySpaces1()

static void syPrintEmptySpaces1 ( int i)
static

Definition at line 1907 of file syz1.cc.

1908{
1909 if (i!=0)
1910 {
1911 PrintS(" ");
1913 }
1914}

◆ syReadOutMinimalRes()

static resolvente syReadOutMinimalRes ( syStrategy syzstr,
BOOLEAN computeStd = FALSE )
static

Definition at line 2312 of file syz1.cc.

2314{
2315 intvec * Strip, * ordn;
2316 resolvente tres=(resolvente)omAlloc0((syzstr->length+1)*sizeof(ideal));
2317 ring origR = currRing;
2318
2319//Print("Hier ");
2320 if (computeStd)
2321 {
2322 tres[0] = syzstr->res[1];
2323 syzstr->res[1] = idInit(IDELEMS(tres[0]),tres[0]->rank);
2324 return tres;
2325 }
2326 int i,l,index,i1;
2327 SSet sPairs;
2328
2329 assume(syzstr->syRing != NULL);
2330 rChangeCurrRing(syzstr->syRing);
2331//Print("laeufts ");
2332 syzstr->bucket = kBucketCreate(syzstr->syRing);
2333 for (index=syzstr->length-1;index>0;index--)
2334 {
2335 if (syzstr->resPairs[index]!=NULL)
2336 {
2337//Print("ideal %d: \n",index);
2341 IDELEMS(syzstr->res[index]), currRing);
2342 sPairs = syzstr->resPairs[index];
2343 Strip = syToStrip(syzstr,index);
2344 tres[index+1] = idInit(IDELEMS(syzstr->res[index+1]),syzstr->res[index+1]->rank);
2345 i1 = (*syzstr->Tl)[index];
2346//Print("i1= %d\n",i1);
2347 ordn = syOrdPairs(sPairs,i1);
2348 for (i=0;i<i1;i++)
2349 {
2350 if ((sPairs[i].isNotMinimal==NULL) && (sPairs[i].lcm!=NULL))
2351 {
2352 l = sPairs[i].syzind;
2353//Print("Minimiere Poly %d: ",l);pWrite(syzstr->res[index+1]->m[l]);
2354 tres[index+1]->m[l] =
2355 syMinimizeP1(l,syzstr,ordn,index,Strip);
2356 }
2357 }
2358 delete Strip;
2359 delete ordn;
2360 Strip = NULL;
2361 }
2362 }
2363 currcomponents = syzstr->truecomponents[0];
2366 IDELEMS(syzstr->res[0]), currRing);
2367 tres[1] = idInit(IDELEMS(syzstr->res[1]),syzstr->res[1]->rank);
2368 sPairs = syzstr->resPairs[0];
2369 for (i=(*syzstr->Tl)[0]-1;i>=0;i--)
2370 {
2371 if (sPairs[i].syzind>=0)
2372 {
2373 tres[1]->m[sPairs[i].syzind] = pCopy(syzstr->res[1]->m[sPairs[i].syzind]);
2374 }
2375 }
2376/*--- changes to the original ring------------------*/
2377 kBucketDestroy(&syzstr->bucket);
2378 if (syzstr->syRing != NULL)
2379 {
2380 rChangeCurrRing(origR);
2381 // Thomas: now make sure that all data which you need is pFetchCopied
2382 // maybe incorporate it into syReorder ??
2383 }
2384 tres = syReorder(tres,syzstr->length,syzstr,FALSE,syzstr->res);
2385 syKillEmptyEntres(tres,syzstr->length);
2386 idSkipZeroes(tres[0]);
2387 return tres;
2388}
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
static intvec * syOrdPairs(SSet sPairs, int length)
Definition syz1.cc:2274
static poly syMinimizeP1(int toMin, syStrategy syzstr, intvec *ordn, int index, intvec *toStrip)
Definition syz1.cc:2151
static intvec * syToStrip(syStrategy syzstr, int index)
Definition syz1.cc:2252

◆ syRedGenerOfCurrDeg()

static void syRedGenerOfCurrDeg ( syStrategy syzstr,
int deg,
int index )
static

Definition at line 915 of file syz1.cc.

916{
917 ideal res=syzstr->res[index];
918 int i=0,j,k=IDELEMS(res);
919 SSet sPairs=syzstr->resPairs[index-1];
920
921 while ((k>0) && (res->m[k-1]==NULL)) k--;
922 while ((i<(*syzstr->Tl)[index-1]) && (((sPairs)[i].syz==NULL) ||
923 ((sPairs)[i].order<deg)))
924 i++;
925 if ((i>=(*syzstr->Tl)[index-1]) || ((sPairs)[i].order>deg)) return;
926 while ((i<(*syzstr->Tl)[index-1]) && (((sPairs)[i].syz==NULL) ||
927 ((sPairs)[i].order==deg)))
928 {
929 if ((sPairs)[i].syz!=NULL)
930 {
931 j = k-1;
932 while ((j>=0) && (res->m[j]!=NULL) &&
933 ((sPairs)[i].syz!=NULL))
934 {
935 if (pLmDivisibleBy(res->m[j],(sPairs)[i].syz))
936 {
937 (sPairs)[i].syz =
938 ksOldSpolyRed(res->m[j],(sPairs)[i].syz);
939 //sySPolyRed((sPairs)[i].syz,res->m[j]);
940 j = k-1;
941 }
942 else
943 {
944 j--;
945 }
946 }
947 if ((sPairs)[i].syz != NULL)
948 {
949 if (k==IDELEMS(res))
950 {
951 syEnlargeFields(syzstr,index);
952 res=syzstr->res[index];
953 }
954 if (TEST_OPT_DEBUG)
955 {
956 if ((sPairs)[i].isNotMinimal==NULL)
957 {
958 PrintLn();
959 PrintS("minimal generator: ");pWrite((syzstr->resPairs[index-1])[i].syz);
960 PrintS("comes from: ");pWrite((syzstr->resPairs[index-1])[i].p1);
961 PrintS("and: ");pWrite((syzstr->resPairs[index-1])[i].p2);
962 }
963 }
964 //res->m[k] = (sPairs)[i].syz;
965 res->m[k] = syRedtail((sPairs)[i].syz,syzstr,index);
966 (sPairs)[i].syzind = k;
967 syzstr->elemLength[index][k] = pLength((sPairs)[i].syz);
968 pNorm(res->m[k]);
969 // (sPairs)[i].syz = NULL;
970 k++;
971 if (syOrder(res->m[k-1],syzstr,index,k))
973 //euler++;
974 }
975 else
976 (sPairs)[i].syzind = -1;
977 }
978 i++;
979 }
980}
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition kInline.h:1171
#define TEST_OPT_DEBUG
Definition options.h:110
void pNorm(poly p)
Definition polys.h:363
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition polys.h:141
void pWrite(poly p)
Definition polys.h:309
poly syRedtail(poly p, syStrategy syzstr, int index)
Definition syz1.cc:226
void syEnlargeFields(syStrategy syzstr, int index)
Definition syz1.cc:734
static BOOLEAN syOrder(poly p, syStrategy syzstr, int index, int realcomp)
Definition syz1.cc:461
void syResetShiftedComponents(syStrategy syzstr, int index, int hilb)
Definition syz1.cc:409

◆ syRedNextPairs()

static void syRedNextPairs ( SSet nextPairs,
syStrategy syzstr,
int howmuch,
int index )
static

Definition at line 768 of file syz1.cc.

770{
771 int i,j,k=IDELEMS(syzstr->res[index]);
772 int ks=IDELEMS(syzstr->res[index+1]);
773 int * Fin=syzstr->Firstelem[index-1];
774 int * Hin=syzstr->Howmuch[index-1];
775 int * bin=syzstr->backcomponents[index];
776 int * elL=syzstr->elemLength[index];
777 number coefgcd;
778 polyset redset=syzstr->orderedRes[index]->m;
779 poly p=NULL,q;
780 intvec *spl1;
781 SObject tso;
782 long * ShiftedComponents = syzstr->ShiftedComponents[index];
783 int* Components = syzstr->truecomponents[index];
784 assume(Components != NULL && ShiftedComponents != NULL);
785 BOOLEAN need_reset;
786
787 if ((nextPairs==NULL) || (howmuch==0)) return;
788 while ((k>0) && (syzstr->res[index]->m[k-1]==NULL)) k--;
789 while ((ks>0) && (syzstr->res[index+1]->m[ks-1]==NULL)) ks--;
790 spl1 = syLinStrat(nextPairs,syzstr,howmuch,index);
791 i=0;
792 while ((*spl1)[i]>0)
793 {
794 need_reset = FALSE;
795 tso = nextPairs[(*spl1)[i]-1];
796 if ((tso.p1!=NULL) && (tso.p2!=NULL))
797 {
798 nNormalize(pGetCoeff(tso.p1));
799 nNormalize(pGetCoeff(tso.p2));
800 coefgcd =
801 n_SubringGcd(pGetCoeff(tso.p1),pGetCoeff(tso.p2),currRing->cf);
802 tso.syz = pHead(tso.lcm);
803 p = tso.syz;
804 pSetCoeff(p,nDiv(pGetCoeff(tso.p1),coefgcd));
806 pSetComp(p,tso.ind2+1);
807 p_Setm_Syz(p, currRing, Components, ShiftedComponents); // actueller index
808 pNext(p) = pHead(tso.lcm);
809 pIter(p);
810 pSetComp(p,tso.ind1+1);
811 p_Setm_Syz(p, currRing, Components, ShiftedComponents); // actueller index
812 pSetCoeff(p,nDiv(pGetCoeff(tso.p2),coefgcd));
813 nDelete(&coefgcd);
814 if (tso.p != NULL)
815 {
816 kBucketInit(syzstr->bucket,tso.p,-1);
817 q = kBucketGetLm(syzstr->bucket);
818 j = Fin[pGetComp(q)]-1;
819 int pos = j+Hin[pGetComp(q)];
820 loop
821 {
822 if (j<0) break;
823 if (pLmDivisibleByNoComp(redset[j],q))
824 {
825 pNext(p) = pHead(q);
826 pIter(p);
827 pSetComp(p,bin[j]+1);
828 p_Setm_Syz(p, currRing, Components, ShiftedComponents); // actueller index
829//if (pLength(redset[j])!=syzstr->elemLength[index][bin[j]])
830//Print("Halt");
831//if (pLength(redset[j])!=syzstr->elemLength[index][bin[j]])
832//Print("Halt");
834 number up = kBucketPolyRed(syzstr->bucket,redset[j],elL[bin[j]],
835 NULL);
836 // Thomas: Check whether you need number here
837 nDelete(&up);
838 q = kBucketGetLm(syzstr->bucket);
839 if (q==NULL) break;
840 j = Fin[pGetComp(q)]-1;
841 pos = j+Hin[pGetComp(q)];
842 }
843 else
844 {
845 j++;
846 if (j==pos) break;
847 }
848 }
849 int lb;
850 kBucketClear(syzstr->bucket,&tso.p,&lb);
851 }
852 if (tso.p != NULL)
853 {
854 if (TEST_OPT_PROT) PrintS("g");
855 if (k==IDELEMS((syzstr->res)[index]))
856 {
857 syEnlargeFields(syzstr,index);
858 bin=syzstr->backcomponents[index];
859 elL=syzstr->elemLength[index];
860 redset=syzstr->orderedRes[index]->m;
861 Components = syzstr->truecomponents[index];
862 ShiftedComponents = syzstr->ShiftedComponents[index];
863 }
864 pNext(p) = pHead(tso.p);
865 pIter(p);
866
867 assume(p!= NULL);
868 k++;
869 syzstr->res[index]->m[k-1] = tso.p;
870 syzstr->elemLength[index][k-1] = pLength(tso.p);
871 pNorm(syzstr->res[index]->m[k-1]);
872 need_reset = syOrder(syzstr->res[index]->m[k-1],syzstr,index,k);
873 pSetComp(p,k); // actueller index
874 p_Setm_Syz(p, currRing, Components, ShiftedComponents);
876
877 tso.isNotMinimal = p;
878 tso.p = NULL;
879 }
880 else
881 {
882 if (TEST_OPT_PROT) PrintS(".");
883 //if (index % 2==0)
884 //euler++;
885 //else
886 //euler--;
887 }
888 if (ks==IDELEMS(syzstr->res[index+1]))
889 {
890 syEnlargeFields(syzstr,index+1);
891 }
892 syzstr->res[index+1]->m[ks] = tso.syz;
893 syzstr->elemLength[index+1][ks] = pLength(tso.syz);
894 pNorm(syzstr->res[index+1]->m[ks]);
895 tso.syz =NULL;
896 tso.syzind = ks;
897 if (need_reset)
899 if (syOrder(syzstr->res[index+1]->m[ks],syzstr,index+1,ks+1))
901 ks++;
902 p = NULL;
903 nextPairs[(*spl1)[i]-1] = tso;
904 }
905 i++;
906 }
907 delete spl1;
908}
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition coeffs.h:667
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition kbuckets.cc:1071
const poly kBucketGetLm(kBucket_pt bucket)
Definition kbuckets.cc:506
poly p
Definition kbuckets.h:186
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
#define nDiv(a, b)
Definition numbers.h:32
#define nDelete(n)
Definition numbers.h:16
#define nInpNeg(n)
Definition numbers.h:21
#define nNormalize(n)
Definition numbers.h:30
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition polys.h:32
static intvec * syLinStrat(SSet nextPairs, syStrategy syzstr, int howmuch, int index)
Definition syz1.cc:649

◆ syRedtail()

poly syRedtail ( poly p,
syStrategy syzstr,
int index )

Definition at line 226 of file syz1.cc.

227{
228 poly h, hn;
229 int j,pos;
230 ideal redWith=syzstr->orderedRes[index];
231
232 h = p;
233 hn = pNext(h);
234 while(hn != NULL)
235 {
236 j = syzstr->Firstelem[index-1][pGetComp(hn)]-1;
237 if (j>=0)
238 {
239 pos = j+syzstr->Howmuch[index-1][pGetComp(hn)];
240 while (j < pos)
241 {
242 if (pLmDivisibleByNoComp(redWith->m[j], hn))
243 {
244 //hn = sySPolyRed(hn,redWith->m[j]);
245 hn = ksOldSpolyRed(redWith->m[j],hn);
246 if (hn == NULL)
247 {
248 pNext(h) = NULL;
249 return p;
250 }
251 j = syzstr->Firstelem[index-1][pGetComp(hn)]-1;
252 pos = j+syzstr->Howmuch[index-1][pGetComp(hn)];
253 }
254 else
255 {
256 j++;
257 }
258 }
259 }
260 h = pNext(h) = hn;
261 hn = pNext(h);
262 }
263 return p;
264}
STATIC_VAR Poly * h
Definition janet.cc:971

◆ syReorder()

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

Definition at line 1641 of file syz1.cc.

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

◆ syReorderShiftedComponents()

long syReorderShiftedComponents ( long * sc,
int n )

Definition at line 334 of file syz1.cc.

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

◆ syResetShiftedComponents()

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

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

◆ sySize()

int sySize ( syStrategy syzstr)

Definition at line 1830 of file syz1.cc.

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

◆ syStripOutCopy()

static poly syStripOutCopy ( poly p,
intvec * toStrip )
static

Definition at line 2066 of file syz1.cc.

2067{
2068 if (toStrip==NULL) return pCopy(p);
2069 poly result=NULL,pp;
2070
2071 while (p!=NULL)
2072 {
2073 if ((*toStrip)[pGetComp(p)]==0)
2074 {
2075 if (result==NULL)
2076 {
2077 result = pp = pHead(p);
2078 }
2079 else
2080 {
2081 pNext(pp) = pHead(p);
2082 pIter(pp);
2083 }
2084 }
2085 pIter(p);
2086 }
2087 return result;
2088}

◆ syToStrip()

static intvec * syToStrip ( syStrategy syzstr,
int index )
static

Definition at line 2252 of file syz1.cc.

2253{
2254 intvec * result=NULL;
2255
2256 if ((syzstr->resPairs[index-1]!=NULL) && (!idIs0(syzstr->res[index])))
2257 {
2258 result=new intvec(IDELEMS(syzstr->res[index])+1);
2259 for (int i=(*syzstr->Tl)[index-1]-1;i>=0;i--)
2260 {
2261 if (syzstr->resPairs[index-1][i].isNotMinimal!=NULL)
2262 {
2263 (*result)[syzstr->resPairs[index-1][i].syzind+1] = 1;
2264 }
2265 }
2266 }
2267 return result;
2268}

Variable Documentation

◆ currcomponents

VAR int* currcomponents =NULL

Definition at line 33 of file syz1.cc.

◆ currShiftedComponents

VAR long* currShiftedComponents =NULL

Definition at line 34 of file syz1.cc.