MCPcopy Create free account
hub / github.com/Singular/Singular / id_sat_vars_sp

Function id_sat_vars_sp

kernel/ideals.cc:3211–3322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3209STATIC_VAR int * id_satstdSaturatingVariables=NULL;
3210
3211static BOOLEAN id_sat_vars_sp(kStrategy strat)
3212{
3213 BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed,
3214 // let it remain FALSE otherwise
3215 if (strat->P.t_p==NULL)
3216 {
3217 poly p=strat->P.p;
3218
3219 // iterate over all terms of p and
3220 // compute the minimum mm of all exponent vectors
3221 int *mm=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
3222 int *m0=(int*)omAlloc0((1+rVar(currRing))*sizeof(int));
3223 p_GetExpV(p,mm,currRing);
3224 bool nonTrivialSaturationToBeDone=true;
3225 for (; p!=NULL; pIter(p))
3226 {
3227 nonTrivialSaturationToBeDone=false;
3228 p_GetExpV(p,m0,currRing);
3229 for (int i=rVar(currRing); i>0; i--)
3230 {
3231 if (id_satstdSaturatingVariables[i]!=0)
3232 {
3233 mm[i]=si_min(mm[i],m0[i]);
3234 if (mm[i]>0) nonTrivialSaturationToBeDone=true;
3235 }
3236 else mm[i]=0;
3237 }
3238 // abort if the minimum is zero in each component
3239 if (!nonTrivialSaturationToBeDone) break;
3240 }
3241 if (nonTrivialSaturationToBeDone)
3242 {
3243 // std::cout << "simplifying!" << std::endl;
3244 if (TEST_OPT_PROT) { PrintS("S"); mflush(); }
3245 p=p_Copy(strat->P.p,currRing);
3246 //pWrite(p);
3247 // for (int i=rVar(currRing); i>0; i--)
3248 // if (mm[i]!=0) Print("x_%d:%d ",i,mm[i]);
3249 //PrintLn();
3250 strat->P.Init(strat->tailRing);
3251 //memset(&strat->P,0,sizeof(strat->P));
3252 //strat->P.tailRing = strat->tailRing; // done by Init
3253 strat->P.p=p;
3254 while(p!=NULL)
3255 {
3256 for (int i=rVar(currRing); i>0; i--)
3257 {
3258 p_SubExp(p,i,mm[i],currRing);
3259 }
3260 p_Setm(p,currRing);
3261 pIter(p);
3262 }
3263 b = TRUE;
3264 }
3265 omFree(mm);
3266 omFree(m0);
3267 }
3268 else

Callers

nothing calls this directly

Calls 10

rVarFunction · 0.85
omAlloc0Function · 0.85
p_GetExpVFunction · 0.85
si_minFunction · 0.85
PrintSFunction · 0.85
p_CopyFunction · 0.85
p_SubExpFunction · 0.85
p_SetmFunction · 0.85
GetPMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected