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 intvec * | syLinStrat (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)
intvec * | syBettiOfComputation (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 intvec * | syToStrip (syStrategy syzstr, int index)
static intvec * | syOrdPairs (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.

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

## pResetSetm()

void pResetSetm | ( | poly | p | ) |

static

Definition at line 394 of file syz1.cc.

{
#ifdef PDEBUG
poly q = p;
#endif
while (p!= NULL)
{
pSetm(p);
pIter(p);
}
#ifdef PDEBUG
pTest(q);
#endif
}
pIter
#define pIter(p)
Definition monomials.h:37
NULL
#define NULL
Definition omList.c:12
pTest
#define pTest(p)
Definition polys.h:415
pSetm
#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.

{
int dummy;
BOOLEAN std_weights=TRUE;
if ((weights!=NULL)
&& (syzstr->betti!=NULL)
&& (syzstr->weights!=NULL) && (syzstr->weights[0]!=NULL))
{
int i;
for(i=weights->length()-1; i>=0; i--)
{
//Print("test %d: %d - %d\n",i,(*weights)[i], (*(syzstr->weights[0]))[i]);
if ((*weights)[i]!=(*(syzstr->weights[0]))[i])
{
std_weights=FALSE;
break;
}
}
}
if ((syzstr->betti!=NULL)
&& (std_weights))
{
if (minim || (syzstr->resPairs!=NULL))
return ivCopy(syzstr->betti);
}
resolvente fullres = syzstr->fullres;
resolvente minres = syzstr->minres;
const int length = syzstr->length;
if ((fullres==NULL) && (minres==NULL))
{
if (syzstr->hilb_coeffs==NULL)
{ // LA SCALA
fullres = syReorder(syzstr->res, length, syzstr);
}
else
{ // HRES
minres = syReorder(syzstr->orderedRes, length, syzstr);
syKillEmptyEntres(minres, length);
}
}
intvec *result=NULL;
if (fullres!=NULL)
result = syBetti(fullres,length,&dummy,weights,minim,row_shift);
else
result = syBetti(minres,length,&dummy,weights,minim,row_shift);
return result; /// Don't change the syzstr???
// TODO: cleanup these!
if( fullres != NULL && syzstr->fullres == NULL )
syzstr->fullres = fullres;
if( minres != NULL && syzstr->minres == NULL )
syzstr->minres = minres;
if ((result!=NULL)
&& ((minim) || (syzstr->resPairs!=NULL))
&& std_weights
&& (syzstr->betti==NULL))
{
syzstr->betti = ivCopy(result); // cache the result...
}
return result;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
i
int i
Definition cfEzgcd.cc:132
intvec
Definition intvec.h:24
intvec::length
int length() const
Definition intvec.h:95
result
return result
Definition facAbsBiFact.cc:76
resolvente
ideal * resolvente
Definition ideals.h:18
length
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
ivCopy
intvec * ivCopy(const intvec *o)
Definition intvec.h:146
syReorder
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy, resolvente totake)
Definition syz1.cc:1641
syKillEmptyEntres
void syKillEmptyEntres(resolvente res, int length)
Definition syz1.cc:2199
syBetti
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition syz.cc:787
ssyStrategy::hilb_coeffs
intvec ** hilb_coeffs
Definition syz.h:46
ssyStrategy::minres
resolvente minres
Definition syz.h:58
ssyStrategy::betti
intvec * betti
Definition syz.h:53
ssyStrategy::res
resolvente res
Definition syz.h:47
ssyStrategy::fullres
resolvente fullres
Definition syz.h:57
ssyStrategy::weights
intvec ** weights
Definition syz.h:45
ssyStrategy::orderedRes
resolvente orderedRes
Definition syz.h:48
ssyStrategy::length
int length
Definition syz.h:60
ssyStrategy::resPairs
SRes resPairs
Definition syz.h:49

## syChMin()

int syChMin | ( | intvec * | iv | ) |

static

Definition at line 270 of file syz1.cc.

{
int i,j=-1,r=-1;
for (i=iv->length()-1;i>=0;i--)
{
if ((*iv)[i]>=0)
{
if ((j<0) || ((*iv)[i]<j))
{
j = (*iv)[i];
r = i;
}
}
}
return r;
}
j
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.

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

## syChosePairsPutIn()

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

static

Definition at line 1181 of file syz1.cc.

{
int newdeg=*actdeg,newindex=-1,i,t,sldeg;
SSet result;
SRes resPairs=syzstr->resPairs;
if (an>syzstr->length) return NULL;
if (en>syzstr->length) en=syzstr->length;
while (*index<en)
{
if (resPairs[*index]!=NULL)
{
sldeg = (*actdeg)+*index;
i = 0;
if (*index!=0)
{
while ((i<(*syzstr->Tl)[*index]))
{
if ((resPairs[*index])[i].lcm!=NULL)
{
if ((resPairs[*index])[i].order == sldeg)
{
result = &(resPairs[*index])[i];
*howmuch =1;
i++;
while ((i<(*syzstr->Tl)[*index]) && ((resPairs[*index])[i].lcm!=NULL)
&& ((resPairs[*index])[i].order == sldeg))
{
i++;
(*howmuch)++;
}
return result;
}
}
i++;
}
}
else
{
while ((i<(*syzstr->Tl)[*index]))
{
if ((resPairs[*index])[i].syz!=NULL)
{
if ((resPairs[*index])[i].order == sldeg)
{
result = &(resPairs[*index])[i];
(*howmuch) =1;
i++;
while ((i<(*syzstr->Tl)[*index]) && ((resPairs[*index])[i].syz!=NULL)
&& ((resPairs[*index])[i].order == *actdeg))
{
i++;
(*howmuch)++;
}
return result;
}
}
i++;
}
}
}
(*index)++;
}
*index = an;
//if (TEST_OPT_PROT) Print("(Euler:%d)",euler);
while (*index<en)
{
if (resPairs[*index]!=NULL)
{
i = 0;
while ((i<(*syzstr->Tl)[*index]))
{
t = *actdeg+*index;
if (((resPairs[*index])[i].lcm!=NULL) ||
((resPairs[*index])[i].syz!=NULL))
{
if ((resPairs[*index])[i].order > t)
t = (resPairs[*index])[i].order;
}
if ((t>*actdeg+*index) && ((newdeg==*actdeg) || (t<newdeg+*index)))
{
newdeg = t-*index;
newindex = *index;
break;
}
i++;
}
}
(*index)++;
}
if (newdeg>*actdeg)
{
*actdeg = newdeg;
*index = newindex;
return syChosePairsPutIn(syzstr,index,howmuch,actdeg,an,en);
}
else return NULL;
}
lcm
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:709
ssyStrategy::Tl
intvec * Tl
Definition syz.h:50
SRes
SSet * SRes
Definition syz.h:33
SSet
SObject * SSet
Definition syz.h:32

## syCompactify1()

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

Definition at line 132 of file syz1.cc.

{
int k=first,kk=0;
while (k+kk<*sPlength)
{
if (sPairs[k+kk].lcm!=NULL)
{
if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
k++;
}
else
{
kk++;
}
}
while (k<*sPlength)
{
syInitializePair(&sPairs[k]);
k++;
}
*sPlength -= kk;
}
k
int k
Definition cfEzgcd.cc:99
syCopyPair
void syCopyPair(SObject *argso, SObject *imso)
Definition syz1.cc:82
syInitializePair
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.

{
int k=first,kk=0;
while (k+kk<sPlength)
{
if (sPairs[k+kk].lcm!=NULL)
{
if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
k++;
}
else
{
kk++;
}
}
while (k<sPlength)
{
syInitializePair(&sPairs[k]);
k++;
}
}

## syCopy()

syStrategy syCopy | ( | syStrategy | syzstr | ) |

Definition at line 1885 of file syz1.cc.

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

## syCopyPair()

void syCopyPair | ( | SObject * | argso,
|  | SObject * | imso )

Definition at line 82 of file syz1.cc.

{
*imso=*argso;
(*argso).p = NULL;
(*argso).p1 = NULL;
(*argso).p2 = NULL;
(*argso).lcm = NULL;
(*argso).syz = NULL;
(*argso).ind1 = 0;
(*argso).ind2 = 0;
(*argso).syzind = -1;
(*argso).order = 0;
(*argso).isNotMinimal = NULL;
(*argso).length = -1;
(*argso).reference = -1;
}

## syCreateNewPairs()

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

static

Definition at line 1069 of file syz1.cc.

{
SSet temp;
SObject tso;
int i,ii,j,k=IDELEMS(syzstr->res[index]),l=(*syzstr->Tl)[index],ll;
int first,pos,jj,j1;
int * bci=syzstr->backcomponents[index];
poly p,q;
polyset rs=syzstr->res[index]->m,nPm;
while ((k>0) && (rs[k-1]==NULL)) k--;
if (newEl>=k) return;
long * ShiftedComponents = syzstr->ShiftedComponents[index];
int* Components = syzstr->truecomponents[index];
ideal nP=idInit(k,syzstr->res[index]->rank);
nPm=nP->m;
while ((l>0) && ((syzstr->resPairs[index])[l-1].p1==NULL)) l--;
for (j=newEl;j<k;j++)
{
q = rs[j];
first = syzstr->Firstelem[index-1][pGetComp(q)]-1;
pos = first+syzstr->Howmuch[index-1][pGetComp(q)];
for (i=first;i<pos;i++)
{
jj = bci[i];
if (jj>=j) break;
p = pOne();
pLcm(rs[jj],q,p);
pSetComp(p,j+1);
p_Setm_Syz(p, currRing, Components, ShiftedComponents);
ii = first;
loop
{
j1 = bci[ii];
if (nPm[j1]!=NULL)
{
if (pLmDivisibleByNoComp(nPm[j1],p))
{
pDelete(&p);
break;
}
else if (pLmDivisibleByNoComp(p,nPm[j1]))
{
pDelete(&(nPm[j1]));
//break;
}
}
ii++;
if (ii>=pos) break;
}
if (p!=NULL)
{
nPm[jj] = p;
}
}
for (i=first;i<pos;i++)
{
ii = bci[i];
if (nPm[ii]!=NULL)
{
if (l>=(*syzstr->Tl)[index])
{
temp = (SSet)omAlloc0(((*syzstr->Tl)[index]+16)*sizeof(SObject));
for (ll=0;ll<(*syzstr->Tl)[index];ll++)
{
temp[ll].p = (syzstr->resPairs[index])[ll].p;
temp[ll].p1 = (syzstr->resPairs[index])[ll].p1;
temp[ll].p2 = (syzstr->resPairs[index])[ll].p2;
temp[ll].syz = (syzstr->resPairs[index])[ll].syz;
temp[ll].lcm = (syzstr->resPairs[index])[ll].lcm;
temp[ll].ind1 = (syzstr->resPairs[index])[ll].ind1;
temp[ll].ind2 = (syzstr->resPairs[index])[ll].ind2;
temp[ll].syzind = (syzstr->resPairs[index])[ll].syzind;
temp[ll].order = (syzstr->resPairs[index])[ll].order;
temp[ll].isNotMinimal = (syzstr->resPairs[index])[ll].isNotMinimal;
}
if (syzstr->resPairs[index] != NULL) // OB: ????
omFreeSize((ADDRESS)syzstr->resPairs[index],(*syzstr->Tl)[index]*sizeof(SObject));
(*syzstr->Tl)[index] += 16;
syzstr->resPairs[index] = temp;
}
tso.lcm = p = nPm[ii];
nPm[ii] = NULL;
tso.order = pTotaldegree(p);
if ((syzstr->cw!=NULL) && (index>0) && (pGetComp(q)>0))
{
int ii=index-1,jj=pGetComp(q);
while (ii>0)
{
jj = pGetComp(syzstr->res[ii]->m[jj-1]);
ii--;
}
tso.order += (*syzstr->cw)[jj-1];
}
tso.p1 = rs[ii];
tso.p2 = q;
tso.ind1 = ii;
tso.ind2 = j;
tso.syzind = -1;
tso.isNotMinimal = NULL;
tso.p = NULL;
tso.syz = NULL;
syEnterPair(syzstr->resPairs[index],&tso,&l,index);
}
}
}
idDelete(&nP);
}
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
l
int l
Definition cfEzgcd.cc:100
idDelete
#define idDelete(H)
delete an ideal
Definition ideals.h:29
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
pTotaldegree
static long pTotaldegree(poly p)
Definition polys.h:283
pDelete
#define pDelete(p_ptr)
Definition polys.h:187
pGetComp
#define pGetComp(p)
Component.
Definition polys.h:38
pSetComp
#define pSetComp(p, v)
Definition polys.h:39
pOne
#define pOne()
Definition polys.h:316
polyset
poly * polyset
Definition polys.h:260
pLcm
#define pLcm(a, b, m)
Definition polys.h:296
pLmDivisibleByNoComp
#define pLmDivisibleByNoComp(a, b)
like pLmDivisibleBy, does not check components
Definition polys.h:143
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
loop
#define loop
Definition structs.h:71
syEnterPair
void syEnterPair(SSet sPairs, SObject *so, int *sPlength, int)
Definition syz1.cc:985
p_Setm_Syz
void p_Setm_Syz(poly p, ring r, int *Components, long *ShiftedComponents)
Definition p_polys.cc:530
ssyStrategy::cw
intvec * cw
Definition syz.h:52
ssyStrategy::backcomponents
int ** backcomponents
Definition syz.h:41
ssyStrategy::truecomponents
int ** truecomponents
Definition syz.h:39
ssyStrategy::Firstelem
int ** Firstelem
Definition syz.h:43
ssyStrategy::ShiftedComponents
long ** ShiftedComponents
Definition syz.h:40
ssyStrategy::Howmuch
int ** Howmuch
Definition syz.h:42

## syDeletePair()

void syDeletePair | ( | SObject * | so | ) |

Definition at line 44 of file syz1.cc.

{
pDelete(&(*so).p);
pDelete(&(*so).lcm);
pDelete(&(*so).syz);
(*so).p1 = NULL;
(*so).p2 = NULL;
(*so).ind1 = 0;
(*so).ind2 = 0;
(*so).syzind = -1;
(*so).order = 0;
(*so).isNotMinimal = NULL;
(*so).length = -1;
(*so).reference = -1;
}

## syDim()

int syDim | ( | syStrategy | syzstr | ) |

Definition at line 1850 of file syz1.cc.

{
int i,l;
if (syzstr->resPairs!=NULL)
{
SRes rP=syzstr->resPairs;
l = syzstr->length;
while ((l>0) && (rP[l-1]==NULL)) l--;
if (l==0) return -1;
l--;
while (l>=0)
{
i = 0;
while ((i<(*syzstr->Tl)[l]) &&
((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
(rP[l][i].isNotMinimal!=NULL))
{
i++;
}
if ((i<(*syzstr->Tl)[l]) &&
((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
(rP[l][i].isNotMinimal==NULL))
return l;
l--;
}
return l;
}
else
return sySize(syzstr);
}
sySize
int sySize(syStrategy syzstr)
Definition syz1.cc:1830

## syEnlargeFields()

void syEnlargeFields | ( | syStrategy | syzstr,
|  | int | index )

Definition at line 734 of file syz1.cc.

{
pEnlargeSet(&(syzstr->res[index]->m),IDELEMS(syzstr->res[index]),16);
syzstr->truecomponents[index]=(int*)omRealloc0Size((ADDRESS)syzstr->truecomponents[index],
(IDELEMS(syzstr->res[index])+1)*sizeof(int),
(IDELEMS(syzstr->res[index])+17)*sizeof(int));
syzstr->ShiftedComponents[index]
=(long*)omRealloc0Size((ADDRESS)syzstr->ShiftedComponents[index],
(IDELEMS(syzstr->res[index])+1)*sizeof(long),
(IDELEMS(syzstr->res[index])+17)*sizeof(long));
syzstr->backcomponents[index]=(int*)omRealloc0Size((ADDRESS)syzstr->backcomponents[index],
(IDELEMS(syzstr->res[index])+1)*sizeof(int),
(IDELEMS(syzstr->res[index])+17)*sizeof(int));
syzstr->Howmuch[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Howmuch[index],
(IDELEMS(syzstr->res[index])+1)*sizeof(int),
(IDELEMS(syzstr->res[index])+17)*sizeof(int));
syzstr->Firstelem[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Firstelem[index],
(IDELEMS(syzstr->res[index])+1)*sizeof(int),
(IDELEMS(syzstr->res[index])+17)*sizeof(int));
syzstr->elemLength[index]=(int*)omRealloc0Size((ADDRESS)syzstr->elemLength[index],
(IDELEMS(syzstr->res[index])+1)*sizeof(int),
(IDELEMS(syzstr->res[index])+17)*sizeof(int));
syzstr->sev[index]=(unsigned long*)omRealloc0Size((ADDRESS)syzstr->sev[index],
(IDELEMS(syzstr->res[index])+1)*sizeof(unsigned long),
(IDELEMS(syzstr->res[index])+17)*sizeof(unsigned long));
IDELEMS(syzstr->res[index]) += 16;
pEnlargeSet(&(syzstr->orderedRes[index]->m),IDELEMS(syzstr->orderedRes[index]),16);
IDELEMS(syzstr->orderedRes[index]) += 16;
}
omRealloc0Size
#define omRealloc0Size(addr, o_size, size)
Definition omAllocDecl.h:221
pEnlargeSet
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3821
ssyStrategy::elemLength
int ** elemLength
Definition syz.h:44
ssyStrategy::sev
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.

{
int ll,k,no=(*so).order,sP=*sPlength,i;
if ((sP==0) || (sPairs[sP-1].order<=no))
ll = sP;
else if (sP==1)
ll = 0;
else
{
int an=0,en=sP-1;
loop
{
if (an>=en-1)
{
if ((sPairs[an].order<=no) && (sPairs[an+1].order>no))
{
ll = an+1;
break;
}
else if ((sPairs[en].order<=no) && (sPairs[en+1].order>no))
{
ll = en+1;
break;
}
else if (sPairs[an].order>no)
{
ll = an;
break;
}
else
{
PrintS("Hier ist was faul!\n");
break;
}
}
i=(an+en) / 2;
if (sPairs[i].order <= no)
an=i;
else
en=i;
}
}
for (k=(*sPlength);k>ll;k--)
{
syCopyPair(&sPairs[k-1],&sPairs[k]);
}
syCopyPair(so,&sPairs[ll]);
(*sPlength)++;
}
PrintS
void PrintS(const char *s)
Definition reporter.cc:288

## syEnterPair() [2/2]

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

Definition at line 1035 of file syz1.cc.

{
int ll;
if (*sPlength>=(*syzstr->Tl)[index])
{
SSet temp = (SSet)omAlloc0(((*syzstr->Tl)[index]+16)*sizeof(SObject));
for (ll=0;ll<(*syzstr->Tl)[index];ll++)
{
temp[ll].p = (syzstr->resPairs[index])[ll].p;
temp[ll].p1 = (syzstr->resPairs[index])[ll].p1;
temp[ll].p2 = (syzstr->resPairs[index])[ll].p2;
temp[ll].syz = (syzstr->resPairs[index])[ll].syz;
temp[ll].lcm = (syzstr->resPairs[index])[ll].lcm;
temp[ll].ind1 = (syzstr->resPairs[index])[ll].ind1;
temp[ll].ind2 = (syzstr->resPairs[index])[ll].ind2;
temp[ll].syzind = (syzstr->resPairs[index])[ll].syzind;
temp[ll].order = (syzstr->resPairs[index])[ll].order;
temp[ll].isNotMinimal = (syzstr->resPairs[index])[ll].isNotMinimal;
temp[ll].length = (syzstr->resPairs[index])[ll].length;
temp[ll].reference = (syzstr->resPairs[index])[ll].reference;
}
if (syzstr->resPairs[index] != NULL) // OB: ?????
omFreeSize((ADDRESS)syzstr->resPairs[index],(*syzstr->Tl)[index]*sizeof(SObject));
(*syzstr->Tl)[index] += 16;
syzstr->resPairs[index] = temp;
}
syEnterPair(syzstr->resPairs[index],so,sPlength,index);
}

## syInitializePair()

void syInitializePair | ( | SObject * | so | ) |

Definition at line 63 of file syz1.cc.

{
(*so).p = NULL;
(*so).lcm = NULL;
(*so).syz = NULL;
(*so).p1 = NULL;
(*so).p2 = NULL;
(*so).ind1 = 0;
(*so).ind2 = 0;
(*so).syzind = -1;
(*so).order = 0;
(*so).isNotMinimal = NULL;
(*so).length = -1;
(*so).reference = -1;
}

## syInitRes()

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

Definition at line 293 of file syz1.cc.

{
if (idIs0(arg)) return NULL;
SRes resPairs = (SRes)omAlloc0(*length*sizeof(SSet));
resPairs[0] = (SSet)omAlloc0(IDELEMS(arg)*sizeof(SObject));
intvec * iv=NULL;
int i,j;
if (id_RankFreeModule(arg,currRing)==0)
{
iv = idSort(arg);
for (i=0;i<IDELEMS(arg);i++)
{
(resPairs[0])[i].syz = /*pCopy*/(arg->m[(*iv)[i]-1]);
arg->m[(*iv)[i]-1] = NULL;
(resPairs[0])[i].order = pTotaldegree((resPairs[0])[i].syz);
}
}
else
{
iv = new intvec(IDELEMS(arg),1,-1);
for (i=0;i<IDELEMS(arg);i++)
{
(*iv)[i] = pTotaldegree(arg->m[i])+(*cw)[pGetComp(arg->m[i])-1];
}
for (i=0;i<IDELEMS(arg);i++)
{
j = syChMin(iv);
if (j<0) break;
(resPairs[0])[i].syz = arg->m[j];
arg->m[j] = NULL;
(resPairs[0])[i].order = (*iv)[j];
(*iv)[j] = -1;
}
}
if (iv!=NULL) delete iv;
(*Tl)[0] = IDELEMS(arg);
return resPairs;
}
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition simpleideals.cc:960
idSort
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:188
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition simpleideals.cc:992
syChMin
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.

{
int result;
if (syzstr->res[index]==NULL)
{
syzstr->res[index] = idInit(init-1,1);
syzstr->truecomponents[index] = (int*)omAlloc0(init*sizeof(int));
syzstr->ShiftedComponents[index] = (long*)omAlloc0(init*sizeof(long));
if (index==0)
{
for (int i=0;i<init;i++)
{
syzstr->truecomponents[0][i] = i;
syzstr->ShiftedComponents[0][i] = (i)*SYZ_SHIFT_BASE;
}
}
syzstr->backcomponents[index] = (int*)omAlloc0(init*sizeof(int));
syzstr->Howmuch[index] = (int*)omAlloc0(init*sizeof(int));
syzstr->Firstelem[index] = (int*)omAlloc0(init*sizeof(int));
syzstr->elemLength[index] = (int*)omAlloc0(init*sizeof(int));
syzstr->orderedRes[index] = idInit(init-1,1);
syzstr->sev[index] = (unsigned long*) omAlloc0(init*sizeof(unsigned long));
result = 0;
}
else
{
result = IDELEMS(syzstr->res[index]);
while ((result>0) && (syzstr->res[index]->m[result-1]==NULL)) result--;
}
return result;
}
LinTree::init
void init()
Definition lintree.cc:864
SYZ_SHIFT_BASE
#define SYZ_SHIFT_BASE
Definition syz.h:18

## syKillComputation()

void syKillComputation | ( | syStrategy | syzstr,
|  | ring | r )

Definition at line 1495 of file syz1.cc.

{
if (syzstr->references>0)
{
(syzstr->references)--;
}
else
{
int i,j;
if (syzstr->minres!=NULL)
{
for (i=0;i<syzstr->length;i++)
{
if (syzstr->minres[i]!=NULL)
{
id_Delete(&(syzstr->minres[i]),r);
}
}
omFreeSize((ADDRESS)syzstr->minres,(syzstr->length+1)*sizeof(ideal));
}
if (syzstr->fullres!=NULL)
{
for (i=0;i<syzstr->length;i++)
{
if (syzstr->fullres[i]!=NULL)
{
id_Delete(&(syzstr->fullres[i]),r);
}
}
omFreeSize((ADDRESS)syzstr->fullres,(syzstr->length+1)*sizeof(ideal));
}
if (syzstr->weights!=NULL)
{
for (i=0;i<syzstr->length;i++)
{
if (syzstr->weights[i]!=NULL)
{
delete syzstr->weights[i];
}
}
omFreeSize((ADDRESS)syzstr->weights,syzstr->length*sizeof(intvec*));
}
ring sr=syzstr->syRing;
if (sr==NULL) sr=r;
if (syzstr->resPairs!=NULL)
{
for (i=0;i<syzstr->length;i++)
{
for (j=0;j<(*syzstr->Tl)[i];j++)
{
if ((syzstr->resPairs[i])[j].lcm!=NULL)
p_Delete(&((syzstr->resPairs[i])[j].lcm),sr);
if ((i>0) && ((syzstr->resPairs[i])[j].syz!=NULL))
p_Delete(&((syzstr->resPairs[i])[j].syz),sr);
}
if (syzstr->orderedRes[i]!=NULL)
{
for (j=0;j<IDELEMS(syzstr->orderedRes[i]);j++)
{
syzstr->orderedRes[i]->m[j] = NULL;
}
id_Delete(&(syzstr->orderedRes[i]),sr);
}
if (syzstr->truecomponents[i]!=NULL)
{
omFreeSize((ADDRESS)syzstr->truecomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
syzstr->truecomponents[i]=NULL;
omFreeSize((ADDRESS)syzstr->ShiftedComponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(long));
syzstr->ShiftedComponents[i]=NULL;
}
if (syzstr->backcomponents[i]!=NULL)
{
omFreeSize((ADDRESS)syzstr->backcomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
syzstr->backcomponents[i]=NULL;
}
if (syzstr->Howmuch[i]!=NULL)
{
omFreeSize((ADDRESS)syzstr->Howmuch[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
syzstr->Howmuch[i]=NULL;
}
if (syzstr->Firstelem[i]!=NULL)
{
omFreeSize((ADDRESS)syzstr->Firstelem[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
syzstr->Firstelem[i]=NULL;
}
if (syzstr->elemLength[i]!=NULL)
{
omFreeSize((ADDRESS)syzstr->elemLength[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
syzstr->elemLength[i]=NULL;
}
if (syzstr->res[i]!=NULL)
{
for (j=0;j<IDELEMS(syzstr->res[i]);j++)
{
if (syzstr->res[i]->m[j]!=NULL)
p_Delete(&(syzstr->res[i]->m[j]),sr);
}
}
if ((syzstr->hilb_coeffs!=NULL)
&& (syzstr->hilb_coeffs[i]!=NULL))
delete syzstr->hilb_coeffs[i];
if (syzstr->sev[i] != NULL)
omFreeSize((ADDRESS)syzstr->sev[i], (IDELEMS(syzstr->res[i])+1)*sizeof(unsigned long));
id_Delete(&(syzstr->res[i]),sr);
if (syzstr->resPairs[i] != NULL) // OB: ????
omFreeSize((ADDRESS)syzstr->resPairs[i],(*syzstr->Tl)[i]*sizeof(SObject));
}
omFreeSize((ADDRESS)syzstr->resPairs,syzstr->length*sizeof(SObject*));
omFreeSize((ADDRESS)syzstr->res,(syzstr->length+1)*sizeof(ideal));
omFreeSize((ADDRESS)syzstr->orderedRes,(syzstr->length+1)*sizeof(ideal));
omFreeSize((ADDRESS)syzstr->elemLength,(syzstr->length+1)*sizeof(int*));
omFreeSize((ADDRESS)syzstr->truecomponents,(syzstr->length+1)*sizeof(int*));
omFreeSize((ADDRESS)syzstr->ShiftedComponents,(syzstr->length+1)*sizeof(long*));
if (syzstr->sev != NULL)
omFreeSize(((ADDRESS)syzstr->sev), (syzstr->length+1)*sizeof(unsigned long*));
omFreeSize((ADDRESS)syzstr->backcomponents,(syzstr->length+1)*sizeof(int*));
omFreeSize((ADDRESS)syzstr->Howmuch,(syzstr->length+1)*sizeof(int*));
omFreeSize((ADDRESS)syzstr->Firstelem,(syzstr->length+1)*sizeof(int*));
if (syzstr->hilb_coeffs!=NULL)
omFreeSize((ADDRESS)syzstr->hilb_coeffs,(syzstr->length+1)*sizeof(intvec*));
}
if (syzstr->cw!=NULL)
delete syzstr->cw;
if (syzstr->betti!=NULL)
delete syzstr->betti;
if (syzstr->resolution!=NULL)
delete syzstr->resolution;
if (syzstr->Tl!=NULL)
delete syzstr->Tl;
if ((syzstr->syRing != NULL) && (syzstr->syRing != r))
{
if(syzstr->syRing->typ[1].ord_typ == ro_syzcomp)
rChangeSComps(NULL, NULL, 0, syzstr->syRing);
rDelete(syzstr->syRing);
}
omFreeSize((ADDRESS)syzstr, sizeof(ssyStrategy));
}
}
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
rChangeSComps
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition ring.cc:4497
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
ro_syzcomp
@ ro_syzcomp
Definition ring.h:60
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
ssyStrategy::syRing
ring syRing
Definition syz.h:56
ssyStrategy::references
short references
Definition syz.h:63
ssyStrategy::resolution
intvec * resolution
Definition syz.h:51
ssyStrategy
Definition syz.h:37

## syKillEmptyEntres()

void syKillEmptyEntres | ( | resolvente | res,
|  | int | length )

Definition at line 2199 of file syz1.cc.

{
int i,j,jj,k,rj;
intvec * changes;
poly p;
ideal ri;
for (i=0;i<length;i++)
{
ri = res[i];
if (ri!=NULL)
{
rj = IDELEMS(ri);
changes = new intvec(rj+1,1,-1);
while ((rj>0) && (ri->m[rj-1]==NULL)) rj--;
j = k = 0;
while (j+k<rj)
{
if (ri->m[j+k]!=NULL)
{
ri->m[j] = ri->m[j+k];
(*changes)[j+k+1] = j+1;
j++;
}
else
{
k++;
}
}
for (jj=j;jj<rj;jj++)
ri->m[jj] = NULL;
if (res[i+1]!=NULL)
{
ri = res[i+1];
for (j=IDELEMS(ri)-1;j>=0;j--)
{
p = ri->m[j];
while (p!=NULL)
{
pSetComp(p,(*changes)[pGetComp(p)]);
pSetm(p);
pIter(p);
}
}
}
delete changes;
}
}
}
res
CanonicalForm res
Definition facAbsFact.cc:60

## syLaScala()

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

Definition at line 2558 of file syz1.cc.

{
int i,j,actdeg=32000,index=0;
int howmuch;
ideal temp;
SSet nextPairs;
syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
ring origR = currRing;
if(weights!= NULL)
syzstr->cw = new intvec(weights);
else
syzstr->cw = NULL;
if ((idIs0(arg)) ||
((id_RankFreeModule(arg,currRing)>0) && (!idTestHomModule(arg, NULL, syzstr->cw))))
{
syzstr->minres = (resolvente)omAlloc0Bin(char_ptr_bin);
syzstr->length = 1;
syzstr->minres[0] = idInit(1,arg->rank);
return syzstr;
}
//crit = 0;
//euler = -1;
if( maxlength > 0 )
syzstr->length = maxlength; // = (currRing->N)+2;
else
syzstr->length = maxlength = (currRing->N)+2;
// Creare dp,S ring and change to it
syzstr->syRing = rAssure_dp_S(origR);
assume(syzstr->syRing != origR);
assume(syzstr->syRing->typ[1].ord_typ == ro_syzcomp);
rChangeCurrRing(syzstr->syRing);
// set initial ShiftedComps
currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
for (i=0;i<=arg->rank;i++)
{
currShiftedComponents[i] = (i)*SYZ_SHIFT_BASE;
currcomponents[i] = i;
}
rChangeSComps(currcomponents, currShiftedComponents, arg->rank, currRing);
/*--- initializes the data structures---------------*/
syzstr->Tl = new intvec(maxlength);
temp = idInit(IDELEMS(arg),arg->rank);
for (i=0;i<IDELEMS(arg);i++)
{
temp->m[i] = prCopyR( arg->m[i], origR, currRing);
if (temp->m[i]!=NULL)
{
j = pTotaldegree(temp->m[i]);
if (j<actdeg) actdeg = j;
}
}
idTest(temp);
idSkipZeroes(temp);
idTest(temp);
syzstr->resPairs = syInitRes(temp,&maxlength,syzstr->Tl,syzstr->cw);
omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
syzstr->res = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
syzstr->orderedRes = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
syzstr->elemLength = (int**)omAlloc0((maxlength+1)*sizeof(int*));
syzstr->truecomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
syzstr->ShiftedComponents = (long**)omAlloc0((maxlength+1)*sizeof(long*));
syzstr->backcomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
syzstr->Howmuch = (int**)omAlloc0((maxlength+1)*sizeof(int*));
syzstr->Firstelem = (int**)omAlloc0((maxlength+1)*sizeof(int*));
syzstr->sev = (unsigned long **) omAlloc0((maxlength+1)*sizeof(unsigned long *));
assume( syzstr->length == maxlength );
syzstr->bucket = kBucketCreate(currRing);
int len0=id_RankFreeModule(temp,currRing)+1;
nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
//if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
/*--- computes the resolution ----------------------*/
while (nextPairs!=NULL)
{
if (TEST_OPT_PROT) Print("%d",actdeg);
if (TEST_OPT_PROT) Print("(m%d)",index);
if (index==0)
i = syInitSyzMod(syzstr,index,len0);
else
i = syInitSyzMod(syzstr,index);
currcomponents = syzstr->truecomponents[si_max(index-1,0)];
currShiftedComponents = syzstr->ShiftedComponents[si_max(index-1,0)];
rChangeSComps(currcomponents, currShiftedComponents,
IDELEMS(syzstr->res[si_max(index-1,0)]), currRing);
j = syInitSyzMod(syzstr,index+1);
if (index>0)
{
syRedNextPairs(nextPairs,syzstr,howmuch,index);
syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
}
else
syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
/*--- creates new pairs -----------------------------*/
syCreateNewPairs(syzstr,index,i);
if (index<(maxlength-1))
{
syCreateNewPairs(syzstr,index+1,j);
}
index++;
nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
//if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
}
if (temp!=NULL) idDelete(&temp);
kBucketDestroy(&(syzstr->bucket));
if (origR != syzstr->syRing)
rChangeCurrRing(origR);
if (TEST_OPT_PROT) PrintLn();
return syzstr;
}
si_max
static int si_max(const int a, const int b)
Definition auxiliary.h:125
Print
#define Print
Definition emacs.cc:80
idTestHomModule
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition ideals.cc:2120
idTest
#define idTest(id)
Definition ideals.h:47
kBucketDestroy
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition kbuckets.cc:216
kBucketCreate
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition kbuckets.cc:209
assume
#define assume(x)
Definition mod2.h:389
omAlloc0Bin
#define omAlloc0Bin(bin)
Definition omAllocDecl.h:206
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition options.h:105
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition polys.cc:16
prCopyR
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition prCopy.cc:34
PrintLn
void PrintLn()
Definition reporter.cc:314
rAssure_dp_S
ring rAssure_dp_S(const ring r)
Definition ring.cc:5114
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201
char_ptr_bin
EXTERN_VAR omBin char_ptr_bin
Definition structs.h:73
syInitRes
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw)
Definition syz1.cc:293
syCreateNewPairs
static void syCreateNewPairs(syStrategy syzstr, int index, int newEl)
Definition syz1.cc:1069
syCompactifyPairSet
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
Definition syz1.cc:104
syRedGenerOfCurrDeg
static void syRedGenerOfCurrDeg(syStrategy syzstr, int deg, int index)
Definition syz1.cc:915
syInitSyzMod
int syInitSyzMod(syStrategy syzstr, int index, int init)
Definition syz1.cc:1459
syRedNextPairs
static void syRedNextPairs(SSet nextPairs, syStrategy syzstr, int howmuch, int index)
Definition syz1.cc:768
syChosePairs
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
Definition syz1.cc:1288
currShiftedComponents
EXTERN_VAR long * currShiftedComponents
Definition syz.h:118
currcomponents
EXTERN_VAR int * currcomponents
Definition syz.h:117
ssyStrategy::bucket
kBucket_pt bucket
Definition syz.h:54

## syLaScala3()

syStrategy syLaScala3 | ( | ideal | arg,
|  | int * | length )

Definition at line 2432 of file syz1.cc.

{
int i,j,actdeg=32000,index=0;
int howmuch;
ideal temp;
SSet nextPairs;
syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
ring origR = currRing;
if ((idIs0(arg)) ||
((id_RankFreeModule(arg,currRing)>0) && (!idHomModule(arg,NULL,&(syzstr->cw)))))
{
syzstr->minres = (resolvente)omAlloc0Bin(char_ptr_bin);
syzstr->length = 1;
syzstr->minres[0] = idInit(1,arg->rank);
return syzstr;
}
//crit = 0;
//euler = -1;
syzstr->length = *length = (currRing->N)+2;
// Creare dp,S ring and change to it
syzstr->syRing = rAssure_dp_S(origR);
assume(syzstr->syRing != origR); // why?
rChangeCurrRing(syzstr->syRing);
// set initial ShiftedComps
currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
for (i=0;i<=arg->rank;i++)
{
currShiftedComponents[i] = (i)*SYZ_SHIFT_BASE;
currcomponents[i] = i;
}
rChangeSComps(currcomponents, currShiftedComponents, arg->rank, syzstr->syRing);
/*--- initializes the data structures---------------*/
syzstr->Tl = new intvec(*length);
temp = idInit(IDELEMS(arg),arg->rank);
for (i=0;i<IDELEMS(arg);i++)
{
temp->m[i] = prCopyR( arg->m[i], origR, syzstr->syRing);
if (temp->m[i]!=NULL)
{
j = pTotaldegree(temp->m[i]);
if (j<actdeg) actdeg = j;
}
}
idTest(temp);
idSkipZeroes(temp);
idTest(temp);
syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw);
omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
syzstr->elemLength = (int**)omAlloc0((*length+1)*sizeof(int*));
syzstr->truecomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
syzstr->ShiftedComponents = (long**)omAlloc0((*length+1)*sizeof(long*));
syzstr->backcomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
syzstr->Howmuch = (int**)omAlloc0((*length+1)*sizeof(int*));
syzstr->Firstelem = (int**)omAlloc0((*length+1)*sizeof(int*));
syzstr->sev = (unsigned long **) omAlloc0((*length+1)*sizeof(unsigned long *));
syzstr->bucket = kBucketCreate(currRing);
int len0=id_RankFreeModule(temp,currRing)+1;
nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
//if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
/*--- computes the resolution ----------------------*/
while (nextPairs!=NULL)
{
if (TEST_OPT_PROT) Print("%d",actdeg);
if (TEST_OPT_PROT) Print("(m%d)",index);
if (index==0)
i = syInitSyzMod(syzstr,index,len0);
else
i = syInitSyzMod(syzstr,index);
currcomponents = syzstr->truecomponents[si_max(index-1,0)];
currShiftedComponents = syzstr->ShiftedComponents[si_max(index-1,0)];
rChangeSComps(currcomponents, currShiftedComponents,
IDELEMS(syzstr->res[si_max(index-1,0)]), currRing);
j = syInitSyzMod(syzstr,index+1);
if (index>0)
{
syRedNextPairs(nextPairs,syzstr,howmuch,index);
syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
}
else
syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
/*--- creates new pairs -----------------------------*/
syCreateNewPairs(syzstr,index,i);
if (index<(*length)-1)
{
syCreateNewPairs(syzstr,index+1,j);
}
index++;
nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
//if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
}
if (temp!=NULL) idDelete(&temp);
kBucketDestroy(&(syzstr->bucket));
if (origR != syzstr->syRing)
rChangeCurrRing(origR);
if (TEST_OPT_PROT) PrintLn();
assume(syzstr->minres==NULL); assume(syzstr->fullres ==NULL);
assume(syzstr->resPairs!=NULL); assume(syzstr->hilb_coeffs==NULL);
assume(syzstr->res!=NULL);
if(! TEST_OPT_NO_SYZ_MINIM )
syzstr->minres = syReadOutMinimalRes(syzstr);
else
syzstr->fullres = syReorder(syzstr->res, syzstr->length, syzstr); // buggy? (betti...?)
return syzstr;
}
idHomModule
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition ideals.h:96
TEST_OPT_NO_SYZ_MINIM
#define TEST_OPT_NO_SYZ_MINIM
Definition options.h:126
syReadOutMinimalRes
static resolvente syReadOutMinimalRes(syStrategy syzstr, BOOLEAN computeStd=FALSE)
Definition syz1.cc:2312

## syLengthInt()

int syLengthInt | ( | int | i | ) |

static

Definition at line 1919 of file syz1.cc.

{
int j=0;
if (i==0) return 1;
while (i!=0)
{
j++;
i = i/10;
}
return j;
}

## syLinStrat()

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

static

Definition at line 649 of file syz1.cc.

{
int i=howmuch-1,i1=0,i2,i3,l,ll;
int ** Fin=syzstr->Firstelem;
int ** Hin=syzstr->Howmuch;
ideal o_r=syzstr->orderedRes[index+1];
intvec *result=new intvec(howmuch+1);
intvec *spl=new intvec(howmuch,1,-1);
BOOLEAN isDivisible;
SObject tso;
while (i>=0)
{
tso = nextPairs[i];
isDivisible = FALSE;
if (syzstr->res[index+1]!=NULL)
{
l = Fin[index][pGetComp(tso.lcm)]-1;
if (l>=0)
{
ll = l+Hin[index][pGetComp(tso.lcm)];
while ((l<ll) && (!isDivisible))
{
if (o_r->m[l]!=NULL)
{
isDivisible = isDivisible ||
pLmDivisibleByNoComp(o_r->m[l],tso.lcm);
}
l++;
}
}
}
if (isDivisible)
{
syDeletePair(&nextPairs[i]);
//crit++;
}
else
{
pTest(tso.p2);
pTest(tso.p1);
nextPairs[i].p =
ksOldCreateSpoly(tso.p2, tso.p1,NULL);
(*spl)[i] = pLength(nextPairs[i].p);
}
i--;
}
i3 = 0;
loop
{
i2 = -1;
for (i1=0;i1<howmuch;i1++)
{
if (i2==-1)
{
if ((*spl)[i1]!=-1)
{
i2 = i1;
}
}
else
{
if (((*spl)[i1]>=0) && ((*spl)[i1]<(*spl)[i2]))
{
i2 = i1;
}
}
}
if (i2>=0)
{
(*result)[i3] = i2+1;
(*spl)[i2] = -1;
i3++;
}
else
{
break;
}
}
delete spl;
return result;
}
ksOldCreateSpoly
KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
Definition kInline.h:1194
pLength
static int pLength(poly a)
Definition p_polys.h:190
syDeletePair
void syDeletePair(SObject *so)
Definition syz1.cc:44

## syMinimize()

syStrategy syMinimize | ( | syStrategy | syzstr | ) |

Definition at line 2393 of file syz1.cc.

{
if (syzstr->minres==NULL)
{
if (syzstr->resolution!=NULL)
{
// need to clear syzstr->resolution, as we are
// now displaying the minres instead of fullres
delete syzstr->resolution;
syzstr->resolution=NULL;
}
if (syzstr->resPairs!=NULL)
{
if (syzstr->hilb_coeffs==NULL)
{
// La Scala Resolution
syzstr->minres = syReadOutMinimalRes(syzstr);
}
else
{ // HRES
syzstr->minres = syReorder(syzstr->orderedRes,syzstr->length,syzstr);
}
}
else if (syzstr->fullres!=NULL)
{
syMinimizeResolvente(syzstr->fullres,syzstr->length,1);
syzstr->minres = syzstr->fullres;
syzstr->fullres = NULL;
}
}
(syzstr->references)++;
return syzstr;
}
syMinimizeResolvente
void syMinimizeResolvente(resolvente res, int length, int first)
Definition syz.cc:367

## syMinimizeP1()

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

static

Definition at line 2151 of file syz1.cc.

{
int ii=0,i,tc,lp,ltS=-1;
poly p,mp=NULL,pp;
SSet sPairs=syzstr->resPairs[index];
poly tempStripped=NULL;
pp = syStripOutCopy(syzstr->res[index+1]->m[toMin],toStrip);
kBucketInit(syzstr->bucket,pp,-1);
while ((ii<ordn->length()) && ((*ordn)[ii]!=-1) &&
(sPairs[(*ordn)[ii]].syzind!=toMin))
{
ii++;
}
while (ii>=0)
{
i = (*ordn)[ii];
if (sPairs[i].isNotMinimal!=NULL)
{
tempStripped =
syStripOutCopy(syzstr->res[index+1]->m[sPairs[i].syzind],toStrip);
tc = pGetComp(sPairs[i].isNotMinimal);
int lu;
pTakeOutComp(&tempStripped,tc,&p,&lu);
kBucketTakeOutComp(syzstr->bucket,tc,&mp,&lp);
mp = pDivideM(mp,p);
while (mp!=NULL)
{
p = pNext(mp);
pNext(mp) = NULL;
ltS = -1;
kBucket_Minus_m_Mult_p(syzstr->bucket,mp,tempStripped,&ltS);
pDelete(&mp);
mp = p;
}
pDelete(&mp);
pDelete(&tempStripped);
}
ii--;
}
kBucketClear(syzstr->bucket,&pp,&lp);
return pp;
}
pp
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676
kBucketClear
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition kbuckets.cc:521
kBucket_Minus_m_Mult_p
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
kBucketTakeOutComp
void kBucketTakeOutComp(kBucket_pt bucket, long comp, poly *r_p, int *l)
Definition kbuckets.cc:1032
kBucketInit
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition kbuckets.cc:493
pNext
#define pNext(p)
Definition monomials.h:36
pDivideM
#define pDivideM(a, b)
Definition polys.h:295
pTakeOutComp
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
syStripOutCopy
static poly syStripOutCopy(poly p, intvec *toStrip)
Definition syz1.cc:2066

## syOrder()

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

static

Definition at line 461 of file syz1.cc.

{
int i=IDELEMS(syzstr->res[index-1])+1,j=0,k,tc,orc,ie=realcomp-1;
int *trind1=syzstr->truecomponents[index-1];
int *trind=syzstr->truecomponents[index];
long *shind=syzstr->ShiftedComponents[index];
int *bc=syzstr->backcomponents[index];
int *F1=syzstr->Firstelem[index-1];
int *H1=syzstr->Howmuch[index-1];
polyset o_r=syzstr->orderedRes[index]->m;
BOOLEAN ret = FALSE;
// if != 0, then new element can go into same component
// i.e., we do not need to leave space in shifted components
long same_comp = 0;
if (p==NULL) return FALSE;
if (realcomp==0) realcomp=1;
if (index>1)
tc = trind1[pGetComp(p)]-1;
else
tc = pGetComp(p)-1;
loop //while ((j<ie) && (trind1[orc]<=tc+1))
{
if (j>=ie)
break;
else
{
orc = pGetComp(o_r[j]);
if (trind1[orc]>tc+1) break;
else if (trind1[orc] == tc+1)
{
same_comp = 1;
}
else
{
assume(same_comp == 0);
}
j += H1[orc];
}
}
if (j>ie)
{
WerrorS("orderedRes to small");
return FALSE;
}
ie++;
if (j == (ie -1))
{
// new element is the last in ordered module
if (same_comp == 0)
same_comp = SYZ_SHIFT_BASE;
// test whether we have enough space for new shifted component
if ((LONG_MAX - same_comp) <= shind[ie-1])
{
long new_space = syReorderShiftedComponents(shind, ie);
assume((LONG_MAX - same_comp) > shind[ie-1]);
ret = TRUE;
if (TEST_OPT_PROT) Print("(T%ld)", new_space);
}
// yes, then set new shifted component
assume(ie == 1 || shind[ie-1] > 0);
shind[ie] = shind[ie-1] + same_comp;
}
else
{
// new element must come in between
// i.e. at place j+1
long prev, next;
// test whether new component can get shifted value
prev = shind[j];
next = shind[j+1];
assume(next > prev);
if ((same_comp && prev + 2 >= next) || (!same_comp && next - prev < 4))
{
long new_space = syReorderShiftedComponents(shind, ie);
prev = shind[j];
next = shind[j+1];
assume((same_comp && prev + 2 < next) || (!same_comp && next - prev >= 4));
ret = TRUE;
if (TEST_OPT_PROT) Print("(B%ld)", new_space);
}
// make room for insertion of j+1 shifted component
for (k=ie; k > j+1; k--) shind[k] = shind[k-1];
if (same_comp)
{
// can simply add one
shind[j+1] = prev + 1;
assume(shind[j+1] + 1 < shind[j+2]);
}
else
{
// need to leave more breathing room - i.e. value goes in
// between
shind[j+1] = prev + ((next - prev) >> 1);
assume (shind[j] + 1 < shind[j+1] && shind[j+1] + 1 < shind[j+2]);
}
}
if (o_r[j]!=NULL)
{
for (k=ie-1;k>j;k--)
{
o_r[k] = o_r[k-1];
bc[k] = bc[k-1];
}
}
o_r[j] = p;
bc[j] = realcomp-1;
(H1[pGetComp(p)])++;
for (k=0;k<i;k++)
{
if (F1[k]>j)
(F1[k])++;
}
if (F1[pGetComp(p)]==0)
F1[pGetComp(p)]=j+1;
for (k=0;k<IDELEMS((syzstr->res)[index]);k++)
{
if (trind[k]>j)
trind[k] += 1;
}
for (k=IDELEMS((syzstr->res)[index])-1;k>realcomp;k--)
trind[k] = trind[k-1];
trind[realcomp] = j+1;
return ret;
}
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
next
ListNode * next
Definition janet.h:31
syReorderShiftedComponents
long syReorderShiftedComponents(long *sc, int n)
Definition syz1.cc:334

## syOrdPairs()

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

static

Definition at line 2274 of file syz1.cc.

{
intvec * result=new intvec(length,1,-1);
int i,j=0,k=-1,l,ii;
loop
{
l = -1;
for(i=0;i<length;i++)
{
if (sPairs[i].syzind>k)
{
if (l==-1)
{
l = sPairs[i].syzind;
ii = i;
}
else
{
if (sPairs[i].syzind<l)
{
l = sPairs[i].syzind;
ii = i;
}
}
}
}
if (l==-1) break;
(*result)[j] = ii;
j++;
k = l;
}
return result;
}

## syPrint()

void syPrint | ( | syStrategy | syzstr,
|  | const char * | sn )

Definition at line 1935 of file syz1.cc.

{
if ( (syzstr->resPairs==NULL) &&
(syzstr->fullres==NULL) &&
(syzstr->minres==NULL) &&
(syzstr->resolution == NULL) )
{
PrintS("No resolution defined\n");
return;
}
intvec* resolution = syzstr->resolution;
if (resolution==NULL)
{
if (syzstr->resPairs!=NULL)
{
resolution = new intvec(syzstr->length+1);
SRes rP = syzstr->resPairs;
// assume(idRankFreeModule(syzstr->res[1], (syzstr->syRing != NULL ? syzstr->syRing : currRing))==syzstr->res[1]->rank);
(*resolution)[0] = syzstr->res[1]->rank;
int k=0;
while ((k<syzstr->length) && (rP[k]!=NULL))
{
int j = 0;
while ((j<(*syzstr->Tl)[k]) &&
((rP[k][j].lcm!=NULL) || (rP[k][j].syz!=NULL)))
{
if (rP[k][j].isNotMinimal==NULL)
((*resolution)[k+1])++;
j++;
}
k++;
}
}
else
{
resolution = new intvec(syzstr->length+2);
resolvente rr;
if (syzstr->minres!=NULL)
rr = syzstr->minres;
else
rr = syzstr->fullres;
(*resolution)[0]
= si_max(1,(int)id_RankFreeModule(rr[0],
(syzstr->syRing != NULL ? syzstr->syRing : currRing)));
int k=0;
while ((k<syzstr->length) && (rr[k]!=NULL))
{
(*resolution)[k+1] = idElem(rr[k]);
k++;
}
}
}
int sl=strlen(sn);
syPrintEmptySpaces1(sl);
int k = 0;
loop
{
if ((k>=resolution->length()) || ((*resolution)[k]==0))
break;
Print("%d",(*resolution)[k]);
syPrintEmptySpaces1(sl+5);
k++;
}
PrintLn();
k = 0;
loop
{
if ((k>=resolution->length()) || ((*resolution)[k]==0))
break;
PrintS(sn);
if (((k+1)>=resolution->length()) || ((*resolution)[(k+1)]==0))
break;
PrintS(" <-- ");
syPrintEmptySpaces((*resolution)[k]);
k++;
}
PrintS("\n\n");
k = 0;
loop
{
if ((k>=resolution->length()) || ((*resolution)[k]==0))
break;
Print("%d",k);
syPrintEmptySpaces1(sl+5+syLengthInt((*resolution)[k])-
syLengthInt(k));
k++;
}
PrintLn();
if (syzstr->minres==NULL)
{
PrintS("resolution not minimized yet\n");
}
if (syzstr->resolution == NULL) syzstr->resolution = resolution;
}
idElem
static int idElem(const ideal F)
number of non-zero polys in F
Definition simpleideals.h:69
syLengthInt
static int syLengthInt(int i)
Definition syz1.cc:1919
syPrintEmptySpaces1
static void syPrintEmptySpaces1(int i)
Definition syz1.cc:1907
syPrintEmptySpaces
static void syPrintEmptySpaces(int i)
Definition syz1.cc:1895

## syPrintEmptySpaces()

void syPrintEmptySpaces | ( | int | i | ) |

static

Definition at line 1895 of file syz1.cc.

{
if (i!=0)
{
PrintS(" ");
syPrintEmptySpaces(i/10);
}
}

## syPrintEmptySpaces1()

void syPrintEmptySpaces1 | ( | int | i | ) |

static

Definition at line 1907 of file syz1.cc.

{
if (i!=0)
{
PrintS(" ");
syPrintEmptySpaces1(i-1);
}
}

## syReadOutMinimalRes()

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

static

Definition at line 2312 of file syz1.cc.

{
intvec * Strip, * ordn;
resolvente tres=(resolvente)omAlloc0((syzstr->length+1)*sizeof(ideal));
ring origR = currRing;
//Print("Hier ");
if (computeStd)
{
tres[0] = syzstr->res[1];
syzstr->res[1] = idInit(IDELEMS(tres[0]),tres[0]->rank);
return tres;
}
int i,l,index,i1;
SSet sPairs;
assume(syzstr->syRing != NULL);
rChangeCurrRing(syzstr->syRing);
//Print("laeufts ");
syzstr->bucket = kBucketCreate(syzstr->syRing);
for (index=syzstr->length-1;index>0;index--)
{
if (syzstr->resPairs[index]!=NULL)
{
//Print("ideal %d: \n",index);
currcomponents = syzstr->truecomponents[index];
currShiftedComponents = syzstr->ShiftedComponents[index];
rChangeSComps(currcomponents, currShiftedComponents,
IDELEMS(syzstr->res[index]), currRing);
sPairs = syzstr->resPairs[index];
Strip = syToStrip(syzstr,index);
tres[index+1] = idInit(IDELEMS(syzstr->res[index+1]),syzstr->res[index+1]->rank);
i1 = (*syzstr->Tl)[index];
//Print("i1= %d\n",i1);
ordn = syOrdPairs(sPairs,i1);
for (i=0;i<i1;i++)
{
if ((sPairs[i].isNotMinimal==NULL) && (sPairs[i].lcm!=NULL))
{
l = sPairs[i].syzind;
//Print("Minimiere Poly %d: ",l);pWrite(syzstr->res[index+1]->m[l]);
tres[index+1]->m[l] =
syMinimizeP1(l,syzstr,ordn,index,Strip);
}
}
delete Strip;
delete ordn;
Strip = NULL;
}
}
currcomponents = syzstr->truecomponents[0];
currShiftedComponents = syzstr->ShiftedComponents[0];
rChangeSComps( currcomponents, currShiftedComponents,
IDELEMS(syzstr->res[0]), currRing);
tres[1] = idInit(IDELEMS(syzstr->res[1]),syzstr->res[1]->rank);
sPairs = syzstr->resPairs[0];
for (i=(*syzstr->Tl)[0]-1;i>=0;i--)
{
if (sPairs[i].syzind>=0)
{
tres[1]->m[sPairs[i].syzind] = pCopy(syzstr->res[1]->m[sPairs[i].syzind]);
}
}
/*--- changes to the original ring------------------*/
kBucketDestroy(&syzstr->bucket);
if (syzstr->syRing != NULL)
{
rChangeCurrRing(origR);
// Thomas: now make sure that all data which you need is pFetchCopied
// maybe incorporate it into syReorder ??
}
tres = syReorder(tres,syzstr->length,syzstr,FALSE,syzstr->res);
syKillEmptyEntres(tres,syzstr->length);
idSkipZeroes(tres[0]);
return tres;
}
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
syOrdPairs
static intvec * syOrdPairs(SSet sPairs, int length)
Definition syz1.cc:2274
syMinimizeP1
static poly syMinimizeP1(int toMin, syStrategy syzstr, intvec *ordn, int index, intvec *toStrip)
Definition syz1.cc:2151
syToStrip
static intvec * syToStrip(syStrategy syzstr, int index)
Definition syz1.cc:2252

## syRedGenerOfCurrDeg()

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

static

Definition at line 915 of file syz1.cc.

{
ideal res=syzstr->res[index];
int i=0,j,k=IDELEMS(res);
SSet sPairs=syzstr->resPairs[index-1];
while ((k>0) && (res->m[k-1]==NULL)) k--;
while ((i<(*syzstr->Tl)[index-1]) && (((sPairs)[i].syz==NULL) ||
((sPairs)[i].order<deg)))
i++;
if ((i>=(*syzstr->Tl)[index-1]) || ((sPairs)[i].order>deg)) return;
while ((i<(*syzstr->Tl)[index-1]) && (((sPairs)[i].syz==NULL) ||
((sPairs)[i].order==deg)))
{
if ((sPairs)[i].syz!=NULL)
{
j = k-1;
while ((j>=0) && (res->m[j]!=NULL) &&
((sPairs)[i].syz!=NULL))
{
if (pLmDivisibleBy(res->m[j],(sPairs)[i].syz))
{
(sPairs)[i].syz =
ksOldSpolyRed(res->m[j],(sPairs)[i].syz);
//sySPolyRed((sPairs)[i].syz,res->m[j]);
j = k-1;
}
else
{
j--;
}
}
if ((sPairs)[i].syz != NULL)
{
if (k==IDELEMS(res))
{
syEnlargeFields(syzstr,index);
res=syzstr->res[index];
}
if (TEST_OPT_DEBUG)
{
if ((sPairs)[i].isNotMinimal==NULL)
{
PrintLn();
PrintS("minimal generator: ");pWrite((syzstr->resPairs[index-1])[i].syz);
PrintS("comes from: ");pWrite((syzstr->resPairs[index-1])[i].p1);
PrintS("and: ");pWrite((syzstr->resPairs[index-1])[i].p2);
}
}
//res->m[k] = (sPairs)[i].syz;
res->m[k] = syRedtail((sPairs)[i].syz,syzstr,index);
(sPairs)[i].syzind = k;
syzstr->elemLength[index][k] = pLength((sPairs)[i].syz);
pNorm(res->m[k]);
// (sPairs)[i].syz = NULL;
k++;
if (syOrder(res->m[k-1],syzstr,index,k))
syResetShiftedComponents(syzstr, index);
//euler++;
}
else
(sPairs)[i].syzind = -1;
}
i++;
}
}
ksOldSpolyRed
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition kInline.h:1174
TEST_OPT_DEBUG
#define TEST_OPT_DEBUG
Definition options.h:110
pNorm
void pNorm(poly p)
Definition polys.h:363
pLmDivisibleBy
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition polys.h:141
pWrite
void pWrite(poly p)
Definition polys.h:309
syRedtail
poly syRedtail(poly p, syStrategy syzstr, int index)
Definition syz1.cc:226
syEnlargeFields
void syEnlargeFields(syStrategy syzstr, int index)
Definition syz1.cc:734
syOrder
static BOOLEAN syOrder(poly p, syStrategy syzstr, int index, int realcomp)
Definition syz1.cc:461
syResetShiftedComponents
void syResetShiftedComponents(syStrategy syzstr, int index, int hilb)
Definition syz1.cc:409

## syRedNextPairs()

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

static

Definition at line 768 of file syz1.cc.

{
int i,j,k=IDELEMS(syzstr->res[index]);
int ks=IDELEMS(syzstr->res[index+1]);
int * Fin=syzstr->Firstelem[index-1];
int * Hin=syzstr->Howmuch[index-1];
int * bin=syzstr->backcomponents[index];
int * elL=syzstr->elemLength[index];
number coefgcd;
polyset redset=syzstr->orderedRes[index]->m;
poly p=NULL,q;
intvec *spl1;
SObject tso;
long * ShiftedComponents = syzstr->ShiftedComponents[index];
int* Components = syzstr->truecomponents[index];
assume(Components != NULL && ShiftedComponents != NULL);
BOOLEAN need_reset;
if ((nextPairs==NULL) || (howmuch==0)) return;
while ((k>0) && (syzstr->res[index]->m[k-1]==NULL)) k--;
while ((ks>0) && (syzstr->res[index+1]->m[ks-1]==NULL)) ks--;
spl1 = syLinStrat(nextPairs,syzstr,howmuch,index);
i=0;
while ((*spl1)[i]>0)
{
need_reset = FALSE;
tso = nextPairs[(*spl1)[i]-1];
if ((tso.p1!=NULL) && (tso.p2!=NULL))
{
nNormalize(pGetCoeff(tso.p1));
nNormalize(pGetCoeff(tso.p2));
coefgcd =
n_SubringGcd(pGetCoeff(tso.p1),pGetCoeff(tso.p2),currRing->cf);
tso.syz = pHead(tso.lcm);
p = tso.syz;
pSetCoeff(p,nDiv(pGetCoeff(tso.p1),coefgcd));
pGetCoeff(p) = nInpNeg(pGetCoeff(p));
pSetComp(p,tso.ind2+1);
p_Setm_Syz(p, currRing, Components, ShiftedComponents); // actueller index
pNext(p) = pHead(tso.lcm);
pIter(p);
pSetComp(p,tso.ind1+1);
p_Setm_Syz(p, currRing, Components, ShiftedComponents); // actueller index
pSetCoeff(p,nDiv(pGetCoeff(tso.p2),coefgcd));
nDelete(&coefgcd);
if (tso.p != NULL)
{
kBucketInit(syzstr->bucket,tso.p,-1);
q = kBucketGetLm(syzstr->bucket);
j = Fin[pGetComp(q)]-1;
int pos = j+Hin[pGetComp(q)];
loop
{
if (j<0) break;
if (pLmDivisibleByNoComp(redset[j],q))
{
pNext(p) = pHead(q);
pIter(p);
pSetComp(p,bin[j]+1);
p_Setm_Syz(p, currRing, Components, ShiftedComponents); // actueller index
//if (pLength(redset[j])!=syzstr->elemLength[index][bin[j]])
//Print("Halt");
//if (pLength(redset[j])!=syzstr->elemLength[index][bin[j]])
//Print("Halt");
pGetCoeff(p) = nInpNeg(pGetCoeff(p));
number up = kBucketPolyRed(syzstr->bucket,redset[j],elL[bin[j]],
NULL);
// Thomas: Check whether you need number here
nDelete(&up);
q = kBucketGetLm(syzstr->bucket);
if (q==NULL) break;
j = Fin[pGetComp(q)]-1;
pos = j+Hin[pGetComp(q)];
}
else
{
j++;
if (j==pos) break;
}
}
int lb;
kBucketClear(syzstr->bucket,&tso.p,&lb);
}
if (tso.p != NULL)
{
if (TEST_OPT_PROT) PrintS("g");
if (k==IDELEMS((syzstr->res)[index]))
{
syEnlargeFields(syzstr,index);
bin=syzstr->backcomponents[index];
elL=syzstr->elemLength[index];
redset=syzstr->orderedRes[index]->m;
Components = syzstr->truecomponents[index];
ShiftedComponents = syzstr->ShiftedComponents[index];
}
pNext(p) = pHead(tso.p);
pIter(p);
assume(p!= NULL);
k++;
syzstr->res[index]->m[k-1] = tso.p;
syzstr->elemLength[index][k-1] = pLength(tso.p);
pNorm(syzstr->res[index]->m[k-1]);
need_reset = syOrder(syzstr->res[index]->m[k-1],syzstr,index,k);
pSetComp(p,k); // actueller index
p_Setm_Syz(p, currRing, Components, ShiftedComponents);
pGetCoeff(p) = nInpNeg(pGetCoeff(p));
tso.isNotMinimal = p;
tso.p = NULL;
}
else
{
if (TEST_OPT_PROT) PrintS(".");
//if (index % 2==0)
//euler++;
//else
//euler--;
}
if (ks==IDELEMS(syzstr->res[index+1]))
{
syEnlargeFields(syzstr,index+1);
}
syzstr->res[index+1]->m[ks] = tso.syz;
syzstr->elemLength[index+1][ks] = pLength(tso.syz);
pNorm(syzstr->res[index+1]->m[ks]);
tso.syz =NULL;
tso.syzind = ks;
if (need_reset)
syResetShiftedComponents(syzstr, index+1);
if (syOrder(syzstr->res[index+1]->m[ks],syzstr,index+1,ks+1))
syResetShiftedComponents(syzstr, index+2);
ks++;
p = NULL;
nextPairs[(*spl1)[i]-1] = tso;
}
i++;
}
delete spl1;
}
n_SubringGcd
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition coeffs.h:669
kBucketPolyRed
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition kbuckets.cc:1071
kBucketGetLm
const poly kBucketGetLm(kBucket_pt bucket)
Definition kbuckets.cc:506
kBucket::p
poly p
Definition kbuckets.h:186
pGetCoeff
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
nDiv
#define nDiv(a, b)
Definition numbers.h:32
nDelete
#define nDelete(n)
Definition numbers.h:16
nInpNeg
#define nInpNeg(n)
Definition numbers.h:21
nNormalize
#define nNormalize(n)
Definition numbers.h:30
pHead
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
pSetCoeff
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition polys.h:32
syLinStrat
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.

{
poly h, hn;
int j,pos;
ideal redWith=syzstr->orderedRes[index];
h = p;
hn = pNext(h);
while(hn != NULL)
{
j = syzstr->Firstelem[index-1][pGetComp(hn)]-1;
if (j>=0)
{
pos = j+syzstr->Howmuch[index-1][pGetComp(hn)];
while (j < pos)
{
if (pLmDivisibleByNoComp(redWith->m[j], hn))
{
//hn = sySPolyRed(hn,redWith->m[j]);
hn = ksOldSpolyRed(redWith->m[j],hn);
if (hn == NULL)
{
pNext(h) = NULL;
return p;
}
j = syzstr->Firstelem[index-1][pGetComp(hn)]-1;
pos = j+syzstr->Howmuch[index-1][pGetComp(hn)];
}
else
{
j++;
}
}
}
h = pNext(h) = hn;
hn = pNext(h);
}
return p;
}
h
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.

{
int i,j,l;
polyset ri1;
resolvente fullres;
ring origR=syzstr->syRing;
fullres = (resolvente)omAlloc0((length+1)*sizeof(ideal));
if (totake==NULL)
totake = res;
for (i=length-1;i>0;i--)
{
if (res[i]!=NULL)
{
if (i>1)
{
j = IDELEMS(res[i-1]);
while ((j>0) && (res[i-1]->m[j-1]==NULL)) j--;
fullres[i-1] = idInit(IDELEMS(res[i]),j);
ri1 = totake[i-1]->m;
for (j=IDELEMS(res[i])-1;j>=0;j--)
{
sBucket_pt bucket = sBucketCreate(currRing);
poly p = res[i]->m[j];
while (p!=NULL)
{
poly tq;
if (toCopy)
{
if (origR!=NULL)
tq = prHeadR(p,origR, currRing);
else
tq = pHead(p);
pIter(p);
}
else
{
res[i]->m[j] = NULL;
if (origR!=NULL)
{
poly pp=p;
pIter(p);
pNext(pp)=NULL;
tq = prMoveR(pp, origR, currRing);
}
else
{
tq = p;
pIter(p);
pNext(tq) = NULL;
}
}
// pWrite(tq);
pTest(tq);
for (l=(currRing->N);l>0;l--)
{
if (origR!=NULL)
pSubExp(tq,l, p_GetExp(ri1[pGetComp(tq)-1],l,origR));
else
pSubExp(tq,l, pGetExp(ri1[pGetComp(tq)-1],l));
}
pSetm(tq);
pTest(tq);
sBucket_Add_m(bucket,tq);
}
int l_dummy;
sBucketClearMerge(bucket, &(fullres[i-1]->m[j]), &l_dummy);
sBucketDestroy(&bucket);
}
}
else
{
if (origR!=NULL)
{
fullres[i-1] = idInit(IDELEMS(res[i]),res[i]->rank);
for (j=IDELEMS(res[i])-1;j>=0;j--)
{
if (toCopy)
fullres[i-1]->m[j] = prCopyR(res[i]->m[j], origR, currRing);
else
{
fullres[i-1]->m[j] = prMoveR(res[i]->m[j], origR, currRing);
res[i]->m[j] = NULL;
}
}
}
else
{
if (toCopy)
fullres[i-1] = idCopy(res[i]);
else
{
fullres[i-1] = res[i];
res[i] = NULL;
}
}
for (j=IDELEMS(fullres[i-1])-1;j>=0;j--)
fullres[i-1]->m[j] = pSortCompCorrect(fullres[i-1]->m[j]);
}
if (!toCopy)
{
if (res[i]!=NULL) idDelete(&res[i]);
}
}
}
if (!toCopy)
omFreeSize((ADDRESS)res,(length+1)*sizeof(ideal));
//syzstr->length = length;
return fullres;
}
m
int m
Definition cfEzgcd.cc:128
idCopy
ideal idCopy(ideal A)
Definition ideals.h:60
p_GetExp
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
pGetExp
#define pGetExp(p, i)
Exponent.
Definition polys.h:42
pSubExp
#define pSubExp(p, i, v)
Definition polys.h:47
pSortCompCorrect
#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
prMoveR
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition prCopy.cc:90
prHeadR
poly prHeadR(poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition prCopy.cc:126
sBucketClearMerge
void sBucketClearMerge(sBucket_pt bucket, poly *p, int *length)
Definition sbuckets.cc:237
sBucketDestroy
void sBucketDestroy(sBucket_pt *bucket)
Definition sbuckets.cc:103
sBucket_Add_m
void sBucket_Add_m(sBucket_pt bucket, poly p)
Definition sbuckets.cc:173
sBucketCreate
sBucket_pt sBucketCreate(const ring r)
Definition sbuckets.cc:96
sBucket_pt
sBucket * sBucket_pt
Definition sbuckets.h:16

## syReorderShiftedComponents()

long syReorderShiftedComponents | ( | long * | sc,
|  | int | n )

Definition at line 334 of file syz1.cc.

{
long holes = 0;
int i;
long new_comps = 0, new_space, max;
// count number of holes
for (i=1; i<n; i++)
{
if (sc[i-1] + 1 < sc[i]) holes++;
}
if (LONG_MAX - SYZ_SHIFT_BASE <= sc[n-1])
{
// need new components
new_comps = (((long) 1) << SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE) - 1;
max = LONG_MAX;
}
else
{
max = sc[n-1] + SYZ_SHIFT_BASE;
}
// no we arrange things such that
// (n - holes) + holes*new_space + new_comps*SYZ_SHIFT_BASE= LONG_MAX
new_space = (max - n + holes - new_comps*SYZ_SHIFT_BASE) / holes;
assume(new_space < SYZ_SHIFT_BASE && new_space >= 4);
long* tc = ( long*) omAlloc(n*sizeof(long));
tc[0] = sc[0];
// rearrange things
for (i=1; i<n; i++)
{
if (sc[i-1] + 1 < sc[i])
{
tc[i] = tc[i-1] + new_space;
}
else
{
tc[i] = tc[i-1] + 1;
}
assume(tc[i] > tc[i-1]);
}
assume(LONG_MAX - SYZ_SHIFT_BASE > tc[n-1]);
#ifndef SING_NDEBUG
for (i=1; i<n; i++)
{
assume(tc[i] >= 0);
assume(tc[i-1] + 1 <= tc[i]);
}
#endif
memcpy(sc, tc, n*sizeof(long));
omFreeSize(tc, n*sizeof(long));
return new_space;
}
max
static int max(int a, int b)
Definition fast_mult.cc:264
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE
#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.

{
assume(index > 0);
int i;
if (syzstr->res[index] != NULL)
{
long * prev_s;
int* prev_c;
int p_length;
rGetSComps(&prev_c, &prev_s, &p_length, currRing);
currcomponents = syzstr->truecomponents[index-1];
currShiftedComponents = syzstr->ShiftedComponents[index-1];
rChangeSComps(currcomponents,
currShiftedComponents,
IDELEMS(syzstr->res[index-1]), currRing);
if (hilb==0)
{
ideal id = syzstr->res[index];
for (i=0; i<IDELEMS(id); i++)
{
pResetSetm(id->m[i]);
}
}
else if (hilb==1)
{
assume (index>1);
assume (syzstr->resPairs[index-1]!=NULL);
SSet Pairs=syzstr->resPairs[index-1];
SSet Pairs1=syzstr->resPairs[index];
int till=(*syzstr->Tl)[index-1];
for (i=0;i<till;i++)
{
if (Pairs[i].syz!=NULL)
pResetSetm(Pairs[i].syz);
}
till=(*syzstr->Tl)[index];
for (i=0;i<till;i++)
{
if (Pairs1[i].p!=NULL)
pResetSetm(Pairs1[i].p);
}
}
currcomponents = prev_c;
currShiftedComponents = prev_s;
rChangeSComps(prev_c, prev_s, p_length, currRing);
}
}
rGetSComps
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
Definition ring.cc:4506
pResetSetm
static void pResetSetm(poly p)
Definition syz1.cc:394

## sySize()

int sySize | ( | syStrategy | syzstr | ) |

Definition at line 1830 of file syz1.cc.

{
resolvente r=syzstr->res;
if (r==NULL)
r = syzstr->fullres;
if (r==NULL)
r = syzstr->minres;
if (r==NULL)
{
WerrorS("No resolution found");
return 0;
}
int i=syzstr->length;
while ((i>0) && (r[i-1]==NULL)) i--;
return i;
}

## syStripOutCopy()

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

static

Definition at line 2066 of file syz1.cc.

{
if (toStrip==NULL) return pCopy(p);
poly result=NULL,pp;
while (p!=NULL)
{
if ((*toStrip)[pGetComp(p)]==0)
{
if (result==NULL)
{
result = pp = pHead(p);
}
else
{
pNext(pp) = pHead(p);
pIter(pp);
}
}
pIter(p);
}
return result;
}

## syToStrip()

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

static

Definition at line 2252 of file syz1.cc.

{
intvec * result=NULL;
if ((syzstr->resPairs[index-1]!=NULL) && (!idIs0(syzstr->res[index])))
{
result=new intvec(IDELEMS(syzstr->res[index])+1);
for (int i=(*syzstr->Tl)[index-1]-1;i>=0;i--)
{
if (syzstr->resPairs[index-1][i].isNotMinimal!=NULL)
{
(*result)[syzstr->resPairs[index-1][i].syzind+1] = 1;
}
}
}
return result;
}

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