Changeset 8fdfee7 in git


Ignore:
Timestamp:
Jun 15, 2018, 6:46:25 PM (6 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
abfdab3ebcf881e1326c72d6772ac062164d904e
Parents:
b00f8a34fb50dbff4746ce45d0680d242f28260c
Message:
Fix a bug where S might not be completely reduced. Also make shiftBba more like bba.
Location:
kernel/GBEngine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/kstd2.cc

    rb00f8a r8fdfee7  
    38673867  int   olddeg,reduc;
    38683868  int hilbeledeg=1,hilbcount=0,minimcnt=0;
    3869   BOOLEAN withT = TRUE; // very important for shifts
     3869  BOOLEAN withT = TRUE; // currently only T contains the shifts
     3870  BITSET save;
     3871  SI_SAVE_OPT1(save);
    38703872
    38713873  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
     
    38793881  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
    38803882  updateSShift(strat); /* initializes T */
    3881 
    38823883  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
    38833884  reduc = olddeg = 0;
     
    38873888    strat->use_buckets = 1;
    38883889#endif
    3889 
    38903890  // redtailBBa against T for inhomogenous input
    38913891  //  if (!TEST_OPT_OLDSTD)
     
    39003900#endif
    39013901
     3902
     3903#ifdef KDEBUG
     3904  //kDebugPrint(strat);
     3905#endif
    39023906  /* compute------------------------------------------------------- */
    39033907  while (strat->Ll >= 0)
     
    39743978    if (red_result == 1)
    39753979    {
     3980      // get the polynomial (canonicalize bucket, make sure P.p is set)
     3981      strat->P.GetP(strat->lmBin);
     3982      // in the homogeneous case FDeg >= pFDeg (sugar/honey)
     3983      // but now, for entering S, T, we reset it
     3984      // in the inhomogeneous case: FDeg == pFDeg
     3985      if (strat->homog) strat->initEcart(&(strat->P));
     3986
    39763987      /* statistic */
    39773988      if (TEST_OPT_PROT) PrintS("s");
    39783989
    3979       // get the polynomial (canonicalize bucket, make sure P.p is set)
    3980       strat->P.GetP(strat->lmBin);
    3981 
    39823990      int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
    39833991
    39843992      // reduce the tail and normalize poly
     3993      // in the ring case we cannot expect LC(f) = 1,
     3994      // therefore we call pCleardenom instead of pNorm
    39853995      strat->redTailChange=FALSE;
    39863996      if (TEST_OPT_INTSTRATEGY)
     
    39934003          if (strat->redTailChange) {
    39944004            strat->P.t_p=NULL;
    3995             // for some reason length and pLength are set to 0 in redtailBba
    3996             strat->initEcart(&(strat->P));
    39974005          }
    39984006        }
     
    40054013          if (strat->redTailChange) {
    40064014            strat->P.t_p=NULL;
    4007             // for some reason length and pLength are set to 0 in redtailBba
    4008             strat->initEcart(&(strat->P));
    40094015          }
    40104016        }
     
    40384044
    40394045      // enter into S, L, and T
    4040       //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
    4041       //        enterT(strat->P, strat); // this was here before Shift stuff
    4042       //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
    4043       // the default value for atT = -1 as in bba
    4044       /*   strat->P.GetP(); */
    4045       // because shifts are counted with .p structure // done before, but ?
    4046       int atR=strat->tl+1; // enterTShift introduces T[tl+1], T[tl+2]...
    4047                            // with T[tl+1]=P.p
    4048       enterTShift(strat->P,strat,-1);
    4049       enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, atR);
    4050       //      enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
    4051       // posInS only depends on the leading term
    4052       strat->enterS(strat->P, pos, strat, atR);
     4046      if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
     4047      {
     4048        int atR=strat->tl+1; // enterTShift introduces P.p=T[tl+1], T[tl+2]...
     4049        enterTShift(strat->P,strat,-1);
     4050        enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, atR);
     4051        // posInS only depends on the leading term
     4052        strat->enterS(strat->P, pos, strat, atR);
     4053      }
    40534054
    40544055      if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
    40554056//      Print("[%d]",hilbeledeg);
    4056       if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
     4057      if (strat->P.lcm!=NULL) {
     4058        pLmFree(strat->P.lcm);
     4059        strat->P.lcm=NULL;
     4060      }
     4061      if (strat->s_poly!=NULL)
     4062      {
     4063        // the only valid entries are: strat->P.p,
     4064        // strat->tailRing (read-only, keep it)
     4065        // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
     4066        if (strat->s_poly(strat))
     4067        {
     4068          // we are called AFTER enterS, i.e. if we change P
     4069          // we have to add it also to S/T
     4070          // and add pairs
     4071          int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
     4072          int atR=strat->tl+1; // enterTShift introduces P.p=T[tl+1], T[tl+2]...
     4073          enterTShift(strat->P,strat,-1);
     4074          enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, atR);
     4075          strat->enterS(strat->P, pos, strat, atR);
     4076        }
     4077      }
    40574078    }
    40584079    else if (strat->P.p1 == NULL && strat->minim > 0)
     
    40684089  if (TEST_OPT_DEBUG) messageSets(strat);
    40694090#endif
     4091  /*  shift case: look for elt's in S such that they are divisible by elt in T */
     4092  if ((TEST_OPT_SB_1 || TEST_OPT_REDSB) && !strat->noClearS) // when is OPT_SB_1 set?
     4093  {
     4094    for (int k = 0; k <= strat->sl; ++k)
     4095    {
     4096      for (int j = 0; j<=strat->tl; ++j)
     4097      {
     4098        // this is like clearS in bba, but we reduce with elements from T, because it contains the shifts too
     4099        assume(strat->sevT[j] == pGetShortExpVector(strat->T[j].p));
     4100        assume(strat->sevS[k] == pGetShortExpVector(strat->S[k]));
     4101        if (pLmShortDivisibleBy(strat->T[j].p, strat->sevT[j], strat->S[k], ~strat->sevS[k]))
     4102        {
     4103          if (pLmCmp(strat->T[j].p, strat->S[k]) != 0) { // check whether LM is different
     4104            deleteInS(k, strat);
     4105            --k;
     4106            break;
     4107          }
     4108        }
     4109      }
     4110    }
     4111  }
    40704112  /* complete reduction of the standard basis--------- */
    4071   /*  shift case: look for elt's in S such that they are divisible by elt in T */
    4072   //  if (TEST_OPT_SB_1)
    40734113  if (TEST_OPT_REDSB)
    40744114  {
    4075     int k=0;
    4076     int j=-1;
    4077     while(k<=strat->sl)
    4078     {
    4079 //       loop
    4080 //       {
    4081 //         if (j>=k) break;
    4082 //         clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
    4083 //         j++;
    4084 //       }
    4085       LObject Ln (strat->S[k],currRing, strat->tailRing);
    4086       Ln.SetShortExpVector();
    4087       j = kFindDivisibleByInT(strat, &Ln, j+1);
    4088       if (j<0) {  k++; j=-1;}
    4089       else
    4090       {
    4091         if ( pLmCmp(strat->S[k],strat->T[j].p) == 0)
    4092         {
    4093           j = kFindDivisibleByInT(strat, &Ln, j+1);
    4094           if (j<0) {  k++; j=-1;}
    4095           else
    4096           {
    4097             deleteInS(k,strat);
    4098           }
    4099         }
    4100         else
    4101         {
    4102           deleteInS(k,strat);
    4103         }
    4104       }
    4105     }
    4106   }
    4107 
    4108   if (TEST_OPT_REDSB)
    4109   {    completeReduce(strat, TRUE); //shift: withT = TRUE
     4115    completeReduce(strat, TRUE); //shift: withT = TRUE
    41104116    if (strat->completeReduce_retry)
    41114117    {
     
    41204126        int i;
    41214127        for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
     4128        WarnS("reduction with S is not yet supported by Letterplace"); // if this ever happens, we'll know
    41224129        completeReduce(strat);
    41234130      }
     
    41404147//    }
    41414148//  }
    4142   if (TEST_OPT_PROT) messageStat(hilbcount,strat);
     4149  if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
     4150  SI_RESTORE_OPT1(save);
     4151  /* postprocessing for GB over Q-rings ------------------*/
    41434152  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
     4153
     4154  idTest(strat->Shdl);
     4155
    41444156  return (strat->Shdl);
    41454157}
  • kernel/GBEngine/kutil.cc

    rb00f8a r8fdfee7  
    1251312513  int toInsert = itoInsert(p.p, strat->tailRing);
    1251412514
    12515 #ifdef PDEBUG
    12516   //  Print("enterTShift uses toInsert: %d", toInsert);  PrintLn();
    12517 #endif
    12518   int i;
    12519 
    12520   if (atT < 0)
    12521     atT = strat->posInT(strat->T, strat->tl, p);
    12522 
    1252312515  /* can call enterT in a sequence, e.g. */
    1252412516
     
    1252612518  enterT(p,strat,atT);
    1252712519  LObject qq;
    12528   for (i=1; i<=toInsert; i++) // toIns - 1?
     12520  for (int i=1; i<=toInsert; i++)
    1252912521  {
    1253012522    qq      = p; //qq.Copy();
     
    1254012532    #endif
    1254112533    /* enter it into T, first el't is with the shift 0 */
    12542     // compute the position for qq
    12543     atT = strat->posInT(strat->T, strat->tl, qq);
    1254412534    enterT(qq,strat,atT);
    1254512535  }
    12546 /* Q: what to do with this one in the orig enterT ? */
    12547 /*  strat->R[strat->tl] = &(strat->T[atT]); */
    12548 /* Solution: it is done by enterT each time separately */
    1254912536}
    1255012537#endif
Note: See TracChangeset for help on using the changeset viewer.