Changeset 737e25 in git


Ignore:
Timestamp:
Jul 26, 2008, 8:11:42 PM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
54be36409272b75d61e671da16ead0f5de675693
Parents:
5bc4103ee51a6a028666ee3c666059e950974fb1
Message:
*hannes: redGrRatGB


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

Legend:

Unmodified
Added
Removed
  • kernel/gr_kstd2.cc

    r5bc4103 r737e25  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: gr_kstd2.cc,v 1.14 2008-06-10 10:17:31 motsak Exp $ */
     4/* $Id: gr_kstd2.cc,v 1.15 2008-07-26 18:11:42 Singular Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: noncomm. alg. of Buchberger
     
    145145      j++;
    146146    }
     147  }
     148}
     149void ratGB_divide_out(poly p)
     150{
     151  if (p==NULL) return;
     152  poly root=p;
     153  assume(currRing->real_var_start>0);
     154  poly f=pHead(p);
     155  int i;
     156  for (i=currRing->real_var_start;i<=currRing->real_var_end;i++)
     157  {
     158    pSetExp(f,i,0);
     159  }
     160  loop
     161  {
     162    pIter(p);
     163    if (p==NULL) { pSetm(f); break;}
     164    for (i=1;i<=rVar(currRing);i++)
     165    {
     166      pSetExp(f,i,si_min(pGetExp(f,i),pGetExp(p,i)));
     167    }
     168  }
     169  if (!pIsConstant(f))
     170  {
     171    if (TEST_OPT_DEBUG)
     172    {
     173      PrintS("divide out:");p_wrp(f,currRing);
     174      PrintS(" from ");pWrite(root);
     175    }
     176    p=root;
     177    loop
     178    {
     179      if (p==NULL) break;
     180      for (i=1;i<=rVar(currRing);i++)
     181      {
     182        pSetExp(p,i,pGetExp(p,i)-pGetExp(f,i));
     183      }
     184      pSetm(p);
     185      pIter(p);
     186    }
     187  }
     188  pDelete(&f);
     189}
     190/*2
     191*reduces h with elements from T choosing  the first possible
     192* element in t with respect to the given pDivisibleBy
     193* for use in ratGB
     194*/
     195int redGrRatGB (LObject* h,kStrategy strat)
     196{
     197  int at,reddeg,d,i;
     198  int pass = 0;
     199  int j = 0;
     200  int c_j=-1, c_e=-1;
     201  poly c_p=NULL;
     202  assume(strat->tailRing==currRing);
     203
     204  ratGB_divide_out((*h).p);
     205  d = pFDeg((*h).p,currRing)+(*h).ecart;
     206  reddeg = strat->LazyDegree+d;
     207  if (!TEST_OPT_INTSTRATEGY)
     208  {
     209    if (rField_is_Zp_a()) pContent(h->p);
     210    else pCleardenom(h->p);// also does a pContent
     211  }
     212  loop
     213  {
     214    if (j > strat->sl)
     215    {
     216      if (c_j>=0)
     217      {
     218        /*
     219        * the polynomial to reduce with is;
     220        * S[c_j]
     221        */
     222        if (!TEST_OPT_INTSTRATEGY)
     223          pNorm(strat->S[c_j]);
     224        if (TEST_OPT_DEBUG)
     225        {
     226          wrp(h->p);
     227          PrintS(" with ");
     228          wrp(strat->S[c_j]);
     229        }
     230        //poly hh = nc_CreateSpoly(strat->S[c_j],(*h).p, currRing);
     231        poly hh=c_p; c_p=NULL;
     232        pDelete(&((*h).p));
     233        (*h).p=hh;
     234        if (!TEST_OPT_INTSTRATEGY)
     235        {
     236          if (rField_is_Zp_a()) pContent(h->p);
     237          else pCleardenom(h->p);// also does a pContent
     238        }
     239
     240        if (TEST_OPT_DEBUG)
     241        {
     242          PrintS(" to ");
     243          wrp(h->p);
     244        }
     245        if ((*h).p == NULL)
     246        {
     247          if (h->lcm!=NULL) p_LmFree((*h).lcm, currRing);
     248          return 0;
     249        }
     250        ratGB_divide_out((*h).p);
     251        d = pLDeg((*h).p,&((*h).length),currRing);
     252        (*h).FDeg=pFDeg((*h).p,currRing);
     253        (*h).ecart = d-(*h).FDeg; /*pFDeg((*h).p);*/
     254        /*- try to reduce the s-polynomial again -*/
     255        pass++;
     256        j=0;
     257      }
     258      else
     259      { // nothing found
     260        return 0;
     261      }
     262    }
     263    if (p_LmDivisibleByPart(strat->S[j],(*h).p,currRing,
     264        currRing->real_var_start,currRing->real_var_end))
     265    {
     266      int a_e=(pTotaldegree(strat->S[j],currRing)-pFDeg(strat->S[j],currRing));
     267      if (TEST_OPT_DEBUG) { Print("j=%d, e=%d\n",j,a_e); }
     268      if ((c_e==-1)||(c_e>a_e))
     269      {
     270        c_e=a_e; c_j=j;
     271        pDelete(&c_p);
     272        c_p = nc_CreateSpoly(pCopy(strat->S[c_j]),pCopy((*h).p), currRing);
     273      }
     274      else if (c_e == a_e)
     275      {
     276         poly cc_pp= nc_CreateSpoly(pCopy(strat->S[j]),pCopy((*h).p), currRing);
     277         if (((cc_pp==NULL)&&(c_p!=NULL)) || (pCmp(cc_pp,c_p)==-1))
     278         {
     279           assume(pTotaldegree(cc_pp)<=pTotaldegree(c_p));
     280           c_e=a_e; c_j=j;
     281           pDelete(&c_p);
     282           c_p = cc_pp;
     283         }
     284      }
     285      /*computes the ecart*/
     286      if ((strat->syzComp!=0) && !strat->honey)
     287      {
     288        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
     289        {
     290          if (TEST_OPT_DEBUG) PrintS(" > sysComp\n");
     291          return 0;
     292        }
     293      }
     294    }
     295    else
     296    {
     297      if (TEST_OPT_DEBUG) PrintS("-\n");
     298    }
     299    j++;
    147300  }
    148301}
     
    776929//   if (rIsPluralRing(currRing))
    777930    strat->red = redGrFirst;
     931  if (currRing->real_var_start>0)
     932    strat->red=redGrRatGB;
    778933
    779934  if (pLexOrder && strat->honey)
     
    831986
    832987   PrintS("F: \n");
    833    idPrint(F); 
    834    PrintS("Q: \n"); 
     988   idPrint(F);
     989   PrintS("Q: \n");
    835990   idPrint(Q);
    836991#endif
     
    838993
    839994
    840    
     995
    841996  assume(pOrdSgn != -1); // no mora!!! it terminates only for global ordering!!! (?)
    842997
     
    8971052          /* prod.crit itself in nc_CreateSpoly */
    8981053        }
    899      
     1054
    9001055      strat->P.p = nc_CreateSpoly(strat->P.p1,strat->P.p2,currRing);
    9011056
     
    9111066        PrintS("SPoly: "); pWrite(strat->P.p);
    9121067      }
    913 #endif     
    914     }
    915 
    916    
     1068#endif
     1069    }
     1070
     1071
    9171072    if (strat->P.p != NULL)
    9181073    {
     
    9811136                Print("s: "); pWrite(strat->P.p);
    9821137#endif
    983                
     1138
    9841139              }
    9851140              // kTest(strat);
    9861141              //
    9871142              enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat);
    988              
     1143
    9891144              if (strat->sl==-1) pos=0;
    9901145              else pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
    991              
     1146
    9921147              strat->enterS(strat->P,pos,strat,-1);
    9931148            }
Note: See TracChangeset for help on using the changeset viewer.