Macros | Typedefs | Functions | Variables
gb_hack.h File Reference

Go to the source code of this file.

Macros

#define STR_EXPAND(tok)   #tok
 
#define D(A)   A{ WerrorS("This is a hack. Function is not defined: " STR_EXPAND(A) ); return NULL; (void)(_currRing); }
 

Typedefs

typedef polyrec * poly
 
typedef skStrategykStrategy
 
typedef ideal(* GB_Proc_Ptr) (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring)
 

Functions

ideal gnc_gr_bba (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)
 
ideal gnc_gr_mora (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)
 
ideal sca_gr_bba (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)
 Modified Plural's Buchberger's algorithmus. More...
 
ideal sca_bba (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)
 Modified modern Sinuglar Buchberger's algorithm. More...
 
ideal sca_mora (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)
 Modified modern Sinuglar Mora's algorithm. More...
 
poly kNF (ideal, ideal, poly, int, int, const ring _currRing)
 NOTE: this is just a wrapper which sets currRing for the actual kNF call. More...
 
void WerrorS (const char *)
 
 D (ideal sca_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing))D(ideal sca_bba(const ideal
 Modified Plural's Buchberger's algorithmus. More...
 

Variables

const ideal
 
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
 

Macro Definition Documentation

#define D (   A )    A{ WerrorS("This is a hack. Function is not defined: " STR_EXPAND(A) ); return NULL; (void)(_currRing); }

Definition at line 39 of file gb_hack.h.

#define STR_EXPAND (   tok)    #tok

Definition at line 38 of file gb_hack.h.

Typedef Documentation

typedef ideal(* GB_Proc_Ptr) (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring)

Definition at line 15 of file gb_hack.h.

Definition at line 14 of file gb_hack.h.

Definition at line 8 of file gb_hack.h.

Function Documentation

const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing D ( ideal   sca_gr_bbaconst ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing) const

Modified Plural's Buchberger's algorithmus.

Modified modern Sinuglar Mora's algorithm.

Modified modern Sinuglar Buchberger's algorithm.

ideal gnc_gr_bba ( const ideal  ,
const ideal  ,
const intvec ,
const intvec ,
kStrategy  ,
const ring  _currRing 
)

Definition at line 1052 of file gr_kstd2.cc.

1053 {
1054  const ring save = currRing; if( currRing != _currRing ) rChangeCurrRing(_currRing);
1055 
1056 #if MYTEST
1057  PrintS("<gnc_gr_bba>\n");
1058 #endif
1059 
1060 #ifdef HAVE_PLURAL
1061 #if MYTEST
1062  PrintS("currRing: \n");
1063  rWrite(currRing);
1064 #ifdef RDEBUG
1066 #endif
1067 
1068  PrintS("F: \n");
1069  idPrint(F);
1070  PrintS("Q: \n");
1071  idPrint(Q);
1072 #endif
1073 #endif
1074 
1075  assume(currRing->OrdSgn != -1); // no mora!!! it terminates only for global ordering!!! (?)
1076 
1077  // intvec *w=NULL;
1078  // intvec *hilb=NULL;
1079  int olddeg,reduc;
1080  int red_result=1;
1081  int /*hilbeledeg=1,*/hilbcount=0/*,minimcnt=0*/;
1082 
1083  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1084  // initHilbCrit(F,Q,&hilb,strat);
1085  /* in plural we don't need Hilb yet */
1086  nc_gr_initBba(F,strat);
1088  if (rIsRatGRing(currRing))
1089  {
1090  strat->posInL=posInL0; // by pCmp of lcm
1091  }
1092  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1093  /*Shdl=*/initBuchMora(F, Q,strat);
1095  reduc = olddeg = 0;
1096 
1097  /* compute------------------------------------------------------- */
1098  while (strat->Ll >= 0)
1099  {
1101 
1102  if (strat->Ll== 0) strat->interpt=TRUE;
1103  if (TEST_OPT_DEGBOUND
1104  && ((strat->honey
1105  && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1106  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
1107  {
1108  /*
1109  *stops computation if
1110  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
1111  *a predefined number Kstd1_deg
1112  */
1113  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1114  break;
1115  }
1116  /* picks the last element from the lazyset L */
1117  strat->P = strat->L[strat->Ll];
1118  strat->Ll--;
1119  //kTest(strat);
1120 
1121  if (strat->P.p != NULL)
1122  if (pNext(strat->P.p) == strat->tail)
1123  {
1124  /* deletes the short spoly and computes */
1125  pLmFree(strat->P.p);
1126  /* the real one */
1127 // if (ncRingType(currRing)==nc_lie) /* prod crit */
1128 // if(pHasNotCF(strat->P.p1,strat->P.p2))
1129 // {
1130 // strat->cp++;
1131 // /* prod.crit itself in nc_CreateSpoly */
1132 // }
1133 
1134 
1135  if( ! rIsRatGRing(currRing) )
1136  {
1137  strat->P.p = nc_CreateSpoly(strat->P.p1,strat->P.p2,currRing);
1138  }
1139 #ifdef HAVE_RATGRING
1140  else
1141  {
1142  /* rational case */
1143  strat->P.p = nc_rat_CreateSpoly(strat->P.p1,strat->P.p2,currRing->real_var_start-1,currRing);
1144  }
1145 #endif
1146 
1147 
1148 #ifdef PDEBUG
1149  p_Test(strat->P.p, currRing);
1150 #endif
1151 
1152 #if MYTEST
1153  if (TEST_OPT_DEBUG)
1154  {
1155  PrintS("p1: "); pWrite(strat->P.p1);
1156  PrintS("p2: "); pWrite(strat->P.p2);
1157  PrintS("SPoly: "); pWrite(strat->P.p);
1158  }
1159 #endif
1160  }
1161 
1162 
1163  if (strat->P.p != NULL)
1164  {
1165  if (TEST_OPT_PROT)
1166  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
1167  &olddeg,&reduc,strat, red_result);
1168 
1169 #if MYTEST
1170  if (TEST_OPT_DEBUG)
1171  {
1172  PrintS("p1: "); pWrite(strat->P.p1);
1173  PrintS("p2: "); pWrite(strat->P.p2);
1174  PrintS("SPoly before: "); pWrite(strat->P.p);
1175  }
1176 #endif
1177 
1178  /* reduction of the element chosen from L */
1179  strat->red(&strat->P,strat);
1180 
1181 #if MYTEST
1182  if (TEST_OPT_DEBUG)
1183  {
1184  PrintS("red SPoly: "); pWrite(strat->P.p);
1185  }
1186 #endif
1187  }
1188  if (strat->P.p != NULL)
1189  {
1190  if (TEST_OPT_PROT)
1191  {
1192  PrintS("s\n");
1193  }
1194  /* enter P.p into s and L */
1195  {
1196 /* quick unit detection in the rational case */
1197 #ifdef HAVE_RATGRING
1198  if( rIsRatGRing(currRing) )
1199  {
1200  if ( p_LmIsConstantRat(strat->P.p, currRing) )
1201  {
1202 #ifdef PDEBUG
1203  Print("unit element detected:");
1204  p_wrp(strat->P.p,currRing);
1205 #endif
1206  p_Delete(&strat->P.p,currRing, strat->tailRing);
1207  strat->P.p = pOne();
1208  }
1209  }
1210 #endif
1211  strat->P.sev=0;
1212  int pos=posInS(strat,strat->sl,strat->P.p, strat->P.ecart);
1213  {
1215  {
1216  if ((strat->syzComp==0)||(!strat->homog))
1217  {
1218  #ifdef HAVE_RATGRING
1219  if(!rIsRatGRing(currRing))
1220  #endif
1221  strat->P.p = redtailBba(strat->P.p,pos-1,strat);
1222  }
1223 
1224  strat->P.p=p_Cleardenom(strat->P.p, currRing);
1225  }
1226  else
1227  {
1228  pNorm(strat->P.p);
1229  if ((strat->syzComp==0)||(!strat->homog))
1230  {
1231  strat->P.p = redtailBba(strat->P.p,pos-1,strat);
1232  }
1233  }
1234  if (TEST_OPT_DEBUG)
1235  {
1236  PrintS("new s:"); wrp(strat->P.p);
1237  PrintLn();
1238 #if MYTEST
1239  Print("s: "); pWrite(strat->P.p);
1240 #endif
1241 
1242  }
1243  // kTest(strat);
1244  //
1245  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat);
1246 
1247  if (strat->sl==-1) pos=0;
1248  else pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
1249 
1250  strat->enterS(strat->P,pos,strat,-1);
1251  }
1252 // if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1253  }
1254  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
1255  }
1256 #ifdef KDEBUG
1257  strat->P.lcm=NULL;
1258 #endif
1259  //kTest(strat);
1260  }
1261  if (TEST_OPT_DEBUG) messageSets(strat);
1262 
1263  /* complete reduction of the standard basis--------- */
1264  if (TEST_OPT_SB_1)
1265  {
1266  int k=1;
1267  int j;
1268  while(k<=strat->sl)
1269  {
1270  j=0;
1271  loop
1272  {
1273  if (j>=k) break;
1274  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
1275  j++;
1276  }
1277  k++;
1278  }
1279  }
1280 
1281  if (TEST_OPT_REDSB)
1282  completeReduce(strat);
1283  /* release temp data-------------------------------- */
1284  exitBuchMora(strat);
1285 // if (TEST_OPT_WEIGHTM)
1286 // {
1287 // currRing->pFDeg=pFDegOld;
1288 // currRing->pLDeg=pLDegOld;
1289 // if (ecartWeights)
1290 // {
1291 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
1292 // ecartWeights=NULL;
1293 // }
1294 // }
1295  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
1296  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
1297 
1298 
1299 #ifdef PDEBUG
1300 /* for counting number of pairs [enterL] in Plural */
1301 /* extern int zaehler; */
1302 /* Print("Total pairs considered:%d\n",zaehler); zaehler=0; */
1303 #endif /*PDEBUG*/
1304 
1305 #if MYTEST
1306  PrintS("</gnc_gr_bba>\n");
1307 #endif
1308 
1309  if( currRing != save ) rChangeCurrRing(save);
1310 
1311  return (strat->Shdl);
1312 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void nc_gr_initBba(ideal F, kStrategy strat)
nc_gr_initBba is needed for sca_gr_bba and gr_bba.
Definition: gr_kstd2.cc:972
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:7466
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7558
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3671
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
void rDebugPrint(ring r)
Definition: ring.cc:3971
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
BOOLEAN interpt
Definition: kutil.h:365
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define idPrint(id)
Definition: ideals.h:62
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4568
LObject P
Definition: kutil.h:300
poly nc_rat_CreateSpoly(poly pp1, poly pp2, int ishift, const ring r)
Definition: ratgring.cc:341
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
#define pOne()
Definition: polys.h:286
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define p_Test(p, r)
Definition: p_polys.h:160
void rChangeCurrRing(ring r)
Definition: polys.cc:14
kStrategy strat
Definition: myNF.cc:319
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
BOOLEAN p_LmIsConstantRat(const poly p, const ring r)
Definition: ratgring.cc:643
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
#define TEST_OPT_SB_1
Definition: options.h:113
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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:70
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
static poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
Definition: nc.h:258
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
void wrp(poly p)
Definition: polys.h:281
int Kstd1_deg
Definition: kutil.cc:228
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
static bool rIsRatGRing(const ring r)
Definition: ring.h:366
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:7637
ideal gnc_gr_mora ( const ideal  ,
const ideal  ,
const intvec ,
const intvec ,
kStrategy  ,
const ring  _currRing 
)

Definition at line 1314 of file gr_kstd2.cc.

1315 {
1316 #ifndef SING_NDEBUG
1317  // Not yet!
1318  WarnS("Sorry, non-commutative mora is not yet implemented!");
1319 #endif
1320 
1321  return gnc_gr_bba(F, Q, NULL, NULL, strat, _currRing);
1322 }
ideal gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Definition: gr_kstd2.cc:1052
#define Q
Definition: sirandom.c:25
#define WarnS
Definition: emacs.cc:81
kStrategy strat
Definition: myNF.cc:319
#define NULL
Definition: omList.c:10
poly kNF ( ideal  ,
ideal  ,
poly  ,
int  ,
int  ,
const ring  _currRing 
)

NOTE: this is just a wrapper which sets currRing for the actual kNF call.

Definition at line 2698 of file kstd1.cc.

2699 {
2700  const ring save = currRing; if( currRing != _currRing ) rChangeCurrRing(_currRing);
2701  poly ret = kNF(F, Q, p, syzComp, lazyReduce);
2702  if( currRing != save ) rChangeCurrRing(save);
2703  return ret;
2704 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2598
return P p
Definition: myNF.cc:203
#define Q
Definition: sirandom.c:25
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
polyrec * poly
Definition: hilb.h:10
void rChangeCurrRing(ring r)
Definition: polys.cc:14
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
ideal sca_bba ( const ideal  ,
const ideal  ,
const intvec ,
const intvec ,
kStrategy  ,
const ring  _currRing 
)

Modified modern Sinuglar Buchberger's algorithm.

Definition at line 375 of file sca.cc.

376 {
377  const ring save = currRing;
378  if( currRing != _currRing ) rChangeCurrRing(_currRing);
379  assume( currRing == _currRing );
380 
381 #if MYTEST
382  PrintS("\n\n<sca_bba>\n\n");
383 #endif
384 
386 
387 #ifndef SING_NDEBUG
388  idTest(F);
389  idTest(Q);
390 #endif
391 
392 #if MYTEST
393  PrintS("\ncurrRing: \n");
394  rWrite(currRing);
395 #ifdef RDEBUG
396 // rDebugPrint(currRing);
397 #endif
398 
399  PrintS("\n\nF: \n");
400  idPrint(F);
401  PrintS("\n\nQ: \n");
402  idPrint(Q);
403 
404  PrintLn();
405 #endif
406 
407 
408  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
409  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
410 
411  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
412 
413  ideal tempQ = Q;
414 
415  if(Q == currRing->qideal)
416  tempQ = SCAQuotient(currRing);
417 
418  // Q or tempQ will not be used below :(((
419 
420 
421 #if MYTEST
422 
423  PrintS("tempF: \n");
424  idPrint(tempF);
425  PrintS("tempQ: \n");
426  idPrint(tempQ);
427 #endif
428 
429  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
430  // redo no_prod_crit:
431  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
432  strat->no_prod_crit = ! bIsSCA;
433 
434 // strat->homog = strat->homog && strat->z2homog; // ?
435 
436  int red_result = 1;
437  int olddeg, reduc;
438 
439 // int hilbeledeg = 1, minimcnt = 0;
440  int hilbcount = 0;
441 
442  BOOLEAN withT = FALSE;
443 
444  initBuchMoraCrit(strat); // sets Gebauer, honey, sugarCrit // sca - ok???
445  initBuchMoraPos(strat); // sets strat->posInL, strat->posInT // check!! (Plural's: )
446 
447 // initHilbCrit(F, Q, &hilb, strat);
448 
449 // nc_gr_initBba(F,strat);
450  initBba(tempF, strat); // set enterS, red, initEcart, initEcartPair
451 
452  // set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair
453  // ?? set spSpolyShort, reduce ???
454  initBuchMora(tempF, tempQ, strat); // tempQ = Q without squares!!!
455 
456 // if (strat->minim>0) strat->M = idInit(IDELEMS(F),F->rank);
457 
458  reduc = olddeg = 0;
459 
460 #define NO_BUCKETS
461 
462 #ifndef NO_BUCKETS
464  strat->use_buckets = 1;
465 #endif
466 
467  // redtailBBa against T for inhomogenous input
468  if (!TEST_OPT_OLDSTD)
469  withT = ! strat->homog;
470 
471  // strat->posInT = posInT_pLength;
472  kTest_TS(strat);
473 
474 #undef HAVE_TAIL_RING
475 
476 #ifdef HAVE_TAIL_RING
477  if(!idIs0(F) &&(!rField_is_Ring())) // create strong gcd poly computes with tailring and S[i] ->to be fixed
479 #endif
480  if (BVERBOSE(23))
481  {
485  }
486 
487 
488  ///////////////////////////////////////////////////////////////
489  // SCA:
490 
491  // due to std( SB, p).
492  // Note that after initBuchMora :: initSSpecial all these additional
493  // elements are in S and T (and some pairs are in L, which also has no initiall
494  // elements!!!)
495  if(TEST_OPT_SB_1)
496  {
497  // For all additional elements...
498  for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
499  {
500  const poly pSave = tempF->m[iNewElement];
501 
502  if( pSave != NULL )
503  {
504 // tempF->m[iNewElement] = NULL;
505 
506  const poly p_next = pNext(pSave);
507 
508  if(p_next != NULL)
509  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
510  if( p_GetExp(pSave, i, currRing) != 0 )
511  {
512  assume(p_GetExp(pSave, i, currRing) == 1);
513 
514  const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
515 
516 #ifdef PDEBUG
517  p_Test(p_new, currRing);
518 #endif
519 
520  if( p_new == NULL) continue;
521 
522  LObject h(p_new); // h = x_i * strat->P
523  h.is_special = TRUE;
524 
526  h.pCleardenom(); // also does a p_Content
527  else
528  h.pNorm();
529 
530  strat->initEcart(&h);
531  h.sev = pGetShortExpVector(h.p);
532 
533  int pos = 0;
534 
535  if (strat->Ll != -1)
536  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
537 
538  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
539  }
540  }
541  }
542  }
543 
544  // compute-------------------------------------------------------
545  while (strat->Ll >= 0)
546  {
547 #ifdef KDEBUG
548 // loop_count++;
550 #endif
551 
552  if (strat->Ll== 0) strat->interpt=TRUE;
553 
555  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
556  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
557  {
558 
559 #ifdef KDEBUG
560 // if (TEST_OPT_DEBUG){PrintS("^^^^?");}
561 #endif
562 
563  // *stops computation if
564  // * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
565  // *a predefined number Kstd1_deg
566  while ((strat->Ll >= 0)
567  && ( (strat->homog==isHomog) || strat->L[strat->Ll].is_special || ((strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)) )
568  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
569  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
570  )
571  {
572 #ifdef KDEBUG
573 // if (TEST_OPT_DEBUG){PrintS("^^^^^^^^^^^^!!!!");}
574 #endif
576 // if (TEST_OPT_PROT) PrintS("^!");
577  }
578  if (strat->Ll<0) break;
579  else strat->noClearS=TRUE;
580  }
581 
582  // picks the last element from the lazyset L
583  strat->P = strat->L[strat->Ll];
584  strat->Ll--;
585 
586 
587 // assume(pNext(strat->P.p) != strat->tail);
588 
589  if(strat->P.IsNull()) continue;
590 
591  if (pNext(strat->P.p) == strat->tail)
592  {
593  // deletes the short spoly
594  pLmFree(strat->P.p);
595 
596  strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
597  if (strat->P.p!=NULL) strat->initEcart(&strat->P);
598  }// else
599 
600 
601  if(strat->P.IsNull()) continue;
602 
603  if (strat->P.p1 == NULL)
604  {
605 // if (strat->minim > 0)
606 // strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
607 
608 
609  // for input polys, prepare reduction
610  strat->P.PrepareRed(strat->use_buckets);
611  }
612 
613  if (TEST_OPT_PROT)
614  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
615  &olddeg,&reduc,strat, red_result);
616 
617  // reduction of the element chosen from L
618  red_result = strat->red(&strat->P,strat);
619 
620 
621  // reduction to non-zero new poly
622  if (red_result == 1)
623  {
624  // statistic
625  if (TEST_OPT_PROT) PrintS("s");
626 
627  // get the polynomial (canonicalize bucket, make sure P.p is set)
628  strat->P.GetP(strat->lmBin);
629 
630  int pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
631 
632  // reduce the tail and normalize poly
634  {
635  strat->P.pCleardenom();
637  {
638  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT); // !!!
639  strat->P.pCleardenom();
640  }
641  }
642  else
643  {
644  strat->P.pNorm();
646  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
647  }
648  strat->P.is_normalized=nIsOne(pGetCoeff(strat->P.p));
649 
650 #ifdef KDEBUG
651  if (TEST_OPT_DEBUG){PrintS(" ns:");p_wrp(strat->P.p,currRing);PrintLn();}
652 #endif
653 
654 // // min_std stuff
655 // if ((strat->P.p1==NULL) && (strat->minim>0))
656 // {
657 // if (strat->minim==1)
658 // {
659 // strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
660 // p_Delete(&strat->P.p2, currRing, strat->tailRing);
661 // }
662 // else
663 // {
664 // strat->M->m[minimcnt]=strat->P.p2;
665 // strat->P.p2=NULL;
666 // }
667 // if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
668 // pNext(strat->M->m[minimcnt])
669 // = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
670 // strat->tailRing, currRing,
671 // currRing->PolyBin);
672 // minimcnt++;
673 // }
674 
675  // enter into S, L, and T
676  //if(withT)
677  {
678  strat->P.SetpFDeg();
679  enterT(strat->P, strat);
680  }
681 
682  // L
683  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
684 
685  // posInS only depends on the leading term
686  strat->enterS(strat->P, pos, strat, strat->tl);
687 
688 // if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
689 
690 // Print("[%d]",hilbeledeg);
691  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
692 
693  // //////////////////////////////////////////////////////////
694  // SCA:
695  const poly pSave = strat->P.p;
696  const poly p_next = pNext(pSave);
697 
698 // if(0)
699  if( p_next != NULL )
700  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
701  if( p_GetExp(pSave, i, currRing) != 0 )
702  {
703  assume(p_GetExp(pSave, i, currRing) == 1);
704  const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
705 
706 #ifdef PDEBUG
707  p_Test(p_new, currRing);
708 #endif
709 
710  if( p_new == NULL) continue;
711 
712  LObject h(p_new); // h = x_i * strat->P
713 
714  h.is_special = TRUE;
715 
717  {
718 // p_Content(h.p);
719  h.pCleardenom(); // also does a p_Content
720  }
721  else
722  {
723  h.pNorm();
724  }
725 
726  strat->initEcart(&h);
727  h.sev = pGetShortExpVector(h.p);
728 
729  int pos = 0;
730 
731  if (strat->Ll != -1)
732  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
733 
734  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
735 
736 
737 
738 
739 #if 0
740  h.sev = pGetShortExpVector(h.p);
741  strat->initEcart(&h);
742 
743  h.PrepareRed(strat->use_buckets);
744 
745  // reduction of the element chosen from L(?)
746  red_result = strat->red(&h,strat);
747 
748  // reduction to non-zero new poly
749  if (red_result != 1) continue;
750 
751 
752  int pos = posInS(strat,strat->sl,h.p,h.ecart);
753 
754  // reduce the tail and normalize poly
756  {
757  h.pCleardenom();
759  {
760  h.p = redtailBba(&(h),pos-1,strat, withT); // !!!
761  h.pCleardenom();
762  }
763  }
764  else
765  {
766  h.pNorm();
768  h.p = redtailBba(&(h),pos-1,strat, withT);
769  }
770 
771 #ifdef KDEBUG
772  if (TEST_OPT_DEBUG){PrintS(" N:");h.wrp();PrintLn();}
773 #endif
774 
775 // h.PrepareRed(strat->use_buckets); // ???
776 
777  h.sev = pGetShortExpVector(h.p);
778  strat->initEcart(&h);
779 
780  if (strat->Ll==-1)
781  pos = 0;
782  else
783  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
784 
785  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
786 // the end of "#if 0" (comment)
787 #endif
788 
789  } // for all x_i \in Ann(lm(P))
790  } // if red(P) != NULL
791 
792 // else if (strat->P.p1 == NULL && strat->minim > 0)
793 // {
794 // p_Delete(&strat->P.p2, currRing, strat->tailRing);
795 // }
796 
797 #ifdef KDEBUG
798 // memset(&(strat->P), 0, sizeof(strat->P));
799 #endif
800 
801  kTest_TS(strat); // even of T is not used!
802 
803 // Print("\n$\n");
804 
805  }
806 
807 #ifdef KDEBUG
808  if (TEST_OPT_DEBUG) messageSets(strat);
809 #endif
810 
811  // complete reduction of the standard basis---------
812 
813  if (TEST_OPT_REDSB)
814  {
815  completeReduce(strat);
816  }
817 
818  //release temp data--------------------------------
819 
820  exitBuchMora(strat); // cleanT!
821 
822  id_Delete(&tempF, currRing);
823 
824 // if (TEST_OPT_WEIGHTM)
825 // {
826 // pRestoreDegProcs(currRing, pFDegOld, pLDegOld);
827 // if (ecartWeights)
828 // {
829 // omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
830 // ecartWeights=NULL;
831 // }
832 // }
833 
834  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
835 
836 
837 
838  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
839 
840 
841  if (TEST_OPT_REDSB) // ???
842  {
843  // must be at the very end (after exitBuchMora) as it changes the S set!!!
844  ideal I = strat->Shdl;
845  ideal erg = kInterRedOld(I,tempQ);
846  assume(I!=erg);
847  id_Delete(&I, currRing);
848  strat->Shdl = erg;
849  }
850 
851 #if MYTEST
852  PrintS("\n\n</sca_bba>\n\n");
853 #endif
854 
855  if( currRing != save ) rChangeCurrRing(save);
856 
857  return (strat->Shdl);
858 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
ideal SCAQuotient(const ring r)
Definition: sca.h:10
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:7466
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
class sLObject LObject
Definition: kutil.h:58
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7558
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
const ideal
Definition: gb_hack.h:42
static bool id_IsSCAHomogeneous(const ideal id, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.h:115
void id_Delete(ideal *h, ring r)
BOOLEAN z2homog
Definition: kutil.h:368
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3671
char noClearS
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_REDSB
Definition: options.h:99
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:8334
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
BOOLEAN interpt
Definition: kutil.h:365
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define idPrint(id)
Definition: ideals.h:62
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:616
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
void initBba(ideal, kStrategy strat)
Definition: kstd1.cc:1279
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:1217
LObject P
Definition: kutil.h:300
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
int i
Definition: cfEzgcd.cc:123
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:2710
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define IDELEMS(i)
Definition: simpleideals.h:19
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_Test(p, r)
Definition: p_polys.h:160
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#define BVERBOSE(a)
Definition: options.h:33
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1534
int Lmax
Definition: kutil.h:354
#define TEST_OPT_SB_1
Definition: options.h:113
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
static short scaLastAltVar(ring r)
Definition: sca.h:25
BOOLEAN no_prod_crit
Definition: kutil.h:389
static bool rIsSCA(const ring r)
Definition: nc.h:206
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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:70
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:95
static poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
Definition: nc.h:258
BOOLEAN use_buckets
Definition: kutil.h:377
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:96
int Kstd1_deg
Definition: kutil.cc:228
int newIdeal
Definition: kutil.h:360
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:7637
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:8780
#define idTest(id)
Definition: ideals.h:63
ideal sca_gr_bba ( const ideal  ,
const ideal  ,
const intvec ,
const intvec ,
kStrategy  ,
const ring  _currRing 
)

Modified Plural's Buchberger's algorithmus.

Definition at line 101 of file sca.cc.

102 {
103  const ring save = currRing;
104  if( currRing != _currRing ) rChangeCurrRing(_currRing);
105  assume( currRing == _currRing );
106 
107 
108 #if MYTEST
109  PrintS("<sca_gr_bba>\n");
110 #endif
111 
113 
114 #ifndef SING_NDEBUG
115  idTest(F);
116  idTest(Q);
117 #endif
118 
119 #ifdef HAVE_PLURAL
120 #if MYTEST
121  PrintS("currRing: \n");
122  rWrite(currRing);
123 #ifdef RDEBUG
125 #endif
126 
127  PrintS("F: \n");
128  idPrint(F);
129  PrintS("Q: \n");
130  idPrint(Q);
131 #endif
132 #endif
133 
134 
135  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
136  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
137 
138  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
139  ideal tempQ = Q;
140 
141  if(Q == currRing->qideal)
142  tempQ = SCAQuotient(currRing);
143 
144  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
145  // redo: no_prod_crit
146  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
147  strat->no_prod_crit = ! bIsSCA;
148 
149 // strat->homog = strat->homog && strat->z2homog; // ?
150 
151 #if MYTEST
152  {
153  PrintS("ideal tempF: \n");
154  idPrint(tempF);
155  PrintS("ideal tempQ: \n");
156  idPrint(tempQ);
157  }
158 #endif
159 
160  int olddeg, reduc;
161  int red_result = 1;
162 // int hilbeledeg = 1, minimcnt = 0;
163  int hilbcount = 0;
164 
165  initBuchMoraCrit(strat); // set Gebauer, honey, sugarCrit
166 
167  nc_gr_initBba(tempF,strat); // set enterS, red, initEcart, initEcartPair
168 
170 
171 
172  // ?? set spSpolyShort, reduce ???
173 
174  initBuchMora(tempF, tempQ, strat); // SCAQuotient(currRing) instead of Q == squares!!!!!!!
175 
176  strat->posInT=posInT110; // !!!
177 
178  reduc = olddeg = 0;
179 
180 
181  // compute-------------------------------------------------------
182  for(; strat->Ll >= 0;
183 #ifdef KDEBUG
184  strat->P.lcm = NULL,
185 #endif
186  kTest(strat)
187  )
188  {
189 #ifdef KDEBUG
191 #endif
192 
193  if (strat->Ll== 0) strat->interpt=TRUE;
194 
196  && ((strat->honey
197  && (strat->L[strat->Ll].ecart+ currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
198  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
199  {
200  // stops computation if
201  // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
202  // a predefined number Kstd1_deg
203  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
204  break;
205  }
206 
207  // picks the last element from the lazyset L
208  strat->P = strat->L[strat->Ll];
209  strat->Ll--;
210 
211  //kTest(strat);
212 
213 // assume(pNext(strat->P.p) != strat->tail); // !???
214  if(strat->P.IsNull()) continue;
215 
216 
217  if( pNext(strat->P.p) == strat->tail )
218  {
219  // deletes the int spoly and computes SPoly
220  pLmFree(strat->P.p); // ???
221  strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
222  }
223 
224  if(strat->P.IsNull()) continue;
225 
226 // poly save = NULL;
227 //
228 // if(pNext(strat->P.p) != NULL)
229 // save = p_Copy(strat->P.p, currRing);
230 
231  strat->initEcart(&strat->P); // remove it?
232 
233  if (TEST_OPT_PROT)
234  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(), &olddeg,&reduc,strat, red_result);
235 
236  // reduction of the element chosen from L wrt S
237  strat->red(&strat->P,strat);
238 
239  if(strat->P.IsNull()) continue;
240 
241  addLObject(strat->P, strat);
242 
243  const poly save = strat->P.p;
244 
245 #ifdef PDEBUG
246  p_Test(save, currRing);
247 #endif
248  assume( save != NULL );
249 
250  // SCA Specials:
251 
252  {
253  const poly p_next = pNext(save);
254 
255  if( p_next != NULL )
256  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
257  if( p_GetExp(save, i, currRing) != 0 )
258  {
259  assume(p_GetExp(save, i, currRing) == 1);
260 
261  const poly tt = sca_pp_Mult_xi_pp(i, p_next, currRing);
262 
263 #ifdef PDEBUG
264  p_Test(tt, currRing);
265 #endif
266 
267  if( tt == NULL) continue;
268 
269  LObject h(tt); // h = x_i * P
270 
272  {
273 // h.pCleardenom(); // also does a p_Content
274  p_Content(h.p,currRing);
275  }
276  else
277  {
278  h.pNorm();
279  }
280 
281  strat->initEcart(&h);
282 
283 
284 // if (pOrdSgn==-1)
285 // {
286 // cancelunit(&h); // tries to cancel a unit
287 // deleteHC(&h, strat);
288 // }
289 
290 // if(h.IsNull()) continue;
291 
292 // if (TEST_OPT_PROT)
293 // message((strat->honey ? h.ecart : 0) + h.pFDeg(), &olddeg, &reduc, strat, red_result);
294 
295 // strat->red(&h, strat); // wrt S
296 // if(h.IsNull()) continue;
297 
298 // poly save = p_Copy(h.p, currRing);
299 
300  int pos;
301 
302  if (strat->Ll==-1)
303  pos =0;
304  else
305  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
306 
307  h.sev = pGetShortExpVector(h.p);
308  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
309 
310  // h.p = save;
311  // addLObject(h, strat);
312  }
313 
314  // p_Delete( &save, currRing );
315  }
316 
317 
318  } // for(;;)
319 
320 
321 #ifdef KDEBUG
322  if (TEST_OPT_DEBUG) messageSets(strat);
323 #endif
324 
325  if (TEST_OPT_REDSB){
326  completeReduce(strat); // ???
327  }
328 
329  // release temp data--------------------------------
330  exitBuchMora(strat);
331 
332 // if (TEST_OPT_WEIGHTM)
333 // {
334 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
335 // if (ecartWeights)
336 // {
337 // omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(int));
338 // ecartWeights=NULL;
339 // }
340 // }
341 
342  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
343 
344  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
345 
346  id_Delete(&tempF, currRing);
347 
348 
349  // complete reduction of the standard basis---------
350  if (TEST_OPT_REDSB){
351  ideal I = strat->Shdl;
352  ideal erg = kInterRedOld(I,tempQ);
353  assume(I!=erg);
354  id_Delete(&I, currRing);
355  strat->Shdl = erg;
356  }
357 
358 
359 #if MYTEST
360 // PrintS("</sca_gr_bba>\n");
361 #endif
362 
363  if( currRing != save ) rChangeCurrRing(save);
364 
365  return (strat->Shdl);
366 }
ideal SCAQuotient(const ring r)
Definition: sca.h:10
BOOLEAN honey
Definition: kutil.h:371
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:7466
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
class sLObject LObject
Definition: kutil.h:58
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7558
void addLObject(LObject &h, kStrategy &strat)
Definition: sca.cc:27
const ideal
Definition: gb_hack.h:42
static bool id_IsSCAHomogeneous(const ideal id, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.h:115
void id_Delete(ideal *h, ring r)
BOOLEAN z2homog
Definition: kutil.h:368
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
#define kTest(A)
Definition: kutil.h:615
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define Q
Definition: sirandom.c:25
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
void rDebugPrint(ring r)
Definition: ring.cc:3971
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
BOOLEAN interpt
Definition: kutil.h:365
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define idPrint(id)
Definition: ideals.h:62
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:1217
LObject P
Definition: kutil.h:300
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
int i
Definition: cfEzgcd.cc:123
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:2710
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2182
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_Test(p, r)
Definition: p_polys.h:160
void rChangeCurrRing(ring r)
Definition: polys.cc:14
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1534
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
static short scaLastAltVar(ring r)
Definition: sca.h:25
BOOLEAN no_prod_crit
Definition: kutil.h:389
void nc_gr_initBba(ideal F, kStrategy strat)
nc_gr_initBba is needed for sca_gr_bba and gr_bba.
Definition: gr_kstd2.cc:972
static bool rIsSCA(const ring r)
Definition: nc.h:206
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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:70
static poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
Definition: nc.h:258
int Kstd1_deg
Definition: kutil.cc:228
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:7637
#define idTest(id)
Definition: ideals.h:63
ideal sca_mora ( const ideal  ,
const ideal  ,
const intvec ,
const intvec ,
kStrategy  ,
const ring  _currRing 
)

Modified modern Sinuglar Mora's algorithm.

Definition at line 899 of file sca.cc.

900 {
901  const ring save = currRing;
902  if( currRing != _currRing ) rChangeCurrRing(_currRing);
903  assume( currRing == _currRing );
904 
906 
907  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
908  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
909 
910  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
911 
912  ideal tempQ = Q;
913 
914  if(Q == currRing->qideal)
915  tempQ = SCAQuotient(currRing);
916 
917  bool bIdHomog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
918 
919  assume( !bIdHomog || strat->homog ); // bIdHomog =====[implies]>>>>> strat->homog
920 
921  strat->homog = strat->homog && bIdHomog;
922 
923 #ifdef PDEBUG
924  assume( strat->homog == bIdHomog );
925 #endif
926 
927 #ifdef HAVE_ASSUME
928  sca_mora_count++;
930 #endif
931 
932  strat->update = TRUE;
933  //- setting global variables ------------------- -
935 // initHilbCrit(F,NULL,&hilb,strat); // no Q!
936  initMora(tempF, strat);
938  //Shdl=
939  initBuchMora(tempF, tempQ, strat); // temp Q, F!
940 // if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
941  // updateS in initBuchMora has Hecketest
942  // * and could have put strat->kHEdgdeFound FALSE
943 #if 0
944  if (ppNoether!=NULL)
945  {
947  }
948  if (strat->kHEdgeFound && strat->update)
949  {
951  updateLHC(strat);
952  reorderL(strat);
953  }
955  {
958  strat->posInL = posInL10;
959  updateL(strat);
960  reorderL(strat);
961  }
962 #endif
964 
965  kTest_TS(strat);
966 
967 
968  int olddeg = 0;
969  int reduc = 0;
970  int red_result = 1;
971 // int hilbeledeg=1;
972  int hilbcount=0;
973 
974 
975  //- compute-------------------------------------------
976 
977 #undef HAVE_TAIL_RING
978 
979 #ifdef HAVE_TAIL_RING
980 // if (strat->homog && strat->red == redFirst)
981 // kStratInitChangeTailRing(strat);
982 #endif
983 
984 
985 
986 
987 
988 // due to std( SB, p)
989  if(TEST_OPT_SB_1)
990  {
991  for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
992  {
993 
994  const poly pSave = tempF->m[iNewElement];
995 
996  if( pSave != NULL )
997  {
998 // tempF->m[iNewElement] = NULL;
999 
1000  const poly p_next = pNext(pSave);
1001 
1002  if(p_next != NULL)
1003  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
1004  if( p_GetExp(pSave, i, currRing) != 0 )
1005  {
1006 
1007  assume(p_GetExp(pSave, i, currRing) == 1);
1008 
1009  const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
1010 
1011 #ifdef PDEBUG
1012  p_Test(p_new, currRing);
1013 #endif
1014 
1015  if( p_new == NULL) continue;
1016 
1017  LObject h(p_new); // h = x_i * strat->P
1018 
1020  h.pCleardenom(); // also does a p_Content
1021  else
1022  h.pNorm();
1023 
1024  strat->initEcart(&h);
1025  h.sev = pGetShortExpVector(h.p);
1026 
1027  int pos = 0;
1028 
1029  if (strat->Ll != -1)
1030  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
1031 
1032  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
1033  }
1034  }
1035 
1036  }
1037  }
1038 
1039 
1040 
1041 
1042  while (strat->Ll >= 0)
1043  {
1044 #ifdef HAVE_ASSUME
1046 #endif
1047  //test_int_std(strat->kIdeal);
1048 #ifdef KDEBUG
1050 #endif
1051  if (TEST_OPT_DEGBOUND
1052  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
1053  {
1054  // * stops computation if
1055  // * - 24 (degBound)
1056  // * && upper degree is bigger than Kstd1_deg
1057  while ((strat->Ll >= 0)
1058  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1059  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
1060  )
1061  {
1063  //if (TEST_OPT_PROT)
1064  //{
1065  // PrintS("D"); mflush();
1066  //}
1067  }
1068  if (strat->Ll<0) break;
1069  else strat->noClearS=TRUE;
1070  }
1071  strat->P = strat->L[strat->Ll];// - picks the last element from the lazyset L -
1072  if (strat->Ll==0) strat->interpt=TRUE;
1073  strat->Ll--;
1074 
1075  // create the real Spoly
1076 // assume(pNext(strat->P.p) != strat->tail);
1077 
1078  if(strat->P.IsNull()) continue;
1079 
1080 
1081  if( pNext(strat->P.p) == strat->tail )
1082  {
1083  // deletes the int spoly and computes SPoly
1084  pLmFree(strat->P.p); // ???
1085  strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
1086  }
1087 
1088 
1089 
1090  if (strat->P.p1 == NULL)
1091  {
1092  // for input polys, prepare reduction (buckets !)
1093  strat->P.SetLength(strat->length_pLength);
1094  strat->P.PrepareRed(strat->use_buckets);
1095  }
1096 
1097  if (!strat->P.IsNull())
1098  {
1099  // might be NULL from noether !!!
1100  if (TEST_OPT_PROT)
1101  message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
1102  // reduce
1103  red_result = strat->red(&strat->P,strat);
1104  }
1105 
1106  if (! strat->P.IsNull())
1107  {
1108  strat->P.GetP();
1109  // statistics
1110  if (TEST_OPT_PROT) PrintS("s");
1111  // normalization
1112  if (!TEST_OPT_INTSTRATEGY)
1113  strat->P.pNorm();
1114  // tailreduction
1115  strat->P.p = redtail(&(strat->P),strat->sl,strat);
1116  // set ecart -- might have changed because of tail reductions
1117  if ((!strat->noTailReduction) && (!strat->honey))
1118  strat->initEcart(&strat->P);
1119  // cancel unit
1120  cancelunit(&strat->P);
1121  // for char 0, clear denominators
1123  strat->P.pCleardenom();
1124 
1125  // put in T
1126  enterT(strat->P,strat);
1127  // build new pairs
1128  enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
1129  // put in S
1130  strat->enterS(strat->P,
1131  posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
1132  strat, strat->tl);
1133 
1134 
1135  // clear strat->P
1136  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
1137  strat->P.lcm=NULL;
1138 
1139  // //////////////////////////////////////////////////////////
1140  // SCA:
1141  const poly pSave = strat->P.p;
1142  const poly p_next = pNext(pSave);
1143 
1144  if(p_next != NULL)
1145  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
1146  if( p_GetExp(pSave, i, currRing) != 0 )
1147  {
1148 
1149  assume(p_GetExp(pSave, i, currRing) == 1);
1150 
1151  const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
1152 
1153 #ifdef PDEBUG
1154  p_Test(p_new, currRing);
1155 #endif
1156 
1157  if( p_new == NULL) continue;
1158 
1159  LObject h(p_new); // h = x_i * strat->P
1160 
1162  h.pCleardenom(); // also does a p_Content
1163  else
1164  h.pNorm();
1165 
1166  strat->initEcart(&h);
1167  h.sev = pGetShortExpVector(h.p);
1168 
1169  int pos = 0;
1170 
1171  if (strat->Ll != -1)
1172  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
1173 
1174  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
1175  }
1176 
1177 #ifdef KDEBUG
1178  // make sure kTest_TS does not complain about strat->P
1179  memset(&strat->P,0,sizeof(strat->P));
1180 #endif
1181  }
1182 #if 0
1183  if (strat->kHEdgeFound)
1184  {
1185  if ((TEST_OPT_FINDET)
1186  || ((TEST_OPT_MULTBOUND) && (scMult0Int((strat->Shdl)) < mu)))
1187  {
1188  // obachman: is this still used ???
1189  // * stops computation if strat->kHEdgeFound and
1190  // * - 27 (finiteDeterminacyTest)
1191  // * or
1192  // * - 23
1193  // * (multBound)
1194  // * && multiplicity of the ideal is smaller then a predefined number mu
1195  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1196  }
1197  }
1198 #endif
1199  kTest_TS(strat);
1200  }
1201  // - complete reduction of the standard basis------------------------ -
1202  if (TEST_OPT_REDSB) completeReduce(strat);
1203  // - release temp data------------------------------- -
1204  exitBuchMora(strat);
1205  // - polynomials used for HECKE: HC, noether -
1206  if (TEST_OPT_FINDET)
1207  {
1208  if (strat->kHEdge!=NULL)
1209  Kstd1_mu=currRing->pFDeg(strat->kHEdge,currRing);
1210  else
1211  Kstd1_mu=-1;
1212  }
1213  pDelete(&strat->kHEdge);
1214  strat->update = TRUE; //???
1215  strat->lastAxis = 0; //???
1216  pDelete(&strat->kNoether);
1217  omFreeSize((ADDRESS)strat->NotUsedAxis,(rVar(currRing)+1)*sizeof(BOOLEAN));
1218  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
1219 // if (TEST_OPT_WEIGHTM)
1220 // {
1221 // pRestoreDegProcs(currRing, pFDegOld, pLDegOld);
1222 // if (ecartWeights)
1223 // {
1224 // omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
1225 // ecartWeights=NULL;
1226 // }
1227 // }
1228  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
1229  idTest(strat->Shdl);
1230 
1231  id_Delete( &tempF, currRing);
1232 
1233  if( currRing != save ) rChangeCurrRing(save);
1234 
1235  return (strat->Shdl);
1236 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
ideal SCAQuotient(const ring r)
Definition: sca.h:10
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
void mu(int **points, int sizePoints)
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:7466
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1403
class sLObject LObject
Definition: kutil.h:58
BOOLEAN length_pLength
Definition: kutil.h:382
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7558
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
static bool id_IsSCAHomogeneous(const ideal id, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.h:115
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
void id_Delete(ideal *h, ring r)
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3671
#define TEST_OPT_MULTBOUND
Definition: options.h:109
char noClearS
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
void * ADDRESS
Definition: auxiliary.h:161
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define Q
Definition: sirandom.c:25
void updateL(kStrategy strat)
Definition: kstd1.cc:980
int lastAxis
Definition: kutil.h:359
int Kstd1_mu
Definition: kutil.cc:229
#define TEST_OPT_FINDET
Definition: options.h:106
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
BOOLEAN interpt
Definition: kutil.h:365
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int sca_mora_count
Definition: sca.cc:894
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:616
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
polyrec * poly
Definition: hilb.h:10
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:914
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1054
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:1217
LObject P
Definition: kutil.h:300
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
void reorderL(kStrategy strat)
Definition: kstd1.cc:808
BOOLEAN update
Definition: kutil.h:375
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:287
#define IDELEMS(i)
Definition: simpleideals.h:19
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_Test(p, r)
Definition: p_polys.h:160
void rChangeCurrRing(ring r)
Definition: polys.cc:14
kStrategy strat
Definition: myNF.cc:319
BOOLEAN kHEdgeFound
Definition: kutil.h:370
static int sca_mora_loop_count
Definition: sca.cc:895
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1534
int Lmax
Definition: kutil.h:354
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1138
#define TEST_OPT_SB_1
Definition: options.h:113
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
static BOOLEAN kMoraUseBucket(kStrategy)
Definition: sca.cc:867
#define pDelete(p_ptr)
Definition: polys.h:157
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
BOOLEAN posInLOldFlag
Definition: kutil.h:376
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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:70
static poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
Definition: nc.h:258
BOOLEAN use_buckets
Definition: kutil.h:377
#define TEST_OPT_FASTHC
Definition: options.h:104
int Kstd1_deg
Definition: kutil.cc:228
int newIdeal
Definition: kutil.h:360
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:7637
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:947
#define idTest(id)
Definition: ideals.h:63
void WerrorS ( const char *  )

Definition at line 23 of file feFopen.cc.

24 {
25  if (WerrorS_callback == NULL)
26  {
27  fwrite(" ? ",1,5,stderr);
28  fwrite((char *)s,1,strlen((char *)s),stderr);
29  fwrite("\n",1,1,stderr);
30  fflush(stderr);
31  }
32  else
33  {
35  }
36  errorreported = 1;
37 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
short errorreported
Definition: feFopen.cc:22
#define NULL
Definition: omList.c:10

Variable Documentation

typedef struct sip_sideal * ideal

Definition at line 42 of file gb_hack.h.

const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int

Definition at line 53 of file gb_hack.h.