Macros | Functions
gr_kstd2.cc File Reference
#include <kernel/mod2.h>
#include <omalloc/omalloc.h>
#include <misc/options.h>
#include <misc/intvec.h>
#include <polys/weight.h>
#include <kernel/polys.h>
#include <polys/monomials/ring.h>
#include <polys/nc/gb_hack.h>
#include <polys/nc/nc.h>
#include <polys/nc/sca.h>
#include <kernel/ideals.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/GBEngine/khstd.h>
#include <kernel/GBEngine/ratgring.h>
#include <kernel/GBEngine/kutil.h>
#include <kernel/GBEngine/nc.h>

Go to the source code of this file.

Macros

#define PLURAL_INTERNAL_DECLARATIONS
 
#define MYTEST   0
 

Functions

int redGrFirst (LObject *h, kStrategy strat)
 
void ratGB_divide_out (poly p)
 
int redGrRatGB (LObject *h, kStrategy strat)
 
void nc_gr_initBba (ideal F, kStrategy strat)
 nc_gr_initBba is needed for sca_gr_bba and gr_bba. More...
 
ideal k_gnc_gr_bba (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
 
ideal k_gnc_gr_mora (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
 

Macro Definition Documentation

◆ MYTEST

#define MYTEST   0

Definition at line 1053 of file gr_kstd2.cc.

◆ PLURAL_INTERNAL_DECLARATIONS

#define PLURAL_INTERNAL_DECLARATIONS

Definition at line 7 of file gr_kstd2.cc.

Function Documentation

◆ k_gnc_gr_bba()

ideal k_gnc_gr_bba ( const ideal  F,
const ideal  Q,
const intvec ,
const intvec ,
kStrategy  strat,
const ring  _currRing 
)

Definition at line 1055 of file gr_kstd2.cc.

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

◆ k_gnc_gr_mora()

ideal k_gnc_gr_mora ( const ideal  F,
const ideal  Q,
const intvec ,
const intvec ,
kStrategy  strat,
const ring  _currRing 
)

Definition at line 1317 of file gr_kstd2.cc.

1318 {
1319 #ifndef SING_NDEBUG
1320  // Not yet!
1321  WarnS("Sorry, non-commutative mora is not yet implemented!");
1322 #endif
1323 
1324  return gnc_gr_bba(F, Q, NULL, NULL, strat, _currRing);
1325 }
#define Q
Definition: sirandom.c:25
#define WarnS
Definition: emacs.cc:81
BBA_Proc gnc_gr_bba
Definition: old.gring.cc:72
#define NULL
Definition: omList.c:10

◆ nc_gr_initBba()

void nc_gr_initBba ( ideal  F,
kStrategy  strat 
)

nc_gr_initBba is needed for sca_gr_bba and gr_bba.

Definition at line 975 of file gr_kstd2.cc.

979 {
981 
982  // int i;
983 // idhdl h;
984  /* setting global variables ------------------- */
985  strat->enterS = enterSBba;
986 
987 /*
988  if ((BTEST1(20)) && (!strat->honey))
989  strat->red = nc_redBest;
990  else if (strat->honey)
991  strat->red = nc_redHoney;
992  else if (currRing->pLexOrder && !strat->homog)
993  strat->red = nc_redLazy;
994  else if (TEST_OPT_INTSTRATEGY && strat->homog)
995  strat->red = nc_redHomog0;
996  else
997  strat->red = nc_redHomog;
998 */
999 
1000 // if (rIsPluralRing(currRing))
1001  strat->red = redGrFirst;
1002 #ifdef HAVE_RATGRING
1003  if (rIsRatGRing(currRing))
1004  {
1005  int ii=IDELEMS(F)-1;
1006  int jj;
1007  BOOLEAN is_rat_id=FALSE;
1008  for(;ii>=0;ii--)
1009  {
1010  for(jj=currRing->real_var_start;jj<=currRing->real_var_end;jj++)
1011  {
1012  if(pGetExp(F->m[ii],jj)>0) { is_rat_id=TRUE; break; }
1013  }
1014  if (is_rat_id) break;
1015  }
1016  if (is_rat_id) strat->red=redGrRatGB;
1017  }
1018 #endif
1019 
1020  if (currRing->pLexOrder && strat->honey)
1021  strat->initEcart = initEcartNormal;
1022  else
1023  strat->initEcart = initEcartBBA;
1024  if (strat->honey)
1026  else
1028 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1029 // {
1030 // //interred machen Aenderung
1031 // pFDegOld=currRing->pFDeg;
1032 // pLDegOld=currRing->pLDeg;
1033 // // h=ggetid("ecart");
1034 // // if ((h!=NULL) && (IDTYP(h)==INTVEC_CMD))
1035 // // {
1036 // // ecartWeights=iv2array(IDINTVEC(h));
1037 // // }
1038 // // else
1039 // {
1040 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1041 // /*uses automatic computation of the ecartWeights to set them*/
1042 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1043 // }
1044 // currRing->pFDeg=totaldegreeWecart;
1045 // currRing->pLDeg=maxdegreeWecart;
1046 // for(i=1; i<=(currRing->N); i++)
1047 // Print(" %d",ecartWeights[i]);
1048 // PrintLn();
1049 // mflush();
1050 // }
1051 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
BOOLEAN honey
Definition: kutil.h:366
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
#define TRUE
Definition: auxiliary.h:98
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
int redGrRatGB(LObject *h, kStrategy strat)
Definition: gr_kstd2.cc:229
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
#define IDELEMS(i)
Definition: simpleideals.h:24
int redGrFirst(LObject *h, kStrategy strat)
Definition: gr_kstd2.cc:56
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int BOOLEAN
Definition: auxiliary.h:85
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229

◆ ratGB_divide_out()

void ratGB_divide_out ( poly  p)

Definition at line 176 of file gr_kstd2.cc.

177 {
178  /* extracts monomial content from localized expression */
179  /* searches for an m (monomial in var 1.. real_var_start-1)
180  * such that m divides p and divides p by this m if it exist*/
181  if (p==NULL) return;
182  poly root=p;
184  poly f=pHead(p);
185  int i;
186  for (i=currRing->real_var_start;i<=currRing->real_var_end;i++)
187  {
188  pSetExp(f,i,0);
189  }
190  loop
191  {
192  pIter(p);
193  if (p==NULL) { pSetm(f); break;}
194  for (i=1;i<=rVar(currRing);i++)
195  {
196  pSetExp(f,i,si_min(pGetExp(f,i),pGetExp(p,i)));
197  }
198  }
199  if (!pIsConstant(f))
200  {
201 #ifdef KDEBUG
202  if (TEST_OPT_DEBUG)
203  {
204  PrintS("divide out:");p_wrp(f,currRing);
205  PrintS(" from ");pWrite(root);
206  }
207 #endif
208  p=root;
209  loop
210  {
211  if (p==NULL) break;
212  for (i=1;i<=rVar(currRing);i++)
213  {
214  pSetExp(p,i,pGetExp(p,i)-pGetExp(f,i));
215  }
216  pSetm(p);
217  pIter(p);
218  }
219  }
220  pDelete(&f);
221 }
#define pSetm(p)
Definition: polys.h:253
loop
Definition: myNF.cc:98
#define pSetExp(p, i, v)
Definition: polys.h:42
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
return P p
Definition: myNF.cc:203
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define assume(x)
Definition: mod2.h:394
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:169
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10

◆ redGrFirst()

int redGrFirst ( LObject h,
kStrategy  strat 
)

Definition at line 56 of file gr_kstd2.cc.

57 {
58  int at,reddeg,d,i;
59  int pass = 0;
60  int j = 0;
61 
62  d = currRing->pFDeg((*h).p,currRing)+(*h).ecart;
63  reddeg = strat->LazyDegree+d;
64  loop
65  {
66  if (j > strat->sl)
67  {
68 #ifdef KDEBUG
69  if (TEST_OPT_DEBUG) PrintLn();
70 #endif
71  return 0;
72  }
73 #ifdef KDEBUG
74  if (TEST_OPT_DEBUG) Print("%d",j);
75 #endif
76  if (pDivisibleBy(strat->S[j],(*h).p))
77  {
78 #ifdef KDEBUG
79  if (TEST_OPT_DEBUG) PrintS("+\n");
80 #endif
81  /*
82  * the polynomial to reduce with is;
83  * T[j].p
84  */
86  pNorm(strat->S[j]);
87 #ifdef KDEBUG
88  if (TEST_OPT_DEBUG)
89  {
90  wrp(h->p);
91  PrintS(" with ");
92  wrp(strat->S[j]);
93  }
94 #endif
95  (*h).p = nc_ReduceSpoly(strat->S[j],(*h).p, currRing);
96  //spSpolyRed(strat->T[j].p,(*h).p,strat->kNoether);
97 
98 #ifdef KDEBUG
99  if (TEST_OPT_DEBUG)
100  {
101  PrintS(" to ");
102  wrp(h->p);
103  }
104 #endif
105  if ((*h).p == NULL)
106  {
107  if (h->lcm!=NULL) p_LmFree((*h).lcm, currRing);
108  return 0;
109  }
111  {
113  else h->pCleardenom();// also does a p_Content
114  }
115  /*computes the ecart*/
116  d = currRing->pLDeg((*h).p,&((*h).length),currRing);
117  (*h).FDeg=currRing->pFDeg((*h).p,currRing);
118  (*h).ecart = d-(*h).FDeg; /*pFDeg((*h).p);*/
119  if ((strat->syzComp!=0) && !strat->honey)
120  {
121  if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
122  {
123 #ifdef KDEBUG
124  if (TEST_OPT_DEBUG) PrintS(" > sysComp\n");
125 #endif
126  return 0;
127  }
128  }
129  /*- try to reduce the s-polynomial -*/
130  pass++;
131  /*
132  *test whether the polynomial should go to the lazyset L
133  *-if the degree jumps
134  *-if the number of pre-defined reductions jumps
135  */
136  if ((strat->Ll >= 0)
137  && ((d >= reddeg) || (pass > strat->LazyPass))
138  && !strat->homog)
139  {
140  at = strat->posInL(strat->L,strat->Ll,h,strat);
141  if (at <= strat->Ll)
142  {
143  i=strat->sl+1;
144  do
145  {
146  i--;
147  if (i<0) return 0;
148  } while (!pDivisibleBy(strat->S[i],(*h).p));
149  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
150 #ifdef KDEBUG
151  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
152 #endif
153  (*h).p = NULL;
154  return 0;
155  }
156  }
157  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
158  {
159  reddeg = d+1;
160  Print(".%d",d);mflush();
161  }
162  j = 0;
163 #ifdef KDEBUG
164  if TEST_OPT_DEBUG PrintLn();
165 #endif
166  }
167  else
168  {
169 #ifdef KDEBUG
170  if (TEST_OPT_DEBUG) PrintS("-");
171 #endif
172  j++;
173  }
174  }
175 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:521
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define pMinComp(p)
Definition: polys.h:282
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
#define mflush()
Definition: reporter.h:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
static poly nc_ReduceSpoly(const poly p1, poly p2, const ring r)
Definition: nc.h:271
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:292
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2255
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
int Lmax
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
int sl
Definition: kutil.h:336
void wrp(poly p)
Definition: polys.h:292
int LazyPass
Definition: kutil.h:341
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:341

◆ redGrRatGB()

int redGrRatGB ( LObject h,
kStrategy  strat 
)

Definition at line 229 of file gr_kstd2.cc.

230 {
231  int at,reddeg,d,i;
232  int pass = 0;
233  int j = 0;
234  int c_j=-1, c_e=-2;
235  poly c_p=NULL;
236  assume(strat->tailRing==currRing);
237 
238  ratGB_divide_out((*h).p);
239  d = currRing->pFDeg((*h).p,currRing)+(*h).ecart;
240  reddeg = strat->LazyDegree+d;
242  {
244  else h->pCleardenom();// also does a pContentRat
245  }
246  loop
247  {
248  if (j > strat->sl)
249  {
250  if (c_j>=0)
251  {
252  /*
253  * the polynomial to reduce with is;
254  * S[c_j]
255  */
257  pNorm(strat->S[c_j]);
258 #ifdef KDEBUG
259  if (TEST_OPT_DEBUG)
260  if (TEST_OPT_DEBUG)
261  {
262  wrp(h->p);
263  Print(" with S[%d]= ",c_j);
264  wrp(strat->S[c_j]);
265  }
266 #endif
267  //poly hh = nc_CreateSpoly(strat->S[c_j],(*h).p, currRing);
268  // Print("vor nc_rat_ReduceSpolyNew (ce:%d) ",c_e);wrp(h->p);PrintLn();
269  //if(c_e==-1)
270  // c_p = nc_CreateSpoly(pCopy(strat->S[c_j]),pCopy((*h).p), currRing);
271  //else
272  // c_p=nc_rat_ReduceSpolyNew(strat->S[c_j],pCopy((*h).p), currRing->real_var_start-1,currRing);
273  // Print("nach nc_rat_ReduceSpolyNew ");wrp(c_p);PrintLn();
274  // pDelete(&((*h).p));
275 
276  c_p=nc_rat_ReduceSpolyNew(strat->S[c_j],(*h).p, currRing->real_var_start-1,currRing);
277  (*h).p=c_p;
279  {
281  else h->pCleardenom();// also does a p_Content
282  }
283 
284 #ifdef KDEBUG
285  if (TEST_OPT_DEBUG)
286  {
287  PrintS(" to ");
288  wrp(h->p);
289  PrintLn();
290  }
291 #endif
292  if ((*h).p == NULL)
293  {
294  if (h->lcm!=NULL) p_LmFree((*h).lcm, currRing);
295  return 0;
296  }
297  ratGB_divide_out((*h).p);
298  d = currRing->pLDeg((*h).p,&((*h).length),currRing);
299  (*h).FDeg=currRing->pFDeg((*h).p,currRing);
300  (*h).ecart = d-(*h).FDeg; /*pFDeg((*h).p);*/
301  /*- try to reduce the s-polynomial again -*/
302  pass++;
303  j=0;
304  c_j=-1; c_e=-2; c_p=NULL;
305  }
306  else
307  { // nothing found
308  return 0;
309  }
310  }
311  // first try usal division
312  if (p_LmDivisibleBy(strat->S[j],(*h).p,currRing))
313  {
314 #ifdef KDEBUG
315  if(TEST_OPT_DEBUG)
316  {
317  p_wrp(h->p,currRing); Print(" divisible by S[%d]=",j);
318  p_wrp(strat->S[j],currRing); PrintS(" e=-1\n");
319  }
320 #endif
321  if ((c_j<0)||(c_e>=0))
322  {
323  c_e=-1; c_j=j;
324  }
325  }
326  else
327  if (p_LmDivisibleByPart(strat->S[j],(*h).p,currRing,
328  currRing->real_var_start,currRing->real_var_end))
329  {
330  int a_e=(p_Totaldegree(strat->S[j],currRing)-currRing->pFDeg(strat->S[j],currRing));
331 #ifdef KDEBUG
332  if(TEST_OPT_DEBUG)
333  {
334  p_wrp(h->p,currRing); Print(" divisibly by S[%d]=",j);
335  p_wrp(strat->S[j],currRing); Print(" e=%d\n",a_e);
336  }
337 #endif
338  if ((c_j<0)||(c_e>a_e))
339  {
340  c_e=a_e; c_j=j;
341  //c_p = nc_CreateSpoly(pCopy(strat->S[c_j]),pCopy((*h).p), currRing);
342  }
343  /*computes the ecart*/
344  if ((strat->syzComp!=0) && !strat->honey)
345  {
346  if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
347  {
348 #ifdef KDEBUG
349  if (TEST_OPT_DEBUG) PrintS(" > sysComp\n");
350 #endif
351  return 0;
352  }
353  }
354  }
355  else
356  {
357 #ifdef KDEBUG
358  if(TEST_OPT_DEBUG)
359  {
360  p_wrp(h->p,currRing); Print(" not divisibly by S[%d]=",j);
361  p_wrp(strat->S[j],currRing); PrintLn();
362  }
363 #endif
364  }
365  j++;
366  }
367 }
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:521
loop
Definition: myNF.cc:98
poly nc_rat_ReduceSpolyNew(const poly p1, poly p2, int ishift, const ring r)
Definition: ratgring.cc:466
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
#define TEST_OPT_DEBUG
Definition: options.h:103
#define pMinComp(p)
Definition: polys.h:282
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void ratGB_divide_out(poly p)
Definition: gr_kstd2.cc:176
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static BOOLEAN p_LmDivisibleByPart(poly a, poly b, const ring r, const int start, const int end)
Definition: p_polys.h:1733
polyset S
Definition: kutil.h:292
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2255
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1768
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
int sl
Definition: kutil.h:336
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:341