Changeset b085fba in git


Ignore:
Timestamp:
Nov 25, 2013, 9:15:32 AM (9 years ago)
Author:
Christian Eder
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '48f1dd268d0ff74ef2f7dccbf02545425002ddcc')
Children:
576f5bba463748c5f51eebf368f6184847882508
Parents:
f59aaade492b9527e048de83ffcb97228e48208b
git-author:
Christian Eder <ederc@mathematik.uni-kl.de>2013-11-25 09:15:32+01:00
git-committer:
Christian Eder <ederc@mathematik.uni-kl.de>2013-12-12 13:51:25+01:00
Message:
adds experimental sba tailred (disabled by default)
Location:
kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/kInline.h

    rf59aaa rb085fba  
    10741074}
    10751075
     1076KINLINE int ksReducePolyTailSig(LObject* PR, TObject* PW, LObject* Red)
     1077{
     1078  BOOLEAN ret;
     1079  number coef;
     1080
     1081  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
     1082  Red->HeadNormalize();
     1083  printf("------------------------\n");
     1084  pWrite(Red->GetLmCurrRing());
     1085  ret = ksReducePolySig(Red, PW, 1, NULL, &coef);
     1086  if (ret == 3) {
     1087    pWrite(Red->GetLmCurrRing());
     1088    printf("not sig-safe\n");
     1089    printf("------------------------\n");
     1090  }
     1091  if (!ret)
     1092  {
     1093    if (! n_IsOne(coef, currRing->cf))
     1094    {
     1095      PR->Mult_nn(coef);
     1096      // HANNES: mark for Normalize
     1097    }
     1098    n_Delete(&coef, currRing->cf);
     1099  }
     1100  return ret;
     1101}
     1102
    10761103/***************************************************************
    10771104 *
  • kernel/kstd2.cc

    rf59aaa rb085fba  
    5353#endif
    5454
     55#define SBA_TAIL_RED                        0
    5556#define SBA_PRODUCT_CRITERION               0
    5657#define SBA_PRINT_ZERO_REDUCTIONS           1
     
    18181819      // in the ring case we cannot expect LC(f) = 1,
    18191820      // therefore we call pContent instead of pNorm
    1820       /*
     1821#if SBA_TAIL_RED
     1822      pWrite(strat->P.p);
    18211823      if ((TEST_OPT_INTSTRATEGY) || (rField_is_Ring(currRing)))
    18221824      {
     
    18241826        if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
    18251827        {
    1826           strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
     1828          strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
    18271829          strat->P.pCleardenom();
    18281830        }
     
    18321834        strat->P.pNorm();
    18331835        if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
    1834           strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
    1835       }
    1836       */
     1836          strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
     1837      }
     1838      pWrite(strat->P.p);
     1839      printf("-\n");
     1840#endif
    18371841#ifdef KDEBUG
    18381842      if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
     
    19341938      // posInS only depends on the leading term
    19351939      strat->enterS(strat->P, pos, strat, strat->tl);
    1936 //#if 1
    1937 #if DEBUGF50
     1940#if 1
     1941//#if DEBUGF50
    19381942    printf("---------------------------\n");
    19391943    Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
  • kernel/kutil.cc

    rf59aaa rb085fba  
    54695469      strat->redTailChange=TRUE;
    54705470      if (ksReducePolyTail(L, With, &Ln))
     5471      {
     5472        // reducing the tail would violate the exp bound
     5473        //  set a flag and hope for a retry (in bba)
     5474        strat->completeReduce_retry=TRUE;
     5475        if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
     5476        do
     5477        {
     5478          pNext(h) = Ln.LmExtractAndIter();
     5479          pIter(h);
     5480          L->pLength++;
     5481        } while (!Ln.IsNull());
     5482        goto all_done;
     5483      }
     5484      if (Ln.IsNull()) goto all_done;
     5485      if (! withT) With_s.Init(currRing);
     5486    }
     5487    pNext(h) = Ln.LmExtractAndIter();
     5488    pIter(h);
     5489    pNormalize(h);
     5490    L->pLength++;
     5491  }
     5492
     5493  all_done:
     5494  Ln.Delete();
     5495  if (L->p != NULL) pNext(L->p) = pNext(p);
     5496
     5497  if (strat->redTailChange)
     5498  {
     5499    L->length = 0;
     5500  }
     5501
     5502  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
     5503  //L->Normalize(); // HANNES: should have a test
     5504  assume(kTest_L(L));
     5505  return L->GetLmCurrRing();
     5506}
     5507
     5508// tail reduction for SBA
     5509poly redtailSba (LObject* L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
     5510{
     5511#define REDTAIL_CANONICALIZE 100
     5512  strat->redTailChange=FALSE;
     5513  if (strat->noTailReduction) return L->GetLmCurrRing();
     5514  poly h, p;
     5515  p = h = L->GetLmTailRing();
     5516  if ((h==NULL) || (pNext(h)==NULL))
     5517    return L->GetLmCurrRing();
     5518
     5519  TObject* With;
     5520  // placeholder in case strat->tl < 0
     5521  TObject  With_s(strat->tailRing);
     5522
     5523  LObject Ln(pNext(h), strat->tailRing);
     5524  Ln.sig      = L->sig;
     5525  Ln.sevSig   = L->sevSig;
     5526  Ln.pLength  = L->GetpLength() - 1;
     5527
     5528  pNext(h) = NULL;
     5529  if (L->p != NULL) pNext(L->p) = NULL;
     5530  L->pLength = 1;
     5531
     5532  Ln.PrepareRed(strat->use_buckets);
     5533
     5534  int cnt=REDTAIL_CANONICALIZE;
     5535  while(!Ln.IsNull())
     5536  {
     5537    loop
     5538    {
     5539      Ln.SetShortExpVector();
     5540      if (withT)
     5541      {
     5542        int j;
     5543        j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
     5544        if (j < 0) break;
     5545        With = &(strat->T[j]);
     5546      }
     5547      else
     5548      {
     5549        With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
     5550        if (With == NULL) break;
     5551      }
     5552      cnt--;
     5553      if (cnt==0)
     5554      {
     5555        cnt=REDTAIL_CANONICALIZE;
     5556        /*poly tmp=*/Ln.CanonicalizeP();
     5557        if (normalize)
     5558        {
     5559          Ln.Normalize();
     5560          //pNormalize(tmp);
     5561          //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
     5562        }
     5563      }
     5564      if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
     5565      {
     5566        With->pNorm();
     5567      }
     5568      strat->redTailChange=TRUE;
     5569      if (ksReducePolyTailSig(L, With, &Ln))
    54715570      {
    54725571        // reducing the tail would violate the exp bound
  • kernel/kutil.h

    rf59aaa rb085fba  
    467467poly redtailBba (LObject *L, int pos,kStrategy strat,
    468468                 BOOLEAN withT = FALSE,BOOLEAN normalize=FALSE);
     469poly redtailSba (LObject *L, int pos,kStrategy strat,
     470                 BOOLEAN withT = FALSE,BOOLEAN normalize=FALSE);
    469471poly redtailBba (TObject *T, int pos,kStrategy strat);
    470472poly redtail (poly p,int pos,kStrategy strat);
Note: See TracChangeset for help on using the changeset viewer.