Changeset 649021 in git
- Timestamp:
- Dec 8, 2018, 9:57:54 AM (5 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- a548d67bbd30d76652bb8a6596850125133a2374
- Parents:
- ac8f852ee98f3d2c31345586af75ef366f73758d5529319cbb0358eaef7fc55c04b6726e9cba7e09
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/fpalgebras.lib
r552931 r649021 4 4 info=" 5 5 LIBRARY: fpalgebras.lib Definitions of some finitely presented algebras and groups (Letterplace) 6 AUTHORS: Karim Abou Zeid, karim.abou.zeid at rwth-aachen.de 7 Viktor Levandovskyy, viktor.levandovskyy at math.rwth-aachen.de 6 AUTHORS: Karim Abou Zeid, karim.abou.zeid at rwth-aachen.de@* 7 Viktor Levandovskyy, viktor.levandovskyy at math.rwth-aachen.de@* 8 8 Grischa Studzinski, grischa.studzinski at rwth-aachen.de 9 9 -
Singular/LIB/freegb.lib
rac8f852 r649021 444 444 ideal J = letplaceGBasis(I); 445 445 J; 446 } 447 448 proc lpRightStd(ideal F, ideal Q) 449 { 450 return (system("rightgb", F, Q)); 446 451 } 447 452 -
Singular/extra.cc
r552931 r649021 1243 1243 else 1244 1244 #endif 1245 /*==================== rightgb for freeGB ====================*/1245 /*==================== freeAlgebra for freeGB ==================*/ 1246 1246 #ifdef HAVE_SHIFTBBA 1247 if (strcmp(sys_cmd, "rightgb") == 0) 1248 { 1249 const short t[]={2,IDEAL_CMD,IDEAL_CMD}; 1247 if (strcmp(sys_cmd, "freeAlgebra") == 0) 1248 { 1249 // copied from freegb.cc 1250 const short t[]={2,RING_CMD,INT_CMD}; 1250 1251 if (iiCheckTypes(h,t,1)) 1251 1252 { 1252 ideal F=(ideal)h->CopyD(); 1253 ideal Q=(ideal)(h->next->CopyD()); 1254 res->rtyp = IDEAL_CMD; 1255 res->data = rightgb(F, Q); 1256 return FALSE; 1253 ring r=(ring)h->Data(); 1254 int d=(int)((long)h->next->Data()); 1255 if (d<2) 1256 { 1257 WerrorS("degree must be >=2"); 1258 return TRUE; 1259 } 1260 int i=0; 1261 while(r->order[i]!=0) 1262 { 1263 if ((r->order[i]==ringorder_c) ||(r->order[i]==ringorder_C)) i++; 1264 else if ((r->block0[i]==1)&&(r->block1[i]==r->N)) i++; 1265 else 1266 { 1267 WerrorS("only for rings with a global ordering of one block"); 1268 return TRUE; 1269 } 1270 } 1271 if ((r->order[i]!=0) 1272 || (rHasLocalOrMixedOrdering(r))) 1273 { 1274 //WerrorS("only for rings with a global ordering of one block"); 1275 Werror("only for rings with a global ordering of one block,i=%d, o=%d",i,r->order[i]); 1276 return TRUE; 1277 } 1278 ring R=freeAlgebra(r,d); 1279 res->rtyp=RING_CMD; 1280 res->data=R; 1281 return R==NULL; 1257 1282 } 1258 1283 else return TRUE; -
kernel/GBEngine/kstd1.cc
rac8f852 r649021 2568 2568 #ifdef HAVE_SHIFTBBA 2569 2569 ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp, 2570 int newIdeal, intvec *vw )2570 int newIdeal, intvec *vw, BOOLEAN rightGB) 2571 2571 { 2572 2572 ideal r; … … 2575 2575 kStrategy strat=new skStrategy; 2576 2576 intvec* temp_w=NULL; 2577 2578 strat->rightGB = rightGB; 2577 2579 2578 2580 if(!TEST_OPT_RETURN_SB) -
kernel/GBEngine/kstd1.h
rac8f852 r649021 39 39 int syzComp=0,int newIdeal=0, intvec *vw=NULL, s_poly_proc_t sp=NULL); 40 40 41 ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,42 int newIdeal, intvec *vw);41 ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** mw, intvec *hilb=NULL, 42 int syzComp=0, int newIdeal=0, intvec *vw=NULL, BOOLEAN rightGB=FALSE); 43 43 44 44 /* the following global data are defined in kutil.cc */ -
kernel/GBEngine/kstd2.cc
rac8f852 r649021 4178 4178 initBbaShift(strat); /* DONE */ 4179 4179 /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/ 4180 /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */ 4181 updateSShift(strat); /* initializes T */ 4180 /*Shdl=*/initBuchMora(F, Q,strat); 4182 4181 if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank); 4183 4182 reduc = olddeg = 0; … … 4352 4351 // posInS only depends on the leading term 4353 4352 strat->enterS(strat->P, pos, strat, strat->tl); 4354 enterTShift(strat->P, strat); 4353 if (!strat->rightGB) 4354 enterTShift(strat->P, strat); 4355 4355 } 4356 4356 … … 4369 4369 // and add pairs 4370 4370 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart); 4371 int atR=strat->tl+1; // enterTShift introduces P.p=T[tl+1], T[tl+2]... 4372 enterTShift(strat->P,strat,-1); 4373 enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, atR); 4374 strat->enterS(strat->P, pos, strat, atR); 4371 enterT(strat->P, strat); 4372 enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl); 4373 strat->enterS(strat->P, pos, strat, strat->tl); 4374 if (!strat->rightGB) 4375 enterTShift(strat->P,strat); 4375 4376 } 4376 4377 } … … 4393 4394 for (int k = 0; k <= strat->sl; ++k) 4394 4395 { 4396 if ((strat->fromQ!=NULL) && (strat->fromQ[k])) continue; // do not reduce Q_k 4395 4397 for (int j = 0; j<=strat->tl; ++j) 4396 4398 { … … 4457 4459 4458 4460 4459 ideal freegb(ideal I)4461 ideal freegb(ideal F) 4460 4462 { 4461 4463 assume(rIsLPRing(currRing)); 4462 assume(idIsInV(I)); 4463 ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL); 4464 assume(idIsInV(F)); 4465 ideal RS = kStdShift(F, NULL, testHomog, NULL); 4466 idSkipZeroes(RS); // is this even necessary? 4467 assume(idIsInV(RS)); 4468 return(RS); 4469 } 4470 4471 ideal rightgb(ideal F, ideal Q) 4472 { 4473 assume(rIsLPRing(currRing)); 4474 assume(idIsInV(F)); 4475 ideal RS = kStdShift(F, Q, testHomog, NULL, NULL, 0, 0, NULL, TRUE); 4464 4476 idSkipZeroes(RS); // is this even necessary? 4465 4477 assume(idIsInV(RS)); -
kernel/GBEngine/kutil.cc
rac8f852 r649021 8035 8035 Print("\n %d:",i); 8036 8036 p_wrp(strat->S[i], currRing, strat->tailRing); 8037 if (strat->fromQ!=NULL && strat->fromQ[i]) 8038 Print(" (from Q)"); 8037 8039 } 8038 8040 strat->news = FALSE; … … 9151 9153 enterT(h,strat); 9152 9154 strat->S_2_R[i] = strat->tl; 9155 #ifdef HAVE_SHIFTBBA 9156 if (currRing->isLPring) 9157 enterTShift(h, strat); 9158 #endif 9153 9159 } 9154 9160 } … … 9247 9253 enterT(h,strat); 9248 9254 strat->S_2_R[i] = strat->tl; 9255 #ifdef HAVE_SHIFTBBA 9256 if (currRing->isLPring) 9257 enterTShift(h, strat); 9258 #endif 9249 9259 } 9250 9260 if (suc!= -1) updateS(toT,strat); … … 9361 9371 void enterSBbaShift (LObject &p,int atS,kStrategy strat, int atR) 9362 9372 { 9363 int toInsert = itoInsert(p.p, strat->tailRing);9364 for (int i = toInsert; i > 0; i--)9373 int maxPossibleShift = p_mLPmaxPossibleShift(p.p, strat->tailRing); 9374 for (int i = maxPossibleShift; i > 0; i--) 9365 9375 { 9366 9376 LObject qq; … … 10204 10214 strat->cp = 0; 10205 10215 strat->c3 = 0; 10216 #ifdef HAVE_SHIFTBBA 10217 strat->cv = 0; 10218 #endif 10206 10219 strat->tail = pInit(); 10207 10220 /*- set s -*/ … … 10267 10280 updateS(TRUE,strat); 10268 10281 } 10269 if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int)); 10270 strat->fromQ=NULL; 10282 #ifdef HAVE_SHIFTBBA 10283 if (!(rIsLPRing(currRing) && strat->rightGB)) // for right GB, we need to check later whether a poly is from Q 10284 #endif 10285 { 10286 if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int)); 10287 strat->fromQ=NULL; 10288 } 10271 10289 assume(kTest_TS(strat)); 10272 10290 } … … 10288 10306 pLmFree(&strat->tail); 10289 10307 strat->syzComp=0; 10308 10309 #ifdef HAVE_SHIFTBBA 10310 if (rIsLPRing(currRing) && strat->rightGB) 10311 { 10312 if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int)); 10313 strat->fromQ=NULL; 10314 } 10315 #endif 10290 10316 } 10291 10317 … … 12180 12206 12181 12207 #ifdef HAVE_SHIFTBBA 12182 /* including the self pairs */ 12183 void updateSShift(kStrategy strat) 12184 { 12185 /* to use after updateS(toT=FALSE,strat) */ 12186 /* fills T with shifted elt's of S */ 12187 int i; 12188 LObject h; 12189 int atT = -1; // or figure out smth better 12190 strat->tl = -1; // init 12191 for (i=0; i<=strat->sl; i++) 12192 { 12193 memset(&h,0,sizeof(h)); 12194 h.p = strat->S[i]; 12195 strat->initEcart(&h); 12196 h.sev = strat->sevS[i]; 12197 h.t_p = NULL; 12198 h.GetTP(); // creates correct t_p 12199 /*puts the elements of S with their shifts to T*/ 12200 // int atT, int uptodeg, int lV) 12201 strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first 12202 // need a small check for above; we insert >=1 elements 12203 // insert this check into kTest_TS ? 12204 enterTShift(h,strat,atT); 12205 } 12206 /* what about setting strat->tl? */ 12208 // creates if possible (q,p), (shifts(q),p) 12209 static void enterOnePairWithShifts (int q_inS /*also i*/, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_lastVblock) 12210 { 12211 // note: ecart and isFromQ is for p 12212 assume(q_inS < 0 || strat->S[q_inS] == q); // if q is from S, q_inS should be the index of q in S 12213 assume(pmFirstVblock(p) == 1); 12214 assume(pmFirstVblock(q) == 1); 12215 assume(p_lastVblock == pmLastVblock(p)); 12216 assume(q_lastVblock == pmLastVblock(q)); 12217 12218 // TODO: is ecartq = 0 still ok? 12219 int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart 12220 12221 int q_isFromQ = 0; 12222 if (strat->fromQ != NULL && q_inS >= 0) 12223 q_isFromQ = strat->fromQ[q_inS]; 12224 12225 int degbound = currRing->N/currRing->isLPring; 12226 int neededShift = p_lastVblock - 1; 12227 int maxPossibleShift = degbound - q_lastVblock; 12228 int maxShift = si_min(neededShift, maxPossibleShift); 12229 int firstShift = (q == p ? 1 : 0); // do not add (q,p) if q=p 12230 for (int j = firstShift; j <= maxShift; j++) 12231 { 12232 poly qq = pLPCopyAndShiftLM(q, j); 12233 enterOnePairShift(qq, p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, j, q_inS); 12234 } 12207 12235 } 12208 12236 #endif 12209 12237 12210 12238 #ifdef HAVE_SHIFTBBA 12211 void initBuchMoraShift (ideal F,ideal Q,kStrategy strat) 12212 { 12213 strat->interpt = BTEST1(OPT_INTERRUPT); 12214 strat->kHEdge=NULL; 12215 if (rHasGlobalOrdering(currRing)) strat->kHEdgeFound=FALSE; 12216 /*- creating temp data structures------------------- -*/ 12217 strat->cp = 0; 12218 strat->c3 = 0; 12219 strat->cv = 0; 12220 strat->tail = pInit(); 12221 /*- set s -*/ 12222 strat->sl = -1; 12223 /*- set L -*/ 12224 strat->Lmax = setmaxL; 12225 strat->Ll = -1; 12226 strat->L = initL(); 12227 /*- set B -*/ 12228 strat->Bmax = setmaxL; 12229 strat->Bl = -1; 12230 strat->B = initL(); 12231 /*- set T -*/ 12232 strat->tl = -1; 12233 strat->tmax = setmaxT; 12234 strat->T = initT(); 12235 strat->R = initR(); 12236 strat->sevT = initsevT(); 12237 /*- init local data struct.---------------------------------------- -*/ 12238 strat->P.ecart=0; 12239 strat->P.length=0; 12240 if (rHasLocalOrMixedOrdering(currRing)) 12241 { 12242 if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak); 12243 if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak); 12244 } 12245 if(rField_is_Ring(currRing)) 12246 { 12247 /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */ 12248 } 12249 { 12250 if(TEST_OPT_SB_1) 12251 { 12252 int i; 12253 ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank); 12254 for (i=strat->newIdeal;i<IDELEMS(F);i++) 12255 { 12256 P->m[i-strat->newIdeal] = F->m[i]; 12257 F->m[i] = NULL; 12258 } 12259 initSSpecial(F,Q,P,strat); 12260 for (i=strat->newIdeal;i<IDELEMS(F);i++) 12261 { 12262 F->m[i] = P->m[i-strat->newIdeal]; 12263 P->m[i-strat->newIdeal] = NULL; 12264 } 12265 idDelete(&P); 12266 } 12267 else 12268 { 12269 /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */ 12270 // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */ 12271 } 12272 } 12273 strat->fromT = FALSE; 12274 if (!TEST_OPT_SB_1) 12275 { 12276 /* the only change: we do not fill the set T*/ 12277 if(!rField_is_Ring(currRing)) updateS(FALSE,strat); 12278 } 12279 if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int)); 12280 strat->fromQ=NULL; 12281 /* more changes: fill the set T with all the shifts of elts of S*/ 12282 /* is done by other procedure */ 12239 // creates if possible (q,p), use it when q is already shifted 12240 static void enterOnePairWithoutShifts (int p_inS /*also i*/, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_shift) 12241 { 12242 // note: ecart and isFromQ is for p 12243 assume(p_inS < 0 || strat->S[p_inS] == p); // if p is from S, p_inS should be the index of p in S 12244 assume(pmFirstVblock(p) == 1); 12245 assume(p_lastVblock == pmLastVblock(p)); 12246 assume(q_shift == pmFirstVblock(q) - 1); 12247 12248 // TODO: is ecartp = 0 still ok? 12249 int ecartp = 0; //Hans says it's ok; we're in the homog e:, no ecart 12250 12251 int p_isFromQ = 0; 12252 if (strat->fromQ != NULL && p_inS >= 0) 12253 p_isFromQ = strat->fromQ[p_inS]; 12254 12255 int maxNeededShift = p_lastVblock - 1; 12256 if (q_shift <= maxNeededShift) 12257 enterOnePairShift(q, p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, q_shift, -1); 12283 12258 } 12284 12259 #endif 12285 12260 12286 12261 #ifdef HAVE_SHIFTBBA 12287 /*1 12288 * put the pairs (sh \dot s[i],p) into the set B, ecart=ecart(p) 12289 */ 12290 static void enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR) 12291 { 12292 poly s = strat->S[i]; 12293 assume(i<=strat->sl); // from OnePair 12294 12295 /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */ 12296 /* that is create the pairs (f, s \dot g) */ 12297 12298 // poly q = pCopy(pHead(strat->S[i])); // lm in currRing 12299 // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift 12300 12301 /* determine how many elements we have to insert for a given s[i] */ 12302 /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */ 12303 /* hence, a total number of elt's to add is: */ 12304 /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */ 12305 int toInsert = itoInsert(s, currRing); 12306 12307 12308 /* these vars hold for all shifts of s[i] */ 12309 int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart 12310 12311 int qfromQ; 12312 if (strat->fromQ != NULL) 12313 { 12314 qfromQ = strat->fromQ[i]; 12315 } 12316 else 12317 { 12318 qfromQ = -1; 12319 } 12320 12321 // for the 0th shift: insert the orig. pair 12322 enterOnePairShift(s, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i); 12323 12324 for (int j = 1; j <= toInsert; j++) 12325 { 12326 poly q = pLPCopyAndShiftLM(s, j); 12327 enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i); 12328 } 12329 } 12330 #endif 12331 12332 #ifdef HAVE_SHIFTBBA 12333 /*1 12334 * put the pairs (sh \dot qq,p) into the set B, ecart=ecart(p) 12335 * despite the name, not only self shifts 12336 */ 12337 void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int /*atR*/) 12338 { 12339 /* should cycle through all shifts of q until uptodeg - lastVblock(q) */ 12340 /* that is create the pairs (f, s \dot g) */ 12341 12342 int toInsert = itoInsert(qq, currRing); 12343 12344 /* these vars hold for all shifts of s[i] */ 12345 int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart 12346 int qfromQ = 0; // strat->fromQ[i]; 12347 12348 /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 */ 12349 for (int j = 1; j<= toInsert; j++) 12350 { 12351 poly q = pLPCopyAndShiftLM(qq, j); 12352 enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1); 12353 } 12354 } 12355 #endif 12356 12357 #ifdef HAVE_SHIFTBBA 12262 12263 #ifdef KDEBUG 12264 // enable to print which pairs are considered or discarded and why 12265 /* #define CRITERION_DEBUG */ 12266 #endif 12358 12267 /*2 12359 12268 * put the pair (q,p) into the set B, ecart=ecart(p), q is the shift of some s[i] … … 12361 12270 void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS) 12362 12271 { 12272 #ifdef CRITERION_DEBUG 12273 if (TEST_OPT_DEBUG) 12274 { 12275 PrintS("Consider pair ("); wrp(q); PrintS(", "); wrp(p); PrintS(")"); PrintLn(); 12276 // also write the LMs in separate lines: 12277 poly lmq = pHead(q); 12278 poly lmp = pHead(p); 12279 pSetCoeff(lmq, n_Init(1, currRing->cf)); 12280 pSetCoeff(lmp, n_Init(1, currRing->cf)); 12281 Print(" %s\n", pString(lmq)); 12282 Print(" %s\n", pString(lmp)); 12283 pLmDelete(lmq); 12284 pLmDelete(lmp); 12285 } 12286 #endif 12363 12287 12364 12288 /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */ … … 12370 12294 assume(p_CheckIsFromRing(pNext(p),strat->tailRing)); 12371 12295 12372 #ifdef KDEBUG12373 // if (TEST_OPT_DEBUG)12374 // {12375 // PrintS("enterOnePairShift(q,p) invoked with q = ");12376 // wrp(q); // wrp(pHead(q));12377 // PrintS(", p = ");12378 // wrp(p); //wrp(pHead(p));12379 // PrintLn();12380 // }12381 #endif12382 12383 12296 /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */ 12384 12297 … … 12397 12310 Lp.lcm = p_Lcm(p,q, currRing); // q is what was strat->S[i], so a poly in LM/TR presentation 12398 12311 12399 /* apply the V criterion */ 12400 if (!pIsInV(Lp.lcm)) 12401 { 12402 #ifdef KDEBUG 12403 if (TEST_OPT_DEBUG) 12404 { 12405 PrintS("V crit applied to q = "); 12406 wrp(q); // wrp(pHead(q)); 12407 PrintS(", p = "); 12408 wrp(p); //wrp(pHead(p)); 12409 PrintLn(); 12410 } 12411 #endif 12312 /* the V criterion */ 12313 if (!pmIsInV(Lp.lcm)) 12314 { 12315 strat->cv++; // counter for applying the V criterion 12412 12316 pLmFree(Lp.lcm); 12413 /* + counter for applying the V criterion */ 12414 strat->cv++; 12317 #ifdef CRITERION_DEBUG 12318 if (TEST_OPT_DEBUG) PrintS("--- V crit\n"); 12319 #endif 12415 12320 return; 12416 12321 } … … 12437 12342 strat->cp++; 12438 12343 pLmFree(Lp.lcm); 12344 #ifdef CRITERION_DEBUG 12345 if (TEST_OPT_DEBUG) PrintS("--- prod crit\n"); 12346 #endif 12439 12347 return; 12440 12348 } … … 12444 12352 { 12445 12353 pLmFree(Lp.lcm); 12354 #ifdef CRITERION_DEBUG 12355 if (TEST_OPT_DEBUG) PrintS("--- ecartq > ecart\n"); 12356 #endif 12446 12357 return; 12447 12358 /*the pair is (s[i],t[.]), discard it if the ecart is too big*/ … … 12466 12377 { 12467 12378 pLmFree(Lp.lcm); 12379 #ifdef CRITERION_DEBUG 12380 if (TEST_OPT_DEBUG) Print("--- divided by B[%d]\n", j); 12381 #endif 12468 12382 return; 12469 12383 } … … 12475 12389 { 12476 12390 deleteInL(strat->B,&strat->Bl,j,strat); 12391 #ifdef CRITERION_DEBUG 12392 if (TEST_OPT_DEBUG) Print("divides B[%d] -> delete B[%d]\n", j, j); 12393 #endif 12477 12394 strat->c3++; 12478 12395 } … … 12504 12421 strat->cp++; 12505 12422 pLmFree(Lp.lcm); 12423 #ifdef CRITERION_DEBUG 12424 if (TEST_OPT_DEBUG) PrintS("--- prod crit\n"); 12425 #endif 12506 12426 return; 12507 12427 } … … 12509 12429 { 12510 12430 pLmFree(Lp.lcm); 12431 #ifdef CRITERION_DEBUG 12432 if (TEST_OPT_DEBUG) PrintS("--- ecartq > ecart\n"); 12433 #endif 12511 12434 return; 12512 12435 /*the pair is (s[i],t[.]), discard it if the ecart is too big*/ … … 12527 12450 { 12528 12451 pLmFree(Lp.lcm); 12452 #ifdef CRITERION_DEBUG 12453 if (TEST_OPT_DEBUG) Print("--- divided by B[%d]\n", j); 12454 #endif 12529 12455 return; 12530 12456 } … … 12535 12461 { 12536 12462 deleteInL(strat->B,&strat->Bl,j,strat); 12463 #ifdef CRITERION_DEBUG 12464 if (TEST_OPT_DEBUG) Print("divides B[%d] -> delete B[%d]\n", j, j); 12465 #endif 12537 12466 strat->c3++; 12538 12467 } … … 12547 12476 pNorm(p); 12548 12477 if ((q==NULL) || (p==NULL)) 12478 { 12479 #ifdef CRITERION_DEBUG 12480 if (TEST_OPT_DEBUG) PrintS("--- q == NULL || p == NULL\n"); 12481 #endif 12549 12482 return; 12483 } 12550 12484 if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0)) 12485 { 12551 12486 Lp.p=NULL; 12487 #ifdef CRITERION_DEBUG 12488 if (TEST_OPT_DEBUG) PrintS("--- pair from Q\n"); 12489 #endif 12490 } 12552 12491 else 12553 12492 { … … 12607 12546 */ 12608 12547 if (Lp.lcm!=NULL) pLmFree(Lp.lcm); 12548 #ifdef CRITERION_DEBUG 12549 if (TEST_OPT_DEBUG) PrintS("--- S-poly = 0\n"); 12550 #endif 12609 12551 } 12610 12552 else … … 12643 12585 l = strat->posInL(strat->B,strat->Bl,&Lp,strat); 12644 12586 enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l); 12587 #ifdef CRITERION_DEBUG 12588 if (TEST_OPT_DEBUG) PrintS("+++ Entered pair\n"); 12589 #endif 12645 12590 } 12646 12591 } … … 12655 12600 void initenterpairsShift (poly h,int k,int ecart,int isFromQ, kStrategy strat, int atR) 12656 12601 { 12602 int h_lastVblock = pmLastVblock(h); 12603 assume(h_lastVblock != 0 || pLmIsConstantComp(h)); 12604 // TODO: is it allowed to skip pairs with constants? also with constants from other components? 12605 if (h_lastVblock == 0) return; 12606 assume(pmFirstVblock(h) == 1); 12657 12607 /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */ 12658 12608 // atR = -1; … … 12660 12610 || (pGetComp(h)<=strat->syzComp)) 12661 12611 { 12662 int j;12612 int i,j; 12663 12613 BOOLEAN new_pair=FALSE; 12664 12614 12615 int degbound = currRing->N/currRing->isLPring; 12616 int maxShift = degbound - h_lastVblock; 12617 12665 12618 if (pGetComp(h)==0) 12666 12619 { 12620 if (strat->rightGB) 12621 { 12622 if (isFromQ) 12623 { 12624 // pairs (shifts(h),s[1..k]), (h, s[1..k]) 12625 for (i=0; i<=maxShift; i++) 12626 { 12627 poly hh = pLPCopyAndShiftLM(h, i); 12628 for (j=0; j<=k; j++) 12629 { 12630 if (strat->fromQ == NULL || !strat->fromQ[j]) 12631 { 12632 new_pair=TRUE; 12633 poly s = strat->S[j]; 12634 enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i); 12635 } 12636 } 12637 } 12638 } 12639 else 12640 { 12641 new_pair=TRUE; 12642 for (j=0; j<=k; j++) 12643 { 12644 poly s = strat->S[j]; 12645 if (strat->fromQ != NULL && strat->fromQ[j]) 12646 { 12647 // pairs (shifts(s[j]),h), (s[j],h) 12648 enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s)); 12649 } 12650 else 12651 { 12652 // pair (h, s[j]) 12653 enterOnePairWithoutShifts(j, h, s, ecart, isFromQ, strat, atR, pmLastVblock(s), 0); 12654 } 12655 } 12656 } 12657 } 12667 12658 /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/ 12668 if ((isFromQ)&&(strat->fromQ!=NULL))12669 { 12670 for (j=0; j<=k; j++)12671 {12659 else if ((isFromQ)&&(strat->fromQ!=NULL)) 12660 { 12661 // pairs (shifts(s[1..k]),h), (s[1..k],h) 12662 for (j=0; j<=k; j++) { 12672 12663 if (!strat->fromQ[j]) 12673 12664 { 12674 12665 new_pair=TRUE; 12675 enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR); 12676 // other side pairs: 12677 enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR); 12678 //Print("j:%d, Ll:%d\n",j,strat->Ll); 12666 poly s = strat->S[j]; 12667 enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s)); 12679 12668 } 12680 12669 } 12670 // pairs (shifts(h),s[1..k]) 12671 if (new_pair) 12672 { 12673 for (i=1; i<=maxShift; i++) 12674 { 12675 poly hh = pLPCopyAndShiftLM(h, i); 12676 for (j=0; j<=k; j++) 12677 { 12678 if (!strat->fromQ[j]) 12679 { 12680 poly s = strat->S[j]; 12681 enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i); 12682 } 12683 } 12684 } 12685 } 12681 12686 } 12682 12687 else 12683 12688 { 12684 12689 new_pair=TRUE; 12690 // pairs (shifts(s[1..k]),h), (s[1..k],h) 12691 for (j=0; j<=k; j++) { 12692 poly s = strat->S[j]; 12693 // TODO: cache lastVblock of s[1..k] for later use 12694 enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s)); 12695 } 12696 // pairs (shifts(h),s[1..k]), (shifts(h), h) 12697 for (i=1; i<=maxShift; i++) 12698 { 12699 poly hh = pLPCopyAndShiftLM(h, i); 12700 for (j=0; j<=k; j++) 12701 { 12702 poly s = strat->S[j]; 12703 enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i); 12704 } 12705 enterOnePairWithoutShifts(-1, hh, h, ecart, isFromQ, strat, atR, h_lastVblock, i); 12706 } 12707 } 12708 } 12709 else 12710 { 12711 new_pair=TRUE; 12712 if (strat->rightGB) 12713 { 12685 12714 for (j=0; j<=k; j++) 12686 12715 { 12687 enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR); 12688 // other side pairs 12689 enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR); 12690 } 12691 /* HERE we put (h, s*h) pairs */ 12692 /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */ 12693 enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR); 12694 } 12695 } 12696 else 12697 { 12698 for (j=0; j<=k; j++) 12699 { 12700 if ((pGetComp(h)==pGetComp(strat->S[j])) 12701 || (pGetComp(strat->S[j])==0)) 12702 { 12703 new_pair=TRUE; 12704 enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR); 12705 // other side pairs 12706 enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR); 12707 //Print("j:%d, Ll:%d\n",j,strat->Ll); 12708 } 12709 } 12710 /* HERE we put (h, s*h) pairs */ 12711 enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR); 12716 if ((pGetComp(h)==pGetComp(strat->S[j])) 12717 || (pGetComp(strat->S[j])==0)) 12718 { 12719 assume(isFromQ == 0); // this case is not handeled here and should also never happen 12720 poly s = strat->S[j]; 12721 if (strat->fromQ != NULL && strat->fromQ[j]) 12722 { 12723 // pairs (shifts(s[j]),h), (s[j],h) 12724 enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s)); 12725 } 12726 else 12727 { 12728 // pair (h, s[j]) 12729 enterOnePairWithoutShifts(j, h, s, ecart, isFromQ, strat, atR, pmLastVblock(s), 0); 12730 } 12731 } 12732 } 12733 } 12734 else 12735 { 12736 // pairs (shifts(s[1..k]),h), (s[1..k],h) 12737 for (j=0; j<=k; j++) { 12738 if ((pGetComp(h)==pGetComp(strat->S[j])) 12739 || (pGetComp(strat->S[j])==0)) 12740 { 12741 poly s = strat->S[j]; 12742 enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s)); 12743 } 12744 } 12745 // pairs (shifts(h),s[1..k]), (shifts(h), h) 12746 for (i=1; i<=maxShift; i++) 12747 { 12748 poly hh = pLPCopyAndShiftLM(h, i); 12749 for (j=0; j<=k; j++) 12750 { 12751 if ((pGetComp(h)==pGetComp(strat->S[j])) 12752 || (pGetComp(strat->S[j])==0)) 12753 { 12754 poly s = strat->S[j]; 12755 enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i); 12756 } 12757 } 12758 enterOnePairWithoutShifts(-1, hh, h, ecart, isFromQ, strat, atR, h_lastVblock, i); 12759 } 12760 } 12712 12761 } 12713 12762 … … 12738 12787 ||(pGetComp(h)<=strat->syzComp))) 12739 12788 { 12740 //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);12741 12789 unsigned long h_sev = pGetShortExpVector(h); 12742 12790 loop 12743 12791 { 12744 12792 if (j > k) break; 12745 clearS(h,h_sev, &j,&k,strat); 12793 // TODO this currently doesn't clear all possible elements because of commutative division 12794 if (!(strat->rightGB && strat->fromQ != NULL && strat->fromQ[j])) 12795 clearS(h,h_sev, &j,&k,strat); 12746 12796 j++; 12747 12797 } 12748 //Print("end clearS sl=%d\n",strat->sl); 12749 } 12750 // PrintS("end enterpairs\n"); 12798 } 12751 12799 } 12752 12800 #endif … … 12765 12813 pAssume(p.p != NULL); 12766 12814 12767 int toInsert = itoInsert(p.p, strat->tailRing);12768 12769 for (int i = 1; i <= toInsert; i++)12815 int maxPossibleShift = p_mLPmaxPossibleShift(p.p, strat->tailRing); 12816 12817 for (int i = 1; i <= maxPossibleShift; i++) 12770 12818 { 12771 12819 LObject qq; -
kernel/GBEngine/kutil.h
rac8f852 r649021 368 368 #ifdef HAVE_SHIFTBBA 369 369 int cv; // in shift bases: counting V criterion 370 /*BOOLEAN*/ char rightGB; 370 371 #endif 371 372 /*BOOLEAN*/ char interpt; … … 852 853 void enterTShift(LObject p, kStrategy strat, int atT = -1); 853 854 854 void initBuchMoraShift (ideal F,ideal Q,kStrategy strat);855 856 void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR);857 858 855 void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS); 859 856 860 857 void enterpairsShift (poly h,int k,int ecart,int pos,kStrategy strat, int atR); 861 858 862 void updateSShift(kStrategy strat);863 864 859 void initBbaShift(kStrategy strat); 865 860 … … 868 863 int redFirstShift (LObject* h,kStrategy strat); // ok 869 864 870 ideal freegb(ideal I); 865 ideal freegb(ideal F); 866 ideal rightgb(ideal F, ideal Q); 871 867 872 868 ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat); -
kernel/GBEngine/shiftgb.cc
rac8f852 r649021 43 43 } 44 44 45 /* for poly in lmCR/tailTR presentation */ 46 int itoInsert(poly p, const ring r) 45 int p_mLPmaxPossibleShift(poly p, const ring r) 47 46 { 48 /* the below situation (commented out) might happen! */ 49 // if (r == currRing) 50 // { 51 // "Current ring is not expected in toInsert"; 52 // return(0); 53 // } 54 /* compute the number of insertions */ 55 int i = p_mLastVblock(p, currRing); 56 if (pNext(p) != NULL) 57 { 58 i = si_max(i, p_LastVblock(pNext(p), r) ); 59 } 60 // i = uptodeg - i +1; 47 int lastBlock = p_mLastVblock(p, r); 48 if (lastBlock == 0) return 0; 61 49 int uptodeg = r->N/r->isLPring; 62 // p_wrp(p,currRing,r); Print("----i:%d",i); PrintLn(); 63 return uptodeg - i; 50 return uptodeg - lastBlock; 64 51 } 65 52 -
kernel/GBEngine/shiftgb.h
rac8f852 r649021 15 15 #define pLPCopyAndShiftLM(p, sh) p_LPCopyAndShiftLM(p, sh, currRing) 16 16 17 int itoInsert(poly p, const ring r); 17 int p_mLPmaxPossibleShift(poly p, const ring r); 18 #define pmLPmaxPossibleShift(p) p_mLPmaxPossibleShift(p, currRing) 18 19 19 20 #endif -
libpolys/polys/shiftop.cc
r552931 r649021 823 823 return NULL; 824 824 } 825 int ** wvhdl=(int**)omAlloc0((r->N+ 2)*sizeof(int*));826 rRingOrder_t* ord=(rRingOrder_t*)omAlloc0((r->N+ 2)*sizeof(rRingOrder_t));827 int* blk0=(int*)omAlloc0((r->N+ 2)*sizeof(int));828 int* blk1=(int*)omAlloc0((r->N+ 2)*sizeof(int));825 int ** wvhdl=(int**)omAlloc0((r->N+3)*sizeof(int*)); 826 rRingOrder_t* ord=(rRingOrder_t*)omAlloc0((r->N+3)*sizeof(rRingOrder_t)); 827 int* blk0=(int*)omAlloc0((r->N+3)*sizeof(int)); 828 int* blk1=(int*)omAlloc0((r->N+3)*sizeof(int)); 829 829 omFree(R->wvhdl); R->wvhdl=wvhdl; 830 830 omFree(R->order); R->order=ord; … … 834 834 { 835 835 ord[i+p]=ringorder_a; 836 //Print("entry:%d->a\n",i+p); 836 837 blk0[i+p]=1; 837 838 blk1[i+p]=R->N; … … 847 848 } 848 849 ord[r->N+p]=r->order[p]; /* lp or rp */ 850 //Print("entry:%d->lp\n",r->N+p); 849 851 blk0[r->N+p]=1; 850 852 blk1[r->N+p]=R->N; … … 857 859 return NULL; 858 860 } 861 //if (p==1) PrintS("entry:0 ->c/C\n"); 862 //else if (p==0) Print("entry:%d ->c/C\n",r->N+1); 859 863 break; 860 864 }
Note: See TracChangeset
for help on using the changeset viewer.