Changeset fbc7cb in git for kernel/kutil.cc


Ignore:
Timestamp:
Nov 28, 2013, 8:17:04 AM (9 years ago)
Author:
Christian Eder
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'cbf866d4f8c3861325311c042cb2033c053453b2')
Children:
f1cef21d1357296b505525dc298415759bdb20c8
Parents:
c91ffe336985180edd91ef17bf401793443ccb4d
git-author:
Christian Eder <ederc@mathematik.uni-kl.de>2013-11-28 08:17:04+01:00
git-committer:
Christian Eder <ederc@mathematik.uni-kl.de>2013-12-12 13:51:25+01:00
Message:
moves sba tail reduction stuff to kstd2
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/kutil.cc

    rc91ffe3 rfbc7cb  
    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
    5509 poly 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))
    55705471      {
    55715472        // reducing the tail would violate the exp bound
Note: See TracChangeset for help on using the changeset viewer.