Changeset dc3320 in git for kernel


Ignore:
Timestamp:
Oct 5, 2018, 12:05:24 PM (6 years ago)
Author:
Christian Eder
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
85fb25bbf3405cac363858b74d2615e61408f47b
Parents:
fa0da562502d39f038ce67ba9fb806b4f4cebb3b
git-author:
Christian Eder <ederc@mathematik.uni-kl.de>2018-10-05 12:05:24+02:00
git-committer:
Christian Eder <ederc@mathematik.uni-kl.de>2018-10-05 12:37:42+02:00
Message:
adds a new tail reduction function for Z also cutting down tail coefficients if possible
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/kutil.cc

    rfa0da5 rdc3320  
    78677867
    78687868#ifdef HAVE_RINGS
     7869void redtailBbaAlsoLC_Z (LObject* L, int end_pos, kStrategy strat )
     7870// normalize=FALSE, withT=FALSE, coeff=Z
     7871{
     7872  strat->redTailChange=FALSE;
     7873
     7874  poly h, p;
     7875  p = h = L->GetLmTailRing();
     7876  if ((h==NULL) || (pNext(h)==NULL))
     7877    return;
     7878
     7879  TObject* With;
     7880  LObject Ln(pNext(h), strat->tailRing);
     7881  Ln.GetpLength();
     7882
     7883  pNext(h) = NULL;
     7884  if (L->p != NULL)
     7885  {
     7886    pNext(L->p) = NULL;
     7887    if (L->t_p != NULL) pNext(L->t_p) = NULL;
     7888  }
     7889  L->pLength = 1;
     7890
     7891  Ln.PrepareRed(strat->use_buckets);
     7892
     7893  int cnt=REDTAIL_CANONICALIZE;
     7894
     7895  while(!Ln.IsNull())
     7896  {
     7897    loop
     7898    {
     7899      if (TEST_OPT_IDLIFT)
     7900      {
     7901        if (Ln.p!=NULL)
     7902        {
     7903          if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
     7904        }
     7905        else
     7906        {
     7907          if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
     7908        }
     7909      }
     7910      Ln.SetShortExpVector();
     7911      int j;
     7912      j = kFindDivisibleByInT(strat, &Ln);
     7913      if (j < 0) {
     7914        j = kFindDivisibleByInT_Z(strat, &Ln);
     7915        if (j < 0) {
     7916          break;
     7917        } else {
     7918          /* reduction not cancelling a tail term, but reducing its coefficient */
     7919          With = &(strat->T[j]);
     7920          assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
     7921          cnt--;
     7922          if (cnt==0)
     7923          {
     7924            cnt=REDTAIL_CANONICALIZE;
     7925            /*poly tmp=*/Ln.CanonicalizeP();
     7926          }
     7927          strat->redTailChange=TRUE;
     7928          /* reduction cancelling a tail term */
     7929          if (ksReducePolyTailLC_Z(L, With, &Ln))
     7930          {
     7931            // reducing the tail would violate the exp bound
     7932            //  set a flag and hope for a retry (in bba)
     7933            strat->completeReduce_retry=TRUE;
     7934            if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
     7935            do
     7936            {
     7937              pNext(h) = Ln.LmExtractAndIter();
     7938              pIter(h);
     7939              L->pLength++;
     7940            } while (!Ln.IsNull());
     7941            goto all_done;
     7942          }
     7943          break;
     7944        }
     7945      } else {
     7946        With = &(strat->T[j]);
     7947        assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
     7948        cnt--;
     7949        if (cnt==0)
     7950        {
     7951          cnt=REDTAIL_CANONICALIZE;
     7952          /*poly tmp=*/Ln.CanonicalizeP();
     7953        }
     7954        strat->redTailChange=TRUE;
     7955        /* reduction cancelling a tail term */
     7956        if (ksReducePolyTail_Z(L, With, &Ln))
     7957        {
     7958          // reducing the tail would violate the exp bound
     7959          //  set a flag and hope for a retry (in bba)
     7960          strat->completeReduce_retry=TRUE;
     7961          if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
     7962          do
     7963          {
     7964            pNext(h) = Ln.LmExtractAndIter();
     7965            pIter(h);
     7966            L->pLength++;
     7967          } while (!Ln.IsNull());
     7968          goto all_done;
     7969        }
     7970      }
     7971      if (Ln.IsNull()) goto all_done;
     7972    }
     7973    pNext(h) = Ln.LmExtractAndIter();
     7974    pIter(h);
     7975    L->pLength++;
     7976  }
     7977
     7978  all_done:
     7979  Ln.Delete();
     7980  if (L->p != NULL) pNext(L->p) = pNext(p);
     7981
     7982  if (strat->redTailChange)
     7983  {
     7984    L->length = 0;
     7985    L->pLength = 0;
     7986  }
     7987
     7988  kTest_L(L);
     7989  return;
     7990}
     7991
    78697992poly redtailBba_Z (LObject* L, int end_pos, kStrategy strat )
    78707993// normalize=FALSE, withT=FALSE, coeff=Z
Note: See TracChangeset for help on using the changeset viewer.