Changeset fc58b5b in git for kernel/GBEngine


Ignore:
Timestamp:
Oct 21, 2015, 3:44:28 PM (9 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a375377c864dd6ddd5d4e8270041b08ca7acab9f
Parents:
5bd9ec36b87fa8f176a21995de2b56724d67be2d
Message:
avoid copy in posInL11Ring/posInL11Ringls and format stuff
Location:
kernel/GBEngine
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/kInline.h

    r5bd9ec rfc58b5b  
    456456    {
    457457      if (t_p != NULL)
    458         {
    459           p_ProjectiveUnique(t_p, tailRing);
    460           pSetCoeff0(p, pGetCoeff(t_p));
    461         }
     458      {
     459        p_ProjectiveUnique(t_p, tailRing);
     460        pSetCoeff0(p, pGetCoeff(t_p));
     461      }
    462462      else
    463         {
     463      {
    464464#ifdef HAVE_RATGRING
    465           p_ProjectiveUnique(p, currRing);
     465        p_ProjectiveUnique(p, currRing);
    466466#else
    467           p_ProjectiveUnique(p, currRing);
     467        p_ProjectiveUnique(p, currRing);
    468468#endif
    469         }
     469      }
    470470    }
    471471}
  • kernel/GBEngine/kspoly.cc

    r5bd9ec rfc58b5b  
    161161  {
    162162    Print(" to: "); PR->wrp(); Print("\n");
    163     //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p)); 
     163    //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
    164164  }
    165165#endif
  • kernel/GBEngine/kstd1.cc

    r5bd9ec rfc58b5b  
    362362#if ADIDEBUG_NF
    363363  int iii;
    364   PrintLn();
    365   PrintS("---------------------------- NEW REDRILOC COMPUTATION ----------------------------");
    366   PrintLn();
    367   PrintS("    The pair h : "); PrintLn(); PrintLn();
    368   PrintS("      p1 = "); p_Write(h->p1,strat->tailRing); PrintLn();
    369   PrintS("      p2 = "); p_Write(h->p2,strat->tailRing); PrintLn();
    370   PrintS("      p  = "); p_Write(h->p,strat->tailRing); PrintLn();
    371   PrintLn();
    372   PrintS("    The actual reducer T is: ");
     364  PrintS("\n---------------------------- NEW REDRILOC COMPUTATION ----------------------------\n");
     365  PrintS("    The pair h :\n");
     366  PrintS("\n      p1 = "); p_Write(h->p1,strat->tailRing);
     367  PrintS("\n      p2 = "); p_Write(h->p2,strat->tailRing);
     368  PrintS("\n      p  = "); p_Write(h->p,strat->tailRing);
     369  PrintS("\n    The actual reducer T is: ");
    373370  if(strat->tl<0)
    374371    {PrintS(" Empty.\n");}
     
    377374    for (iii=0;iii<=strat->tl;iii++)
    378375    {
    379       PrintLn();
    380       Print("      T[%i] = ",iii);p_Write(strat->T[iii].p,strat->tailRing);
    381       PrintLn();
     376      Print("\n      T[%i] = ",iii);p_Write(strat->T[iii].p,strat->tailRing);
    382377    }
    383378  }
     
    409404    if (j < 0)
    410405    {
    411       #if ADIDEBUG_NF
    412       printf("\nNone was found. Exit\n");
    413       #endif
    414       if (strat->honey) h->SetLength(strat->length_pLength);
    415406      // over ZZ: cleanup coefficients by complete reduction with monomials
    416407      postReduceByMon(h, strat);
    417       if(h->p == NULL) 
     408      if(h->p == NULL)
    418409      {
    419410        if (h->lcm!=NULL) pLmDelete(h->lcm);
     
    421412        return 0;
    422413      }
     414      if (strat->honey) h->SetLength(strat->length_pLength);
    423415      if(strat->tl >= 0)
    424416          h->i_r1 = strat->tl;
     
    455447                                        strat->T[i].length < li))
    456448            &&
    457             p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing) 
    458             && 
     449            p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing)
     450            &&
    459451            n_DivBy(h->p->coef,strat->T[i].p->coef,strat->tailRing))
    460452#else
     
    525517          strat->fromT = FALSE;
    526518          return -1;
    527          
     519
    528520        #else
    529        
     521
    530522          LObject* h2;
    531523          pWrite(h->p);
     
    541533          if(h->IsNull())
    542534          {
    543             if (h->lcm!=NULL) 
     535            if (h->lcm!=NULL)
    544536            {
    545537              pLmDelete(h->lcm);
     
    849841          || ((strat->T[j].ecart == ei)
    850842        && (strat->T[j].length < li)))
    851         && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev) 
     843        && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev)
    852844        #ifdef HAVE_RINGS
    853845        && (!rField_is_Ring(strat->tailRing) ||
     
    16661658  if (strat->homog && strat->red == redFirst)
    16671659    if(!idIs0(F) &&(!rField_is_Ring(currRing)))
    1668       kStratInitChangeTailRing(strat); 
     1660      kStratInitChangeTailRing(strat);
    16691661#endif
    16701662
     
    23642356            poly pFmon = preIntegerCheck(FCopy, Q);
    23652357            if(pFmon != NULL)
    2366             {   
     2358            {
    23672359              idInsertPoly(FCopy, pFmon);
    23682360              #if ADIDEBUG
  • kernel/GBEngine/kstd2.cc

    r5bd9ec rfc58b5b  
    148148            return j;
    149149#endif
    150            
     150
    151151        }
    152152#endif
     
    427427  {
    428428    j = kFindDivisibleByInT(strat, h);
    429     if (j < 0) 
    430     {
    431         // over ZZ: cleanup coefficients by complete reduction with monomials
    432         postReduceByMon(h, strat);
    433         if(nIsZero(pGetCoeff(h->p))) return 2;
    434         j = kFindDivisibleByInT(strat, h);
    435         if(j < 0)
    436         {
    437           if(strat->tl >= 0)
    438               h->i_r1 = strat->tl;
    439           else
    440               h->i_r1 = -1;
    441           if (h->GetLmTailRing() == NULL)
    442           {
    443             if (h->lcm!=NULL) pLmDelete(h->lcm);
    444             h->Clear();
    445             return 0;
    446           }
    447           return 1;
    448         }
     429    if (j < 0)
     430    {
     431      // over ZZ: cleanup coefficients by complete reduction with monomials
     432      postReduceByMon(h, strat);
     433      if(nIsZero(pGetCoeff(h->p))) return 2;
     434      j = kFindDivisibleByInT(strat, h);
     435      if(j < 0)
     436      {
     437        if(strat->tl >= 0)
     438            h->i_r1 = strat->tl;
     439        else
     440            h->i_r1 = -1;
     441        if (h->GetLmTailRing() == NULL)
     442        {
     443          if (h->lcm!=NULL) pLmDelete(h->lcm);
     444          h->Clear();
     445          return 0;
     446        }
     447        return 1;
     448      }
    449449    }
    450450    #if ADIDEBUG
     
    12391239      {
    12401240        if(p_GetComp(h->p,currRing)>strat->syzComp)
    1241         {
    1242           h->Delete();
    1243           return 0;
    1244         }
     1241        {
     1242          h->Delete();
     1243          return 0;
     1244        }
    12451245      }
    12461246      else if (h->t_p!=NULL)
    12471247      {
    12481248        if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
    1249         {
    1250           h->Delete();
    1251           return 0;
    1252         }
     1249        {
     1250          h->Delete();
     1251          return 0;
     1252        }
    12531253      }
    12541254    }
  • kernel/GBEngine/kutil.cc

    r5bd9ec rfc58b5b  
    12081208  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
    12091209  */
    1210  
     1210
    12111211  for(j = strat->Bl;j>=0;j--)
    12121212  {
     
    13511351  h.i_r = -1;
    13521352  if(h.p == NULL)
    1353   { 
     1353  {
    13541354    if (strat->pairtest==NULL) initPairtest(strat);
    13551355    strat->pairtest[i] = TRUE;
     
    14651465  }
    14661466#endif
    1467  
     1467
    14681468  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
    14691469  p_LmDelete(m1, strat->tailRing);
     
    49594959        return length+1;
    49604960  if (set[length].FDeg == p->FDeg)
    4961     if(set[length].GetpLength() > p->GetpLength()) 
     4961    if(set[length].GetpLength() > p->GetpLength())
    49624962          return length+1;
    49634963  int i;
     
    49704970      if(an == en)
    49714971        return en;
    4972       if (set[an].FDeg > p->FDeg) 
     4972      if (set[an].FDeg > p->FDeg)
    49734973        return en;
    49744974      if(set[an].FDeg == p->FDeg)
    49754975      {
    4976         if(set[an].GetpLength() > p->GetpLength()) 
     4976        if(set[an].GetpLength() > p->GetpLength())
    49774977          {return en;}
    49784978        else
     
    50085008                an=i;
    50095009            else
    5010             {   
     5010            {
    50115011                if(set[i].GetpLength() == p->GetpLength())
    50125012                {
    5013                     if(nGreater(set[i].p->coef, p->p->coef)) 
     5013                    if(nGreater(set[i].p->coef, p->p->coef))
    50145014                    {
    50155015                        an = i;
     
    50285028        else
    50295029            en=i;
    5030     }                                     
     5030    }
    50315031  }
    50325032}
     
    51285128* set[length] is the smallest element in set with respect
    51295129* to the ordering-procedure pLmCmp,totaldegree,coefficient
    5130 * For the same totaldegree, original pairs (from F) will 
     5130* For the same totaldegree, original pairs (from F) will
    51315131* be put at the end and smalles coefficents
    51325132*/
     
    51575157      {
    51585158        number lcset,lcp;
    5159         lcset = nCopy(set[an].p->coef);
    5160         lcp = nCopy(p->p->coef);
     5159        lcset = pGetCoeff(set[an].p);
     5160        lcp = pGetCoeff(p->p);
    51615161        if(!nGreaterZero(lcset))
    5162           lcset = nInpNeg(lcset);
     5162        {
     5163          set[an].p=p_Neg(set[an].p,currRing);
     5164          if (set[an].t_p!=NULL)
     5165            pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
     5166          lcset=pGetCoeff(set[an].p);
     5167        }
    51635168        if(!nGreaterZero(lcp))
    5164           lcp = nInpNeg(lcp);
     5169        {
     5170          p->p=p_Neg(p->p,currRing);
     5171          if (p->t_p!=NULL)
     5172            pSetCoeff0(p->t_p,pGetCoeff(p->p));
     5173          lcp=pGetCoeff(p->p);
     5174        }
    51655175        if(nGreater(lcset, lcp))
    51665176        {
    5167           nDelete(&lcset);
    5168           nDelete(&lcp);
    51695177          return en;
    51705178        }
    51715179        else
    51725180        {
    5173           nDelete(&lcset);
    5174           nDelete(&lcp);
    51755181          return an;
    51765182        }
     
    51855191    {
    51865192      number lcset,lcp;
    5187       lcset = nCopy(set[i].p->coef);
    5188       lcp = nCopy(p->p->coef);
     5193      lcset = pGetCoeff(set[i].p);
     5194      lcp = pGetCoeff(p->p);
    51895195      if(!nGreaterZero(lcset))
    5190         lcset = nInpNeg(lcset);
     5196      {
     5197        set[i].p=p_Neg(set[i].p,currRing);
     5198        if (set[i].t_p!=NULL)
     5199          pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
     5200        lcset=pGetCoeff(set[i].p);
     5201      }
    51915202      if(!nGreaterZero(lcp))
    5192         lcp = nInpNeg(lcp);
     5203      {
     5204        p->p=p_Neg(p->p,currRing);
     5205        if (p->t_p!=NULL)
     5206          pSetCoeff0(p->t_p,pGetCoeff(p->p));
     5207        lcp=pGetCoeff(p->p);
     5208      }
    51935209      if(nGreater(lcset, lcp))
    51945210      {
    5195         nDelete(&lcset);
    5196         nDelete(&lcp);
    51975211        an = i;
    51985212      }
    51995213      else
    52005214      {
    5201         nDelete(&lcset);
    5202         nDelete(&lcp);
    52035215        en = i;
    52045216      }
     
    52335245      {
    52345246        number lcset,lcp;
    5235         lcset = nCopy(set[an].p->coef);
    5236         lcp = nCopy(p->p->coef);
     5247        lcset = pGetCoeff(set[an].p);
     5248        lcp = pGetCoeff(p->p);
    52375249        if(!nGreaterZero(lcset))
    5238           lcset = nInpNeg(lcset);
     5250        {
     5251          set[an].p=p_Neg(set[an].p,currRing);
     5252          if (set[an].t_p!=NULL)
     5253            pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
     5254          lcset=pGetCoeff(set[an].p);
     5255        }
    52395256        if(!nGreaterZero(lcp))
    5240           lcp = nInpNeg(lcp);
     5257        {
     5258          p->p=p_Neg(p->p,currRing);
     5259          if (p->t_p!=NULL)
     5260            pSetCoeff0(p->t_p,pGetCoeff(p->p));
     5261          lcp=pGetCoeff(p->p);
     5262        }
    52415263        if(nGreater(lcset, lcp))
    52425264        {
    5243           nDelete(&lcset);
    5244           nDelete(&lcp);
    52455265          return en;
    52465266        }
    52475267        else
    52485268        {
    5249           nDelete(&lcset);
    5250           nDelete(&lcp);
    52515269          return an;
    52525270        }
     
    52615279    {
    52625280      number lcset,lcp;
    5263       lcset = nCopy(set[an].p->coef);
    5264       lcp = nCopy(p->p->coef);
     5281      lcset = pGetCoeff(set[i].p);
     5282      lcp = pGetCoeff(p->p);
    52655283      if(!nGreaterZero(lcset))
    5266         lcset = nInpNeg(lcset);
     5284      {
     5285        set[i].p=p_Neg(set[i].p,currRing);
     5286        if (set[i].t_p!=NULL)
     5287          pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
     5288        lcset=pGetCoeff(set[i].p);
     5289      }
    52675290      if(!nGreaterZero(lcp))
    5268         lcp = nInpNeg(lcp);
     5291      {
     5292        p->p=p_Neg(p->p,currRing);
     5293        if (p->t_p!=NULL)
     5294          pSetCoeff0(p->t_p,pGetCoeff(p->p));
     5295        lcp=pGetCoeff(p->p);
     5296      }
    52695297      if(nGreater(lcset, lcp))
    52705298      {
    5271         nDelete(&lcset);
    5272         nDelete(&lcp);
    52735299        an = i;
    52745300      }
    52755301      else
    52765302      {
    5277         nDelete(&lcset);
    5278         nDelete(&lcp);
    52795303        en = i;
    52805304      }
     
    87448768                if(pLmDivisibleBy(r->m[q],r->m[l])
    87458769                #ifdef HAVE_RINGS
    8746                 && ((rField_is_Ring(currRing) 
     8770                && ((rField_is_Ring(currRing)
    87478771                && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
    87488772                || !(rField_is_Ring(currRing)))
    87498773                #endif
    8750                 && (pLength(r->m[q]) < pLength(r->m[l]) || 
     8774                && (pLength(r->m[q]) < pLength(r->m[l]) ||
    87518775                (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
    87528776                {
     
    90139037/*!
    90149038  used for GB over ZZ: look for constant and monomial elements in the ideal
    9015   background: any known constant element of ideal suppresses 
     9039  background: any known constant element of ideal suppresses
    90169040              intermediate coefficient swell
    90179041*/
    90189042poly preIntegerCheck(ideal FOrig, ideal Q)
    9019 { 
     9043{
    90209044  assume(nCoeff_is_Ring_Z(currRing->cf));
    90219045  if(!nCoeff_is_Ring_Z(currRing->cf))
     
    90509074      idSkipZeroes(monred);
    90519075      posconst = idPosConstant(monred);
    9052       //the constant, if found, will be from Q 
     9076      //the constant, if found, will be from Q
    90539077      if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
    90549078      {
     
    90809104              II->m[i+1] = II->m[i];
    90819105      II->m[0] = pOne();
    9082       ideal syz = idSyzygies(II, isNotHomog, NULL);     
     9106      ideal syz = idSyzygies(II, isNotHomog, NULL);
    90839107      poly integer = NULL;
    90849108      for(int i = IDELEMS(syz)-1;i>=0; i--)
     
    91099133  {
    91109134    if(idIs0(monred))
    9111     { 
     9135    {
    91129136      poly mindegmon = NULL;
    91139137      for(int i = 0; i<IDELEMS(one); i++)
     
    91279151      {
    91289152          for(int i = IDELEMS(II)-1; i>=0; i--)
    9129               if(II->m[i] != NULL) 
     9153              if(II->m[i] != NULL)
    91309154                  II->m[i+1] = II->m[i];
    91319155          II->m[0] = mindegmon;
     
    91869210/*!
    91879211  used for GB over ZZ: intermediate reduction by monomial elements
    9188   background: any known constant element of ideal suppresses 
     9212  background: any known constant element of ideal suppresses
    91899213              intermediate coefficient swell
    91909214*/
     
    92199243        {
    92209244          ok = TRUE;
    9221         } 
     9245        }
    92229246      }
    92239247      pp = pNext(p);
     
    92559279/*!
    92569280  used for GB over ZZ: final reduction by constant elements
    9257   background: any known constant element of ideal suppresses 
     9281  background: any known constant element of ideal suppresses
    92589282              intermediate coefficient swell and beautifies output
    92599283*/
     
    92779301            p_SetCoeff(p,dummy,currRing);
    92789302          }
    9279           pp = pNext(p); 
     9303          pp = pNext(p);
    92809304          if((pp == NULL) && (nIsZero(p->coef)))
    92819305          {
Note: See TracChangeset for help on using the changeset viewer.