Loading...
Searching...
No Matches
kstdfac.cc
Go to the documentation of this file.
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT - Kernel: factorizing alg. of Buchberger
*/
#include "kernel/mod2.h"
#include "misc/options.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/kutil.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/khstd.h"
#include "polys/weight.h"
#include "misc/intvec.h"
#include "polys/clapsing.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/kstdfac.h"
VAR int strat_nr=0;
/*3
* copy o->T to n->T, assumes that n->S is already copied
*/
static void copyT (kStrategy o,kStrategy n)
{
int i,j;
poly p;
TSet t=(TSet)omAlloc0(o->tmax*sizeof(TObject));
TObject** r = (TObject**)omAlloc0(o->tmax*sizeof(TObject*));
for (j=0; j<=o->tl; j++)
{
t[j] = o->T[j];
r[t[j].i_r] = &t[j];
p = o->T[j].p;
i = -1;
loop
{
i++;
if (i>o->sl)
{
t[j].p=pCopy(p);
break;
}
if (p == o->S[i])
{
t[j].p=n->S[i];
break;
}
}
t[j].t_p = NULL; // ?? or t[j].p ??
t[j].max_exp = NULL; // ?? or p_GetMaxExpP(t[j].t_p,o->tailRing); ??
t[j].pLength = pLength(p);
}
n->T=t;
n->R=r;
}
/*3
* copy o->L to n->L, assumes that n->T,n->tail is already copied
*/
static void copyL (kStrategy o,kStrategy n)
{
int i,j;
poly p;
LSet l=(LSet)omAlloc(o->Lmax*sizeof(LObject));
for (j=0; j<=o->Ll; j++)
{
l[j] = o->L[j];
// copy .p ----------------------------------------------
if (pNext(o->L[j].p)!=o->tail)
l[j].p=pCopy(o->L[j].p);
else
{
l[j].p=p_LmInit(o->L[j].p,currRing);
if (pGetCoeff(o->L[j].p)!=NULL) pSetCoeff0(l[j].p,nCopy(pGetCoeff(o->L[j].p)));
pNext(l[j].p)=n->tail;
}
// copy .lcm ----------------------------------------------
if (o->L[j].lcm!=NULL)
l[j].lcm=pLmInit(o->L[j].lcm);
else
l[j].lcm=NULL;
l[j].p1=NULL;
l[j].p2=NULL;
l[j].t_p = NULL;
// copy .p1 , i_r1----------------------------------------------
p = o->L[j].p1;
i = -1;
loop
{
if(p==NULL) break;
i++;
if(i>o->tl)
{
WarnS("poly p1 not found in T:");wrp(p);PrintLn();
l[j].p1=pCopy(p);
l[j].i_r1=-1;
break;
}
if (p == o->T[i].p)
{
l[j].p1=n->T[i].p;
l[j].i_r1=n->T[i].i_r;
break;
}
}
// copy .p2 , i_r2----------------------------------------------
p = o->L[j].p2;
i = -1;
loop
{
if(p==NULL) break;
i++;
if(i>o->tl)
{
WarnS("poly p2 not found in T:");wrp(p);PrintLn();
l[j].p2=pCopy(p);
l[j].i_r2=-1;
break;
}
if (p == o->T[i].p)
{
l[j].p2=n->T[i].p;
l[j].i_r2=n->T[i].i_r;
break;
}
}
// copy .ecart ---------------------------------------------
l[j].ecart=o->L[j].ecart;
// copy .length --------------------------------------------
l[j].length=o->L[j].length;
// copy .pLength -------------------------------------------
l[j].pLength=o->L[j].pLength;
// copy .sev -----------------------------------------------
l[j].sev=o->L[j].sev;
l[j].i_r = o->L[j].i_r;
//l[j].i_r1 = o->L[j].i_r1;
//l[j].i_r2 = o->L[j].i_r2;
}
n->L=l;
}
kStrategy kStratCopy(kStrategy o)
{
// int i;
kTest_TS(o);
kStrategy s=new skStrategy;
s->next=NULL;
s->red=o->red;
s->initEcart=o->initEcart;
s->posInT=o->posInT;
s->posInL=o->posInL;
s->enterS=o->enterS;
s->initEcartPair=o->initEcartPair;
s->posInLOld=o->posInLOld;
s->enterOnePair=o->enterOnePair;
s->chainCrit=o->chainCrit;
s->Shdl=idCopy(o->Shdl);
s->S=s->Shdl->m;
s->tailRing = o->tailRing;
if (o->D!=NULL) s->D=idCopy(o->D);
else s->D=NULL;
s->ecartS=(int *)omAlloc(IDELEMS(o->Shdl)*sizeof(int));
memcpy(s->ecartS,o->ecartS,IDELEMS(o->Shdl)*sizeof(int));
s->sevS=(unsigned long *)omAlloc(IDELEMS(o->Shdl)*sizeof(unsigned long));
memcpy(s->sevS,o->sevS,IDELEMS(o->Shdl)*sizeof(unsigned long));
s->S_2_R=(int*)omAlloc(IDELEMS(o->Shdl)*sizeof(int));
memcpy(s->S_2_R,o->S_2_R,IDELEMS(o->Shdl)*sizeof(int));
s->sevT=(unsigned long *)omAlloc(o->tmax*sizeof(unsigned long));
memcpy(s->sevT,o->sevT,o->tmax*sizeof(unsigned long));
if(o->fromQ!=NULL)
{
s->fromQ=(int *)omAlloc(IDELEMS(o->Shdl)*sizeof(int));
memcpy(s->fromQ,o->fromQ,IDELEMS(o->Shdl)*sizeof(int));
}
else
s->fromQ=NULL;
copyT(o,s);//s->T=...
s->tail = pInit();
copyL(o,s);//s->L=...
s->B=initL();
s->kNoether=pCopy(o->kNoether);
if (o->NotUsedAxis!=NULL)
{
s->NotUsedAxis=(BOOLEAN *)omAlloc(currRing->N*sizeof(BOOLEAN));
memcpy(s->NotUsedAxis,o->NotUsedAxis,currRing->N*sizeof(BOOLEAN));
}
//s->P=s->L[s->Ll+1];
s->P.Init(o->tailRing);
s->update=o->update;
s->posInLOldFlag=o->posInLOldFlag;
s->kModW = o->kModW;
// if (o->kModW!=NULL)
// s->kModW=ivCopy(o->kModW);
// else
// s->kModW=NULL;
s->pairtest=NULL;
s->sl=o->sl;
s->mu=o->mu;
s->tl=o->tl;
s->tmax=o->tmax;
s->Ll=o->Ll;
s->Lmax=o->Lmax;
s->Bl=-1;
s->Bmax=setmaxL;
s->ak=o->ak;
s->syzComp=o->syzComp;
s->LazyPass=o->LazyPass;
s->LazyDegree=o->LazyDegree;
s->lastAxis=o->lastAxis;
s->interpt=o->interpt;
s->homog=o->homog;
s->news=o->news;
s->newt=o->newt;
s->kAllAxis=o->kAllAxis;
s->honey=o->honey;
s->sugarCrit=o->sugarCrit;
s->Gebauer=o->Gebauer;
s->noTailReduction=o->noTailReduction;
s->fromT=o->fromT;
s->noetherSet=o->noetherSet;
#ifdef HAVE_PLURAL
s->no_prod_crit=o->no_prod_crit;
#endif
kTest_TS(s);
return s;
}
BOOLEAN k_factorize(poly p,ideal &rfac, ideal &fac_copy)
{
int facdeg=currRing->pFDeg(p,currRing);
ideal fac=singclap_factorize(pCopy(p),NULL,1,currRing);
int fac_elems;
fac_elems=IDELEMS(fac);
rfac=fac;
fac_copy=idInit(fac_elems,1);
if ((fac_elems!=1)||(facdeg!=currRing->pFDeg(fac->m[0],currRing)))
{
if (TEST_OPT_DEBUG)
{
Print("%d factors:\n",fac_elems);
pWrite(p); PrintS(" ->\n");
int ii=fac_elems;
while(ii>0) { ii--;pWrite(fac->m[ii]); }
}
else if (TEST_OPT_PROT)
{
int ii=fac_elems;
if (ii>1)
{
while(ii>0) { PrintS("F"); ii--; }
}
}
return TRUE;
}
else
{
pDelete(&(fac->m[0]));
fac->m[0]=pCopy(p);
}
return FALSE;
}
static void completeReduceFac (kStrategy strat, ideal_list FL)
{
int si;
strat->noTailReduction = FALSE;
if (TEST_OPT_PROT)
{
PrintLn();
// if (timerv) writeTime("standard base computed:");
}
if (TEST_OPT_PROT)
{
Print("(S:%d)",strat->sl);mflush();
}
for (si=strat->sl; si>0; si--)
{
strat->S[si] = redtailBba(strat->S[si],si-1,strat);
if (TEST_OPT_INTSTRATEGY)
{
strat->S[si]=p_Cleardenom(strat->S[si], currRing);
}
if (TEST_OPT_PROT)
{
PrintS("-");mflush();
}
int i;
if (strat->redTailChange)
{
for(i=strat->tl;i>=0;i--)
{
strat->initEcart(&strat->T[i]);
}
}
ideal fac;
ideal fac_copy;
if (!k_factorize(strat->S[si],fac,fac_copy))
{
idDelete(&fac);
idDelete(&fac_copy);
continue;
}
deleteInS(si,strat);
for(i=IDELEMS(fac)-1;i>=0;i--)
{
kStrategy n=strat;
if (i>=1)
{
n=kStratCopy(strat); // includes: memset(&n->P,0,sizeof(n->P));
n->next=strat->next;
strat->next=n;
}
else
{
n->P.Init(strat->tailRing);
}
n->P.p=fac->m[i];
//n->P.pLength=pLength(n->P.p); // by initEcart
n->initEcart(&n->P);
/* enter P.p into s and L */
int pos;
if (n->sl==-1) pos=0;
else pos=posInS(n,n->sl,n->P.p,n->P.ecart);
if (TEST_OPT_INTSTRATEGY)
{
n->P.p = redtailBba(n->P.p,pos-1,n);
n->P.pCleardenom();
}
else
{
pNorm(n->P.p);
n->P.p = redtailBba(n->P.p,pos-1,n);
}
n->P.pLength=pLength(n->P.p);
if (TEST_OPT_DEBUG)
{
Print("new s(%d)->S:",n->nr);
pWrite(n->P.p);
}
enterpairs(n->P.p,n->sl,n->P.ecart,pos,n);
enterT(&n->P,n);
n->enterS(&n->P,pos,n, n->tl);
/* construct D */
if (IDELEMS(fac)>1)
{
if (n->D==NULL)
{
n->D=idCopy(fac_copy);
idSkipZeroes(n->D);
}
else
{
idTest(n->D);
ideal r=idAdd(n->D,fac_copy);
idDelete(&n->D);
n->D=r;
}
if (TEST_OPT_DEBUG)
{
Print("new s(%d)->D:\n",n->nr);
iiWriteMatrix((matrix)n->D,"D",1,currRing,0);
PrintLn();
}
}
fac_copy->m[i]=pCopy(fac->m[i]);
fac->m[i]=NULL;
/* check for empty sets */
if (n->D!=NULL)
{
int j=IDELEMS(n->D)-1;
while(j>=0)
{
if (n->D->m[j]!=NULL)
{
poly r=kNF(n->Shdl,NULL,n->D->m[j],0,KSTD_NF_LAZY | KSTD_NF_NONORM);
if (r==NULL)
{
if (TEST_OPT_DEBUG)
{
Print("empty set s(%d) because D[%d]:",n->nr,j);
pWrite(n->D->m[j]);
messageSets(n);
}
while (n->Ll >= 0) deleteInL(n->L,&n->Ll,n->Ll,n);
while (n->tl >= 0)
{
int i=n->sl;
while (i>=0)
{
if (n->S[i]==n->T[n->tl].p)
{
n->T[n->tl].p=NULL; n->S[i]=NULL;
break;
}
i--;
}
pDelete(&n->T[n->tl].p);
n->tl--;
}
memset(n->Shdl->m,0,IDELEMS(n->Shdl)*sizeof(poly));
n->sl=-1;
if (strat==n) si=-1;
break;
}
else
{
pDelete(&r);
}
}
j--;
}
}
/* check for empty sets */
{
ideal_list Lj=FL;
while (Lj!=NULL)
{
if ((n->sl>=0)&&(n->S[0]!=NULL))
{
ideal r=kNF(n->Shdl,NULL,Lj->d,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
if (idIs0(r))
{
if (TEST_OPT_DEBUG)
{
Print("empty set because:L[%p]\n",(void *)Lj);
iiWriteMatrix((matrix)Lj->d,"L",1,currRing,0);
}
while (n->Ll >= 0) deleteInL(n->L,&n->Ll,n->Ll,n);
while (n->tl >= 0)
{
int i=n->sl;
while (i>=0)
{
if (n->S[i]==n->T[n->tl].p)
{
n->T[n->tl].p=NULL; n->S[i]=NULL;
break;
}
i--;
}
pDelete(&n->T[n->tl].p);
n->tl--;
}
memset(n->Shdl->m,0,IDELEMS(n->Shdl)*sizeof(poly));
n->sl=-1;
if (strat==n) si=-1;
idDelete(&r);
break;
}
idDelete(&r);
}
Lj=Lj->next;
}
}
} /* for */
for(i=0;i<IDELEMS(fac);i++) fac->m[i]=NULL;
idDelete(&fac);
idDelete(&fac_copy);
if ((strat->Ll>=0) && (strat->sl>=0)) break;
else si=strat->sl+1;
}
}
ideal bbafac (ideal /*F*/, ideal Q,intvec* /*w*/,kStrategy strat, ideal_list FL)
{
int olddeg,reduc=0;
int red_result = 1;
reduc = olddeg = 0;
/* compute------------------------------------------------------- */
if ((strat->Ll==-1) && (strat->sl>=0))
{
if (TEST_OPT_REDSB) completeReduceFac(strat,FL);
}
kTest_TS(strat);
while (strat->Ll >= 0)
{
if (TEST_OPT_DEBUG) messageSets(strat);
if (strat->Ll== 0) strat->interpt=TRUE;
if (TEST_OPT_DEGBOUND
&& ((strat->honey
&& (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
|| ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
{
/*
*stops computation if
* 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
*a predefined number Kstd1_deg
*/
while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
break;
}
/* picks the last element from the lazyset L */
strat->P = strat->L[strat->Ll];
strat->Ll--;
if (pNext(strat->P.p) == strat->tail)
{
/* deletes the short spoly and computes */
pLmFree(strat->P.p);
/* the real one */
strat->P.p = ksOldCreateSpoly(strat->P.p1,
strat->P.p2,
strat->kNoether);
}
if (strat->honey)
{
if (TEST_OPT_PROT)
message(strat->P.ecart+currRing->pFDeg(strat->P.p,currRing),&olddeg,&reduc,strat, red_result);
}
else
{
if (TEST_OPT_PROT)
message(currRing->pFDeg(strat->P.p,currRing),&olddeg,&reduc,strat, red_result);
}
/* reduction of the element chosen from L */
kTest_TS(strat);
red_result = strat->red(&strat->P,strat);
if (strat->P.p != NULL)
{
/* statistic */
if (TEST_OPT_PROT) PrintS("s");
ideal fac;
ideal fac_copy;
if (!k_factorize(strat->P.p,fac,fac_copy))
{
if (TEST_OPT_INTSTRATEGY)
{
strat->P.p = redtailBba(strat->P.p,strat->sl,strat);
if (strat->redTailChange) strat->P.pCleardenom();
}
else
{
pNorm(strat->P.p);
strat->P.p = redtailBba(strat->P.p,strat->sl,strat);
}
if (strat->redTailChange)
{
idDelete(&fac);
idDelete(&fac_copy);
if (!k_factorize(strat->P.p,fac,fac_copy))
{
pDelete(&(fac->m[0]));
fac->m[0]=strat->P.p;
strat->P.p=NULL;
}
else
{
pDelete(&strat->P.p);
}
}
}
kDeleteLcm(&strat->P);
int i;
for(i=IDELEMS(fac)-1;i>=0;i--)
{
int ii;
kStrategy n=strat;
if (i>=1)
{
n=kStratCopy(strat); // includes memset(&n->P,0,sizeof(n->P));
kTest_TS(n);
n->next=strat->next;
strat->next=n;
}
else
{
n->P.Init(strat->tailRing);
}
n->P.p=fac->m[i];
//n->P.pLength=pLength(n->P.p); // by initEcart
n->initEcart(&n->P);
kTest_TS(n);
/* enter P.p into s and L */
int pos;
if (n->sl==-1) pos=0;
else pos=posInS(n,n->sl,n->P.p,n->P.ecart);
// we have already reduced all elements from fac....
if (TEST_OPT_INTSTRATEGY)
{
n->P.p = redtailBba(n->P.p,pos-1,n);
if (n->redTailChange)
{
n->P.pCleardenom();
n->P.pLength=pLength(n->P.p);
}
}
else
{
pNorm(n->P.p);
n->P.p = redtailBba(n->P.p,pos-1,n);
if (n->redTailChange)
{
n->P.pLength=pLength(n->P.p);
}
}
kTest_TS(n);
if (TEST_OPT_DEBUG)
{
PrintS("new s:");
wrp(n->P.p);
PrintLn();
}
enterpairs(n->P.p,n->sl,n->P.ecart,pos,n);
enterT(&n->P,n);
n->enterS(&n->P,pos,n, n->tl);
{
int i=n->Ll;
for(;i>=0;i--)
{
n->L[i].i_r1= -1;
for(ii=0; ii<=n->tl; ii++)
{
if (n->R[ii]->p==n->L[i].p1) { n->L[i].i_r1=ii;break; }
}
n->L[i].i_r2= -1;
for(ii=0; ii<=n->tl; ii++)
{
if (n->R[ii]->p==n->L[i].p2) { n->L[i].i_r2=ii;break; }
}
}
}
kTest_TS(n);
/* construct D */
if (IDELEMS(fac)>1)
{
if (n->D==NULL)
{
n->D=idCopy(fac_copy);
idSkipZeroes(n->D);
}
else
{
idTest(n->D);
ideal r=idAdd(n->D,fac_copy);
idDelete(&n->D);
n->D=r;
}
if (TEST_OPT_DEBUG)
{
PrintS("new D:\n");
iiWriteMatrix((matrix)n->D,"D",1,currRing,0);
PrintLn();
}
}
fac_copy->m[i]=pCopy(fac->m[i]);
fac->m[i]=NULL;
/* check for empty sets */
if (n->D!=NULL)
{
int j=IDELEMS(n->D)-1;
while(j>=0)
{
if (n->D->m[j]!=NULL)
{
poly r=kNF(n->Shdl,NULL,n->D->m[j],0,
KSTD_NF_LAZY | KSTD_NF_NONORM | KSTD_NF_NOLF);
if (r==NULL)
{
if (TEST_OPT_DEBUG)
{
Print("empty set s(%d) because: D[%d]:", n->nr,j);
pWrite(n->D->m[j]);
messageSets(n);
}
//if (n->Ll >=0) Print("Ll:%d|",n->Ll);
while (n->Ll >= 0) deleteInL(n->L,&n->Ll,n->Ll,n);
//if (n->tl >=0) Print("tl:%d|",n->tl);
while (n->tl >= 0)
{
int i=n->sl;
while (i>=0)
{
if (n->S[i]==n->T[n->tl].p)
{
n->T[n->tl].p=NULL; n->S[i]=NULL;
break;
}
i--;
}
pDelete(&n->T[n->tl].p);
n->tl--;
}
memset(n->Shdl->m,0,IDELEMS(n->Shdl)*sizeof(poly));
n->sl=-1;
break;
}
else
{
pDelete(&r);
}
}
j--;
}
}
/* check for empty sets */
{
ideal_list Lj=FL;
while (Lj!=NULL)
{
if ((n->sl>=0)&&(n->S[0]!=NULL))
{
ideal r=kNF(n->Shdl,NULL,Lj->d,0,
KSTD_NF_LAZY | KSTD_NF_NONORM | KSTD_NF_NOLF);
if (idIs0(r))
{
if (TEST_OPT_DEBUG)
{
#ifdef KDEBUG
Print("empty set s(%d) because:L[%d]\n",n->nr,Lj->nr);
#else
Print("empty set s(%d) because:\n",n->nr);
#endif
iiWriteMatrix((matrix)Lj->d,"L",1,currRing,0);
}
while (n->Ll >= 0) deleteInL(n->L,&n->Ll,n->Ll,n);
while (n->tl >= 0)
{
int i=n->sl;
while (i>=0)
{
if (n->S[i]==n->T[n->tl].p)
{
n->T[n->tl].p=NULL; n->S[i]=NULL;
break;
}
i--;
}
pDelete(&n->T[n->tl].p);
n->tl--;
}
memset(n->Shdl->m,0,IDELEMS(n->Shdl)*sizeof(poly));
n->sl=-1;
idDelete(&r);
break;
}
idDelete(&r);
}
Lj=Lj->next;
}
}
} /* for */
for(i=0;i<IDELEMS(fac);i++) fac->m[i]=NULL;
idDelete(&fac);
idDelete(&fac_copy);
}
#ifdef KDEBUG
strat->P.lcm=NULL;
#endif
kTest_TS(strat);
if ((strat->Ll==-1) && (strat->sl>=0))
{
if (TEST_OPT_REDSB) completeReduceFac(strat,FL);
}
kTest_TS(strat);
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG) messageSets(strat);
#endif
/* complete reduction of the standard basis--------- */
/* release temp data-------------------------------- */
if (TEST_OPT_WEIGHTM)
{
pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
if (ecartWeights)
{
omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
ecartWeights=NULL;
}
}
exitBuchMora(strat);
if (TEST_OPT_PROT) { PrintLn(); messageStat(0,strat); }
if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
return (strat->Shdl);
}
ideal_list kStdfac(ideal F, ideal Q, tHomog h,intvec ** w,ideal D)
{
ideal r;
BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
BOOLEAN delete_w=(w==NULL);
kStrategy strat=new skStrategy;
kStrategy orgstrat=strat;
ideal_list L=NULL;
if (rField_has_simple_inverse(currRing))
strat->LazyPass=20;
else
strat->LazyPass=2;
strat->LazyDegree = 1;
strat->ak = id_RankFreeModule(F,currRing);
if (h==testHomog)
{
if (strat->ak==0)
{
h = (tHomog)idHomIdeal(F,Q);
w=NULL;
}
else
h = (tHomog)idHomModule(F,Q,w);
}
if (h==isHomog)
{
if ((w!=NULL) && (*w!=NULL))
{
kModW = *w;
strat->kModW = *w;
strat->pOrigFDeg = currRing->pFDeg;
strat->pOrigLDeg = currRing->pLDeg;
pSetDegProcs(currRing,kModDeg);
toReset = TRUE;
}
currRing->pLexOrder = TRUE;
strat->LazyPass*=2;
}
strat->homog=h;
initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
initBuchMoraPos(strat);
initBba(strat);
initBuchMora(F, Q,strat);
if (D!=NULL)
{
strat->D=idCopy(D);
}
// Ende der Initalisierung
while (strat!=NULL)
{
if (TEST_OPT_DEBUG)
PrintS("====================================\n");
if (w!=NULL)
r=bbafac(F,Q,*w,strat,L);
else
r=bbafac(F,Q,NULL,strat,L);
#ifdef KDEBUG
int i;
for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]);
#endif
idSkipZeroes(r);
// Testausgabe:
//if (!idIs0(r))
//{
// PrintS("===================================================\n");
// iiWriteMatrix((matrix)r,"S",1,currRing,0);
// PrintS("\n===================================================\n");
//}
//else
//{
// PrintS("=========empty============================\n");
//}
if(!idIs0(r))
{
ideal_list LL=(ideal_list)omAlloc(sizeof(*LL));
LL->d=r;
#ifndef SING_NDEBUG
LL->nr=strat->nr;
#endif
LL->next=L;
L=LL;
}
strat=strat->next;
}
/* check for empty sets */
if (L!=NULL)
{
ideal_list Lj=L->next;
ideal_list Lj_prev=L;
while (Lj!=NULL)
{
ideal_list Li=L;
while(Li!=Lj)
{
ideal r=kNF(Lj->d,NULL,Li->d,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
if (idIs0(r))
{
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
Print("empty set L[%p] because:L[%p]\n",(void*)Lj,(void*)Li);
}
#endif
// delete L[j],
Li=L;
if (Lj_prev!=NULL)
{
Lj=Lj_prev;
if (Lj==L) Lj_prev=NULL;
else
{
Lj_prev=L;
while(Lj_prev->next!=Lj) Lj_prev=Lj_prev->next;
}
}
else Lj=NULL;
}
else
{
Li=Li->next;
}
idDelete (&r);
}
if (Lj!=NULL) Lj=Lj->next;
}
}
// Ende: aufraeumen
if (toReset)
{
pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
kModW = NULL;
}
currRing->pLexOrder = b;
delete(strat);
strat=orgstrat;
while (strat!=NULL)
{
orgstrat=strat->next;
delete(strat);
strat=orgstrat;
}
if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
return L;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
l
int l
Definition cfEzgcd.cc:100
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111
singclap_factorize
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition clapsing.cc:983
clapsing.h
intvec
Definition intvec.h:24
skStrategy
Definition kutil.h:276
skStrategy::next
kStrategy next
Definition kutil.h:278
skStrategy::kModW
intvec * kModW
Definition kutil.h:334
skStrategy::syzComp
int syzComp
Definition kutil.h:353
skStrategy::S_2_R
int * S_2_R
Definition kutil.h:341
skStrategy::tailRing
ring tailRing
Definition kutil.h:342
skStrategy::chainCrit
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:290
skStrategy::D
ideal D
Definition kutil.h:303
skStrategy::noTailReduction
char noTailReduction
Definition kutil.h:375
skStrategy::posInLOldFlag
char posInLOldFlag
Definition kutil.h:379
skStrategy::Ll
int Ll
Definition kutil.h:350
skStrategy::T
TSet T
Definition kutil.h:325
skStrategy::news
char news
Definition kutil.h:397
skStrategy::ecartS
intset ecartS
Definition kutil.h:308
skStrategy::honey
char honey
Definition kutil.h:374
skStrategy::S
polyset S
Definition kutil.h:305
skStrategy::kNoether
poly kNoether
Definition kutil.h:328
skStrategy::NotUsedAxis
BOOLEAN * NotUsedAxis
Definition kutil.h:331
skStrategy::ak
int ak
Definition kutil.h:352
skStrategy::R
TObject ** R
Definition kutil.h:339
skStrategy::lastAxis
int lastAxis
Definition kutil.h:354
skStrategy::tl
int tl
Definition kutil.h:349
skStrategy::sevT
unsigned long * sevT
Definition kutil.h:324
skStrategy::nr
int nr
Definition kutil.h:345
skStrategy::tail
poly tail
Definition kutil.h:333
skStrategy::sugarCrit
char sugarCrit
Definition kutil.h:374
skStrategy::posInL
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:283
skStrategy::Shdl
ideal Shdl
Definition kutil.h:302
skStrategy::pOrigFDeg
pFDegProc pOrigFDeg
Definition kutil.h:295
skStrategy::tmax
int tmax
Definition kutil.h:349
skStrategy::posInLOld
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition kutil.h:287
skStrategy::initEcartPair
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:286
skStrategy::enterS
void(* enterS)(LObject *h, int pos, kStrategy strat, int atR)
Definition kutil.h:285
skStrategy::kAllAxis
char kAllAxis
Definition kutil.h:373
skStrategy::noetherSet
char noetherSet
Definition kutil.h:377
skStrategy::Gebauer
char Gebauer
Definition kutil.h:375
skStrategy::fromQ
intset fromQ
Definition kutil.h:320
skStrategy::newt
char newt
Definition kutil.h:398
skStrategy::mu
int mu
Definition kutil.h:347
skStrategy::interpt
char interpt
Definition kutil.h:368
skStrategy::redTailChange
char redTailChange
Definition kutil.h:396
skStrategy::fromT
char fromT
Definition kutil.h:376
skStrategy::initEcart
void(* initEcart)(TObject *L)
Definition kutil.h:281
skStrategy::P
LObject P
Definition kutil.h:301
skStrategy::Lmax
int Lmax
Definition kutil.h:350
skStrategy::LazyPass
int LazyPass
Definition kutil.h:352
skStrategy::no_prod_crit
char no_prod_crit
Definition kutil.h:391
skStrategy::enterOnePair
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.h:289
skStrategy::L
LSet L
Definition kutil.h:326
skStrategy::posInT
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition kutil.h:282
skStrategy::red
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
skStrategy::sl
int sl
Definition kutil.h:347
skStrategy::LazyDegree
int LazyDegree
Definition kutil.h:352
skStrategy::sevS
unsigned long * sevS
Definition kutil.h:321
skStrategy::homog
char homog
Definition kutil.h:369
skStrategy::pOrigLDeg
pLDegProc pOrigLDeg
Definition kutil.h:296
skStrategy::update
char update
Definition kutil.h:378
Print
#define Print
Definition emacs.cc:80
WarnS
#define WarnS
Definition emacs.cc:78
s
const CanonicalForm int s
Definition facAbsFact.cc:51
w
const CanonicalForm & w
Definition facAbsFact.cc:51
j
int j
Definition facHensel.cc:110
D
#define D(A)
Definition gentable.cc:128
VAR
#define VAR
Definition globaldefs.h:5
ideals.h
idDelete
#define idDelete(H)
delete an ideal
Definition ideals.h:29
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition simpleideals.cc:960
idHomModule
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition ideals.h:96
idTest
#define idTest(id)
Definition ideals.h:47
idHomIdeal
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition ideals.h:91
idCopy
ideal idCopy(ideal A)
Definition ideals.h:60
idAdd
ideal idAdd(ideal h1, ideal h2)
h1 + h2
Definition ideals.h:68
intvec.h
h
STATIC_VAR Poly * h
Definition janet.cc:971
ksOldCreateSpoly
KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
Definition kInline.h:1194
redtailBba
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition kInline.h:1212
khstd.h
kModDeg
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2411
initBba
void initBba(kStrategy strat)
Definition kstd1.cc:1690
kModW
VAR intvec * kModW
Definition kstd1.cc:2409
kNF
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3229
kstd1.h
KSTD_NF_LAZY
#define KSTD_NF_LAZY
Definition kstd1.h:18
Kstd1_deg
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
KSTD_NF_NONORM
#define KSTD_NF_NONORM
Definition kstd1.h:22
KSTD_NF_NOLF
#define KSTD_NF_NOLF
Definition kstd1.h:26
copyL
static void copyL(kStrategy o, kStrategy n)
Definition kstdfac.cc:63
completeReduceFac
static void completeReduceFac(kStrategy strat, ideal_list FL)
Definition kstdfac.cc:271
kStratCopy
kStrategy kStratCopy(kStrategy o)
Definition kstdfac.cc:149
kStdfac
ideal_list kStdfac(ideal F, ideal Q, tHomog h, intvec **w, ideal D)
Definition kstdfac.cc:800
copyT
static void copyT(kStrategy o, kStrategy n)
Definition kstdfac.cc:25
k_factorize
BOOLEAN k_factorize(poly p, ideal &rfac, ideal &fac_copy)
Definition kstdfac.cc:235
bbafac
ideal bbafac(ideal, ideal Q, intvec *, kStrategy strat, ideal_list FL)
Definition kstdfac.cc:480
strat_nr
VAR int strat_nr
Definition kstdfac.cc:21
kstdfac.h
initBuchMora
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9749
message
void message(int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
Definition kutil.cc:7463
kTest_TS
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1067
enterpairs
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4487
initBuchMoraPos
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9580
exitBuchMora
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9837
posInS
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4663
enterT
void enterT(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:9143
updateResult
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10051
deleteInL
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1208
initBuchMoraCrit
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9435
messageSets
void messageSets(kStrategy strat)
Definition kutil.cc:7536
deleteInS
void deleteInS(int i, kStrategy strat)
Definition kutil.cc:1132
messageStat
void messageStat(int hilbcount, kStrategy strat)
Definition kutil.cc:7504
kutil.h
TSet
TObject * TSet
Definition kutil.h:60
setmaxL
#define setmaxL
Definition kutil.h:31
initL
static LSet initL(int nr=setmaxL)
Definition kutil.h:417
LSet
LObject * LSet
Definition kutil.h:61
kDeleteLcm
static void kDeleteLcm(LObject *P)
Definition kutil.h:876
TObject
class sTObject TObject
Definition kutil.h:58
LObject
class sLObject LObject
Definition kutil.h:59
iiWriteMatrix
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition matpol.cc:828
matrix
ip_smatrix * matrix
Definition matpol.h:43
mod2.h
pNext
#define pNext(p)
Definition monomials.h:36
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
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
nCopy
#define nCopy(n)
Definition numbers.h:15
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12
options.h
TEST_OPT_WEIGHTM
#define TEST_OPT_WEIGHTM
Definition options.h:123
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition options.h:112
TEST_OPT_REDSB
#define TEST_OPT_REDSB
Definition options.h:106
TEST_OPT_DEGBOUND
#define TEST_OPT_DEGBOUND
Definition options.h:115
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition options.h:105
TEST_OPT_DEBUG
#define TEST_OPT_DEBUG
Definition options.h:110
pRestoreDegProcs
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3774
p_Cleardenom
poly p_Cleardenom(poly p, const ring r)
Definition p_polys.cc:2893
pSetDegProcs
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition p_polys.cc:3762
pLength
static int pLength(poly a)
Definition p_polys.h:190
p_LmInit
static poly p_LmInit(poly p, const ring r)
Definition p_polys.h:1356
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
polys.h
Compatibility layer for legacy polynomial operations (over currRing).
pTest
#define pTest(p)
Definition polys.h:415
pDelete
#define pDelete(p_ptr)
Definition polys.h:187
pNorm
void pNorm(poly p)
Definition polys.h:363
pLmInit
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition polys.h:65
wrp
void wrp(poly p)
Definition polys.h:311
pLmFree
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition polys.h:71
pWrite
void pWrite(poly p)
Definition polys.h:309
pInit
#define pInit()
allocates a new monomial and initializes everything to 0
Definition polys.h:62
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314
mflush
#define mflush()
Definition reporter.h:58
rField_has_simple_inverse
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition ring.h:554
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
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
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
Q
#define Q
Definition sirandom.c:26
tHomog
tHomog
Definition structs.h:31
isHomog
@ isHomog
Definition structs.h:33
testHomog
@ testHomog
Definition structs.h:34
kStrategy
skStrategy * kStrategy
Definition structs.h:54
loop
#define loop
Definition structs.h:71
weight.h
ecartWeights
EXTERN_VAR short * ecartWeights
Definition weight.h:12