Changeset c66a53 in git for kernel/GBEngine/kspoly.cc


Ignore:
Timestamp:
Jul 16, 2016, 9:42:28 AM (8 years ago)
Author:
Adi Popescu <adi_popescum@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
b6f42a8c2492312d1dd4f0c4c917fcf054636416
Parents:
1798a00a38186e92d8d8d6dc786ccdf6aad508cd34183abab486cee38d70559e5cdcfbc307938f64
Message:
Merge branch 'spielwiese' of github.com:Singular/Sources into SigDrop
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/kspoly.cc

    r34183a rc66a53  
    2222#include <kernel/polys.h>
    2323#endif
     24
     25#define ADIDEBUG 0
    2426
    2527#ifdef KDEBUG
     
    180182                 kStrategy strat)
    181183{
     184#if ADIDEBUG
     185printf("\nksReducePolySig\n");
     186pWrite(PR->p);pWrite(PR->sig);
     187pWrite(PW->p);pWrite(PW->sig);
     188#endif
    182189#ifdef KDEBUG
    183190  red_count++;
     
    235242#endif
    236243    p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
     244    //I have also to set the leading coeficient for sigMult (in the case of rings)
     245    if(rField_is_Ring(currRing))
     246    {
     247      pSetCoeff(sigMult,nMult(nDiv(pGetCoeff(PR->p),pGetCoeff(PW->p)), pGetCoeff(sigMult)));
     248    }
    237249//#if 1
    238250#ifdef DEBUGF5
     
    244256    printf("--------------\n");
    245257#endif
    246     int sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
     258    int sigSafe;
     259    if(!rField_is_Ring(currRing))
     260      sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
    247261    // now we can delete the copied polynomial data used for checking for
    248262    // sig-safeness of the reduction step
     
    252266
    253267#endif
     268    if(rField_is_Ring(currRing))
     269    {
     270      // Set the sig
     271      poly origsig = pCopy(PR->sig);
     272      PR->sig = pHead(pSub(PR->sig, sigMult));
     273      //The sigs have the same lm, have to substract
     274      //It may happen that now the signature is 0 (drop)
     275      if(PR->sig == NULL)
     276      {
     277        #if ADIDEBUG
     278        printf("\nPossible sigdrop in ksreducepolysig (lost signature)\n");
     279        #endif
     280        strat->sigdrop=TRUE;
     281      }
     282      else
     283      {
     284        if(pLtCmp(PR->sig,origsig) == 1)
     285        {
     286          // do not allow this reduction - it will increase it's signature
     287          // and the partially standard basis is just till the old sig, not the new one
     288          PR->is_redundant = TRUE;
     289          pDelete(&PR->sig);
     290          PR->sig = origsig;
     291          strat->blockred++;
     292          return 3;
     293        }
     294        if(pLtCmp(PR->sig,origsig) == -1)
     295        {
     296          #if ADIDEBUG
     297          printf("\nSigdrop in ksreducepolysig from * to *\n");pWrite(origsig);pWrite(PR->sig);
     298          #endif
     299          strat->sigdrop=TRUE;
     300        }
     301      }
     302      pDelete(&origsig);
     303    }
    254304    //pDelete(&f1);
    255     pDelete(&sigMult);
    256305    // go on with the computations only if the signature of p2 is greater than the
    257306    // signature of fm*p1
    258     if(sigSafe != 1)
     307    if(sigSafe != 1 && !rField_is_Ring(currRing))
    259308    {
    260309      PR->is_redundant = TRUE;
     
    324373    }
    325374  }
    326 
    327375  // take care of coef buisness
    328   if (! n_IsOne(pGetCoeff(p2), tailRing))
    329   {
    330     number bn = pGetCoeff(lm);
    331     number an = pGetCoeff(p2);
    332     int ct = ksCheckCoeff(&an, &bn, tailRing->cf);    // Calculate special LC
    333     p_SetCoeff(lm, bn, tailRing);
    334     if ((ct == 0) || (ct == 2))
    335       PR->Tail_Mult_nn(an);
    336     if (coef != NULL) *coef = an;
    337     else n_Delete(&an, tailRing);
     376  if(rField_is_Ring(currRing))
     377  {
     378    p_SetCoeff(lm, nDiv(pGetCoeff(lm),pGetCoeff(p2)), tailRing);
     379    if (coef != NULL) *coef = n_Init(1, tailRing);
    338380  }
    339381  else
    340382  {
    341     if (coef != NULL) *coef = n_Init(1, tailRing);
    342   }
    343 
     383    if (! n_IsOne(pGetCoeff(p2), tailRing))
     384    {
     385      number bn = pGetCoeff(lm);
     386      number an = pGetCoeff(p2);
     387      int ct = ksCheckCoeff(&an, &bn, tailRing->cf);    // Calculate special LC
     388      p_SetCoeff(lm, bn, tailRing);
     389      if (((ct == 0) || (ct == 2)))
     390        PR->Tail_Mult_nn(an);
     391      if (coef != NULL) *coef = an;
     392      else n_Delete(&an, tailRing);
     393    }
     394    else
     395    {
     396      if (coef != NULL) *coef = n_Init(1, tailRing);
     397    }
     398  }
    344399
    345400  // and finally,
     
    361416  }
    362417#endif
    363 
    364418#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
    365419  if (TEST_OPT_DEBUG)
Note: See TracChangeset for help on using the changeset viewer.