Changeset 1798a0 in git for kernel/GBEngine
- Timestamp:
- Jun 25, 2016, 10:27:17 AM (8 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- c66a53f1b58e7f846551ad48a7866b06bf852f5f
- Parents:
- a63783098c106e45b49628a363a780d9533a027f
- Location:
- kernel/GBEngine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/GBEngine/kutil.cc
ra63783 r1798a0 17 17 // 0 - All 18 18 #define ALL_VS_JUST 0 19 //Extended Spoly Strategy: 20 // 0 - new gen sig 21 // 1 - ann*old sig 22 #define EXT_POLY_NEW 0 19 23 20 24 #include <kernel/mod2.h> … … 2502 2506 strat->sigdrop = TRUE; 2503 2507 //Try to reduce it as far as we can via redRing 2504 Lp.p = pCopy(p); 2508 if(rField_is_Ring(currRing)) 2509 { 2510 poly p1 = p_Copy(p,currRing); 2511 poly p2 = p_Copy(strat->S[i],currRing); 2512 p1 = p_Mult_mm(p1,m1,currRing); 2513 p2 = p_Mult_mm(p2,m2,currRing); 2514 Lp.p = p_Sub(p1,p2,currRing); 2515 if(Lp.p != NULL) 2516 Lp.sev = p_GetShortExpVector(Lp.p,currRing); 2517 } 2505 2518 int red_result = redRing(&Lp,strat); 2506 2519 #if ADIDEBUG … … 2603 2616 { 2604 2617 //Build p 2605 #ifdef HAVE_RINGS2606 2618 if(rField_is_Ring(currRing)) 2607 2619 { … … 2615 2627 } 2616 2628 else 2617 #endif2618 2629 { 2619 2630 #ifdef HAVE_PLURAL … … 4336 4347 p = p_LmFreeAndNext(p, strat->tailRing); 4337 4348 pNext(tmp) = p; 4338 LObject h;4339 h.Init();4340 h.p = tmp;4341 h.tailRing = strat->tailRing;4349 LObject Lp; 4350 Lp.Init(); 4351 Lp.p = tmp; 4352 Lp.tailRing = strat->tailRing; 4342 4353 int posx; 4343 if (h.p!=NULL) 4344 { 4345 if (TEST_OPT_INTSTRATEGY) 4346 { 4347 //pContent(h.p); 4348 h.pCleardenom(); // also does a pContent 4349 } 4350 else 4351 { 4352 h.pNorm(); 4353 } 4354 strat->initEcart(&h); 4354 if (Lp.p!=NULL) 4355 { 4356 strat->initEcart(&Lp); 4355 4357 if (strat->Ll==-1) 4356 4358 posx =0; 4357 4359 else 4358 posx = strat->posInL(strat->L,strat->Ll,& h,strat);4359 h.sev = pGetShortExpVector(h.p);4360 posx = strat->posInL(strat->L,strat->Ll,&Lp,strat); 4361 Lp.sev = pGetShortExpVector(Lp.p); 4360 4362 if (strat->tailRing != currRing) 4361 4363 { 4362 h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);4364 Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing); 4363 4365 } 4364 4366 #ifdef KDEBUG … … 4369 4371 } 4370 4372 #endif 4373 enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx); 4374 } 4375 } 4376 } 4377 nDelete(&gcd); 4378 } 4379 4380 void enterExtendedSpolySig(poly h,poly hSig,kStrategy strat) 4381 { 4382 if (nIsOne(pGetCoeff(h))) return; 4383 number gcd; 4384 bool go = false; 4385 if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf)) 4386 { 4387 gcd = n_Ann(pGetCoeff(h),currRing->cf); 4388 go = true; 4389 } 4390 else 4391 gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf); 4392 if (go || !nIsOne(gcd)) 4393 { 4394 poly p = h->next; 4395 if (!go) 4396 { 4397 number tmp = gcd; 4398 gcd = n_Ann(gcd,currRing->cf); 4399 nDelete(&tmp); 4400 } 4401 p_Test(p,strat->tailRing); 4402 p = pp_Mult_nn(p, gcd, strat->tailRing); 4403 4404 if (p != NULL) 4405 { 4406 if (TEST_OPT_PROT) 4407 { 4408 PrintS("Z"); 4409 } 4410 #ifdef KDEBUG 4411 if (TEST_OPT_DEBUG) 4412 { 4413 PrintS("--- create zero spoly: "); 4414 p_wrp(h,currRing,strat->tailRing); 4415 PrintS(" ---> "); 4416 } 4417 #endif 4418 poly tmp = pInit(); 4419 pSetCoeff0(tmp, pGetCoeff(p)); 4420 for (int i = 1; i <= rVar(currRing); i++) 4421 { 4422 pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing)); 4423 } 4424 if (rRing_has_Comp(currRing) && rRing_has_Comp(strat->tailRing)) 4425 { 4426 p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing); 4427 } 4428 p_Setm(tmp, currRing); 4429 p = p_LmFreeAndNext(p, strat->tailRing); 4430 pNext(tmp) = p; 4431 LObject Lp; 4432 Lp.Init(); 4433 Lp.p = tmp; 4434 //printf("\nOld\n");pWrite(h);pWrite(hSig); 4435 #if EXT_POLY_NEW 4436 Lp.sig = pp_Mult_nn(hSig, gcd, currRing); 4437 if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig))) 4438 { 4439 #if ADIDEBUG 4440 printf("\nSigdrop in enterextended spoly\n");pWrite(h);pWrite(hSig); 4441 #endif 4442 strat->sigdrop = TRUE; 4443 //Try to reduce it as far as we can via redRing 4444 int red_result = redRing(&Lp,strat); 4445 #if ADIDEBUG 4446 printf("\nAfter redRing reduce:\n");pWrite(Lp.p); 4447 #endif 4448 if(red_result == 0) 4449 { 4450 // Cancel the sigdrop 4451 #if ADIDEBUG 4452 printf("\nCancel the sigdrop. It reduced to 0\n"); 4453 #endif 4454 p_Delete(&Lp.sig,currRing);Lp.sig = NULL; 4455 strat->sigdrop = FALSE; 4456 return; 4457 } 4458 else 4459 { 4460 #if ADIDEBUG 4461 printf("\nSigdrop. end\n"); 4462 #endif 4463 strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1); 4464 #if 1 4465 strat->enterS(Lp,0,strat,strat->tl); 4466 #endif 4467 return; 4468 } 4469 4470 } 4471 #else 4472 Lp.sig = pOne(); 4473 if(strat->Ll >= 0) 4474 p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing); 4475 else 4476 p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing); 4477 #endif 4478 Lp.tailRing = strat->tailRing; 4479 int posx; 4480 if (Lp.p!=NULL) 4481 { 4482 strat->initEcart(&Lp); 4483 if (strat->Ll==-1) 4484 posx =0; 4485 else 4486 posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat); 4487 Lp.sev = pGetShortExpVector(Lp.p); 4488 if (strat->tailRing != currRing) 4489 { 4490 Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing); 4491 } 4492 #ifdef KDEBUG 4493 if (TEST_OPT_DEBUG) 4494 { 4495 p_wrp(tmp,currRing,strat->tailRing); 4496 PrintLn(); 4497 } 4498 #endif 4371 4499 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx); 4372 } 4373 } 4500 enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx); 4501 } 4502 } 4503 nDelete(&gcd); 4374 4504 } 4375 4505 nDelete(&gcd); … … 4418 4548 assume (rField_is_Ring_Z(currRing)); 4419 4549 // enter also zero divisor * poly, if this is non zero and of smaller degree 4420 //if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat); 4550 #if ADIDEBUG 4551 printf("\n Trying to add extended spolys\n"); 4552 #endif 4553 if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat); 4554 if(strat->sigdrop) return; 4421 4555 #if ADIDEBUG 4422 4556 printf("\n Trying to add spolys\n"); 4423 4557 #endif 4424 4558 initenterpairsSig(h, hSig, hFrom, k, ecart, 0, strat, atR); 4559 if(strat->sigdrop) return; 4425 4560 #if ADIDEBUG 4426 4561 printf("\n Trying to add gcd-polys\n"); 4427 4562 #endif 4428 4563 initenterstrongPairsSig(h, hSig, hFrom,k, ecart, 0, strat, atR); 4564 if(strat->sigdrop) return; 4429 4565 clearSbatch(h, k, pos, strat); 4430 4566 } -
kernel/GBEngine/kutil.h
ra63783 r1798a0 508 508 int redRiloc (LObject* h,kStrategy strat); 509 509 void enterExtendedSpoly(poly h,kStrategy strat); 510 void enterExtendedSpolySig(poly h,poly hSig,kStrategy strat); 510 511 void superenterpairs (poly h,int k,int ecart,int pos,kStrategy strat, int atR = -1); 511 512 void superenterpairsSig (poly h,poly hSig,int hFrom,int k,int ecart,int pos,kStrategy strat, int atR = -1);
Note: See TracChangeset
for help on using the changeset viewer.