Changeset 48aa42 in git for Singular/kutil.cc


Ignore:
Timestamp:
Dec 14, 2000, 5:38:55 PM (23 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
de99f1185094a2e1b309d4e78f838d6692f38f51
Parents:
d84b58726ff416e01f33ee72cac5d136ef2515c5
Message:
opt(redThrough) etc added


git-svn-id: file:///usr/local/Singular/svn/trunk@4905 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/kutil.cc

    rd84b58 r48aa42  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.82 2000-12-12 08:44:46 obachman Exp $ */
     4/* $Id: kutil.cc,v 1.83 2000-12-14 16:38:51 obachman Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    2828// system memmove -- it does not seem to pay off, though
    2929// #define ENTER_USE_MYMEMMOVE
     30
     31// define if redtailBba should use buckets
     32#define HAVE_REDTAIL_BUCKETS
    3033
    3134#include "tok.h"
     
    26572660}
    26582661
    2659 // #define OLD_RED_TAIL
    2660 #ifdef OLD_RED_TAIL
    2661 /*2
    2662 * reduces h using the set S
    2663 * procedure used in redtail
    2664 */
    2665 /*2
    2666 *compute the normalform of the tail p->next of p
    2667 *with respect to S
    2668 */
    2669 poly redtail (poly p, int pos, kStrategy strat)
    2670 {
    2671   if ((!strat->noTailReduction) && (pNext(p)!=NULL))
    2672   {
    2673     int j, e, l;
    2674     unsigned long not_sev;
    2675 
    2676     poly h = p;
    2677     poly hn = pNext(h); // !=NULL
    2678     int op = pFDeg(hn);
    2679     BOOLEAN save_HE=strat->kHEdgeFound;
    2680     strat->kHEdgeFound |= ((Kstd1_deg>0) && (op<=Kstd1_deg))
    2681                           || TEST_OPT_INFREDTAIL;
    2682     loop
    2683     {
    2684       not_sev = ~ pGetShortExpVector(hn);
    2685       e = pLDeg(hn,&l)-op;
    2686       j = 0;
    2687       while (j <= pos)
    2688       {
    2689         if (pLmShortDivisibleBy(strat->S[j], strat->sevS[j], hn, not_sev)
    2690             &&
    2691             ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
    2692         {
    2693           strat->redTailChange=TRUE;
    2694           ksOldSpolyTail(strat->S[j], p, h, strat->kNoether);
    2695           hn = pNext(h);
    2696           if (hn == NULL) goto all_done;
    2697           not_sev = ~ pGetShortExpVector(hn);
    2698           op = pFDeg(hn);
    2699           if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
    2700           e = pLDeg(hn,&l)-op;
    2701           j = 0;
    2702         }
    2703         else
    2704         {
    2705           j++;
    2706         }
    2707       } /* while (j <= pos) */
    2708       h = hn; /* better for: pIter(h); */
    2709       hn = pNext(h);
    2710       if (hn==NULL) break;
    2711       op = pFDeg(hn);
    2712       if ((Kstd1_deg>0)&&(op>Kstd1_deg)) break;
    2713     }
    2714 all_done:
    2715     strat->kHEdgeFound = save_HE;
    2716   }
    2717   return p;
    2718 }
    2719 #else
    27202662poly redtail (poly p, int pos, kStrategy strat)
    27212663{
     
    27232665  return redtail(&L, pos, strat);
    27242666}
     2667
     2668
     2669#ifndef OLD_REDTAIL_BBA
     2670poly redtailBba (LObject* L, int pos, kStrategy strat, BOOLEAN withT)
     2671{
     2672  strat->redTailChange=FALSE;
     2673  if (strat->noTailReduction) return L->GetLmCurrRing();
     2674  poly h, p;
     2675
     2676  TObject* With;
     2677  // placeholder in case strat->tl < 0
     2678  TObject  With_s(strat->tailRing);
     2679 
     2680  h = L->GetLmTailRing();
     2681  p = h;
     2682  LObject Ln(pNext(h), strat->tailRing);
     2683  Ln.pLength = L->GetpLength() - 1;
     2684
     2685  pNext(h) = NULL;
     2686  if (L->p != NULL) pNext(L->p) = NULL;
     2687  L->pLength = 1;
     2688
     2689#ifdef HAVE_REDTAIL_BUCKETS 
     2690  Ln.PrepareRed(strat->use_buckets);
    27252691#endif
    27262692
    2727 poly redtailBba (LObject* L, int pos, kStrategy strat)
     2693  while(!Ln.IsNull())
     2694  {
     2695    while (1)
     2696    {
     2697      Ln.SetShortExpVector();
     2698      if (! withT)
     2699      {
     2700        With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
     2701        if (With == NULL) break;
     2702      }
     2703      else
     2704      {
     2705        int j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
     2706        if (j < 0) break;
     2707        With = &(strat->T[j]);
     2708      }
     2709      if (ksReducePolyTail(L, With, &Ln))
     2710      {
     2711        // reducing the tail would violate the exp bound
     2712        pNext(h) = Ln.GetTP();
     2713        L->pLength += Ln.GetpLength();
     2714        if (L->p != NULL) pNext(L->p) = pNext(p);
     2715        if (kStratChangeTailRing(strat, L))
     2716          return redtailBba(L, pos, strat, withT);
     2717        else
     2718        { // should never get here -- need to fix this
     2719          assume(0);
     2720          return NULL;
     2721        }
     2722      }
     2723      strat->redTailChange=TRUE;
     2724      if (Ln.IsNull()) goto all_done;
     2725    }
     2726    pNext(h) = Ln.LmExtractAndIter();
     2727    pIter(h);
     2728    L->pLength++;
     2729  }
     2730
     2731  all_done:
     2732  if (L->p != NULL) pNext(L->p) = pNext(p);
     2733  assume(pLength(L->p != NULL ? L->p : L->t_p) == L->pLength);
     2734
     2735  if (strat->redTailChange)
     2736  {
     2737    L->last = NULL;
     2738    L->length = 0;
     2739  }
     2740  kTest_L(L);
     2741  return L->GetLmCurrRing();
     2742}
     2743#else
     2744poly redtailBba (LObject* L, int pos, kStrategy strat, BOOLEAN withT)
    27282745{
    27292746  poly h, hn;
     
    27472764      Ln.Set(hn, strat->tailRing);
    27482765      Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
    2749       With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
    2750       if (With == NULL) break;
     2766      if (! withT)
     2767      {
     2768        With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
     2769        if (With == NULL) break;
     2770      }
     2771      else
     2772      {
     2773        int j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
     2774        if (j < 0) break;
     2775        With = &(strat->T[j]);
     2776      }
    27512777      if (ksReducePolyTail(L, With, h, strat->kNoether))
    27522778      {
     
    27802806  return p;
    27812807}
    2782 
     2808#endif
    27832809/*2
    27842810*checks the change degree and write progress report
Note: See TracChangeset for help on using the changeset viewer.