Changeset 75d084 in git


Ignore:
Timestamp:
Apr 30, 2007, 5:47:41 PM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'd1ba061a762c62d3a25159d8da8b6e17332291fa')
Children:
580ab50138ac90a455bc8ccfd0bfb17268011c18
Parents:
8d670359ca4f71b1359f6a846d1286150c4f39e0
Message:
*hannes: reorderS, updateS, code simpl: paisr removed


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

Legend:

Unmodified
Added
Removed
  • kernel/kutil.cc

    r8d67035 r75d084  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.49 2007-03-29 11:34:52 Singular Exp $ */
     4/* $Id: kutil.cc,v 1.50 2007-04-30 15:47:41 Singular Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    25682568
    25692569/*2
    2570 *constructs the pairset at the beginning
    2571 *of the buchberger/mora algorithm
    2572 */
    2573 void pairs (kStrategy strat)
    2574 {
    2575   int j,i;
    2576 //  Print("pairs:sl=%d\n",strat->sl);
    2577 //  for (i=0; i<=strat->sl; i++)
    2578 //  {
    2579 //    Print("s%d:",i);pWrite(strat->S[i]);
    2580 //  }
    2581   if (strat->fromQ!=NULL)
    2582   {
    2583     for (i=1; i<=strat->sl; i++)
    2584     {
    2585       initenterpairs(strat->S[i],i-1,strat->ecartS[i],strat->fromQ[i],strat);
    2586     }
    2587   }
    2588   else
    2589   {
    2590     for (i=1; i<=strat->sl; i++)
    2591     {
    2592       initenterpairs(strat->S[i],i-1,strat->ecartS[i],0,strat);
    2593     }
    2594   }
    2595   /*deletes superfluous elements in S*/
    2596   i = -1;
    2597   loop
    2598   {
    2599     i++;
    2600     if (i >= strat->sl) break;
    2601     if (1//(strat->syzComp==0) || (pGetComp(strat->S[i])<=strat->syzComp))
    2602     )
    2603     {
    2604       j=i;
    2605       loop
    2606       {
    2607         j++;
    2608         if (j > strat->sl) break;
    2609         if (pLmShortDivisibleBy(strat->S[i], strat->sevS[i],
    2610                               strat->S[j], ~ strat->sevS[j]))
    2611         {
    2612         //  Print("delete %d=",j);
    2613         //  wrp(strat->S[j]);
    2614         //  Print(" wegen %d=",i);
    2615         //  wrp(strat->S[i]);
    2616         //  Print("( fromQ=%d)\n", (strat->fromQ) ? strat->fromQ[j]:0);
    2617           if ((strat->fromQ==NULL) || (strat->fromQ[j]==0))
    2618           {
    2619             deleteInS(j,strat);
    2620             j--;
    2621           }
    2622         }
    2623       }
    2624     }
    2625   }
    2626 }
    2627 
    2628 /*2
    26292570*reorders  s with respect to posInS,
    26302571*suc is the first changed index or zero
    26312572*/
     2573
    26322574void reorderS (int* suc,kStrategy strat)
    26332575{
     
    26362578  unsigned long sev;
    26372579  poly  p;
    2638 
    2639   *suc = -1;
    2640   for (i=1; i<=strat->sl; i++)
     2580  int new_suc=strat->sl+1;
     2581  i= *suc;
     2582  if (i<0) i=0;
     2583
     2584  for (; i<=strat->sl; i++)
    26412585  {
    26422586    at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
    26432587    if (at != i)
    26442588    {
    2645       if ((*suc > at) || (*suc == -1)) *suc = at;
     2589      if (new_suc > at) new_suc = at;
    26462590      p = strat->S[i];
    26472591      ecart = strat->ecartS[i];
     
    26702614    }
    26712615  }
     2616  if (new_suc <= strat->sl) *suc=new_suc;
     2617  else                      *suc=-1;
    26722618}
    26732619
     
    46254571}
    46264572
     4573#if 0
    46274574/*2
    46284575* reduces h using the elements from Q in the set S
     
    46494596  return h;
    46504597}
     4598#endif
    46514599
    46524600/*2
     
    47304678  int i, suc=0;
    47314679  poly redSi=NULL;
    4732   BOOLEAN change;
     4680  BOOLEAN change,any_change;
    47334681//  Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
    47344682//  for (i=0; i<=(strat->sl); i++)
     
    47394687//  }
    47404688//  Print("pOrdSgn=%d\n", pOrdSgn);
     4689  any_change=FALSE;
    47414690  if (pOrdSgn==1)
    47424691  {
     
    47474696      {
    47484697        change=FALSE;
    4749         if (1//((strat->syzComp==0) || (pGetComp(strat->S[i])<=strat->syzComp))
    4750         && ((strat->fromQ==NULL) || (strat->fromQ[i]==0)))
     4698        if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
    47514699        {
    47524700          redSi = pHead(strat->S[i]);
    47534701          strat->S[i] = redBba(strat->S[i],i-1,strat);
    4754           if ((strat->ak!=0)&&(strat->S[i]!=NULL))
    4755             strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
     4702          //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
     4703          //  strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
    47564704          if (pCmp(redSi,strat->S[i])!=0)
    47574705          {
    47584706            change=TRUE;
     4707            any_change=TRUE;
    47594708            if (TEST_OPT_DEBUG)
    47604709            {
     
    47934742        i++;
    47944743      }
    4795       reorderS(&suc,strat);
     4744      if (any_change) reorderS(&suc,strat);
     4745      else break;
    47964746    }
    47974747    if (toT)
     
    48334783      {
    48344784        change=FALSE;
    4835         if (1//((strat->syzComp==0) || (pGetComp(strat->S[i])<=strat->syzComp))
    4836         && ((strat->fromQ==NULL) || (strat->fromQ[i]==0)))
     4785        if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
    48374786        {
    48384787          redSi=pHead((strat->S)[i]);
     
    48454794          else if (pCmp((strat->S)[i],redSi)!=0)
    48464795          {
     4796            any_change=TRUE;
    48474797            h.p = strat->S[i];
    48484798            strat->initEcart(&h);
     
    48674817      kTest(strat);
    48684818#endif
    4869       reorderS(&suc,strat);
     4819      if (any_change) reorderS(&suc,strat);
     4820      else { suc=-1; break; }
    48704821      if (h.p!=NULL)
    48714822      {
     
    48804831    for (i=0; i<=strat->sl; i++)
    48814832    {
    4882       if (((strat->fromQ==NULL) || (strat->fromQ[i]==0))
    4883       )
     4833      if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
    48844834      {
    48854835        strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
     
    52845234  strat->fromT = FALSE;
    52855235  strat->noTailReduction = !TEST_OPT_REDTAIL;
    5286   if(!TEST_OPT_SB_1)
     5236  if (!TEST_OPT_SB_1)
    52875237  {
    52885238    updateS(TRUE,strat);
    5289     pairs(strat);
    52905239  }
    52915240  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
Note: See TracChangeset for help on using the changeset viewer.