Changeset 978a8c in git for kernel


Ignore:
Timestamp:
May 13, 2016, 1:26:50 PM (8 years ago)
Author:
Adi Popescu <adi_popescum@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
ff38ee02732552e78a143ebf4f9aadccee454071
Parents:
7aa6edb86ac7c8b9cfbd1bcd3ba76d19a18ca978
Message:
experimental. Check Faugere RewCrit and pDivideM, postreducebymon
Location:
kernel/GBEngine
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/kstd1.cc

    r7aa6ed r978a8c  
    1414#define MYTEST 0
    1515
    16 #define ADIDEBUG 1
     16#define ADIDEBUG 0
    1717#define ADIDEBUG_NF 0
    1818
  • kernel/GBEngine/kstd2.cc

    r7aa6ed r978a8c  
    2020#endif /* ifndef SING_NDEBUG */
    2121
    22 #define ADIDEBUG 0
     22#define ADIDEBUG 1
    2323#define ADIDEBUG_COUNT 0
    2424#define REV_BLOCK_SBA 0
     
    722722    if (j < 0)
    723723    {
    724       #ifdef HAVE_RINGS
    725       if(rField_is_Ring(currRing))
    726       {
    727         //Check for sigdrop after reduction
    728         if(pLtCmp(beforeredsig,h->sig) == 1)
    729         {
    730           #if ADIDEBUG
    731           printf("\nSigDrop after reduce\n");pWrite(beforeredsig);pWrite(h->sig);
    732           #endif
    733           strat->sigdrop = TRUE;
    734           //Reduce it as much as you can
    735           int red_result = redRing(h,strat);
    736           if(red_result == 0)
    737           {
    738             //It reduced to 0, cancel the sigdrop
    739             #if ADIDEBUG
    740             printf("\nReduced to 0 via redRing. Cancel sigdrop\n");
    741             #endif
    742             strat->sigdrop = FALSE;
    743             p_Delete(&h->sig,currRing);h->sig = NULL;
    744             return 0;
    745           }
    746           else
     724      // over ZZ: cleanup coefficients by complete reduction with monomials
     725      postReduceByMonSig(h, strat);
     726      if(nIsZero(pGetCoeff(h->p))) return 2;
     727      j = kFindDivisibleByInT(strat, h,start);
     728      if(j < 0)
     729      {
     730        if(strat->tl >= 0)
     731            h->i_r1 = strat->tl;
     732        else
     733            h->i_r1 = -1;
     734        if (h->GetLmTailRing() == NULL)
     735        {
     736          if (h->lcm!=NULL) pLmDelete(h->lcm);
     737          h->Clear();
     738          return 0;
     739        }
     740        #ifdef HAVE_RINGS
     741        if(rField_is_Ring(currRing))
     742        {
     743          //Check for sigdrop after reduction
     744          if(pLtCmp(beforeredsig,h->sig) == 1)
    747745          {
    748746            #if ADIDEBUG
    749             printf("\nReduced to this via redRing.SIGDROP\n");pWrite(h->p);
     747            printf("\nSigDrop after reduce\n");pWrite(beforeredsig);pWrite(h->sig);
    750748            #endif
    751             //strat->enterS(*h, strat->sl+1, strat, strat->tl);
    752             return 0;
     749            strat->sigdrop = TRUE;
     750            //Reduce it as much as you can
     751            int red_result = redRing(h,strat);
     752            if(red_result == 0)
     753            {
     754              //It reduced to 0, cancel the sigdrop
     755              #if ADIDEBUG
     756              printf("\nReduced to 0 via redRing. Cancel sigdrop\n");
     757              #endif
     758              strat->sigdrop = FALSE;
     759              p_Delete(&h->sig,currRing);h->sig = NULL;
     760              return 0;
     761            }
     762            else
     763            {
     764              #if ADIDEBUG
     765              printf("\nReduced to this via redRing.SIGDROP\n");pWrite(h->p);
     766              #endif
     767              //strat->enterS(*h, strat->sl+1, strat, strat->tl);
     768              return 0;
     769            }
    753770          }
    754         }
    755         p_Delete(&beforeredsig,currRing);
    756       }
    757       #endif
    758       return 1;
     771          p_Delete(&beforeredsig,currRing);
     772        }
     773        #endif
     774        return 1;
     775      }
    759776    }
    760777
     
    21572174    printf("\n   list   L\n");
    21582175    int iii;
    2159     #if 0
     2176    #if 1
    21602177    for(iii = 0; iii<= strat->Ll; iii++)
    21612178    {
  • kernel/GBEngine/kutil.cc

    r7aa6ed r978a8c  
    1212#define MYTEST 0
    1313
    14 #define ADIDEBUG 0
     14#define ADIDEBUG 1
    1515
    1616#include <kernel/mod2.h>
     
    61346134BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly /*lm*/, kStrategy strat, int start=0)
    61356135{
    6136   return FALSE;
     6136  //return FALSE;
    61376137  //printf("Faugere Rewritten Criterion\n");
    61386138//#if 1
     
    61596159      PrintS("DELETE!\n");
    61606160#endif
     6161printf("\nFaugere RewCrit: * divisible by *\n");pWrite(sig);pWrite(strat->sig[k]);
    61616162      return TRUE;
    61626163    }
     
    97009701        if(pLmDivisibleBy(strat->S[i], p))
    97019702        {
     9703          number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
     9704          p_SetCoeff(p,dummy,currRing);
     9705        }
     9706        if(nIsZero(p->coef))
     9707        {
     9708          pLmDelete(&p);
     9709          deleted = TRUE;
     9710        }
     9711        else
     9712        {
     9713          ok = TRUE;
     9714        }
     9715      }
     9716      pp = pNext(p);
     9717      while(pp != NULL)
     9718      {
     9719        if(pLmDivisibleBy(strat->S[i], pp))
     9720        {
     9721          number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
     9722          p_SetCoeff(pp,dummy,currRing);
     9723          if(nIsZero(pp->coef))
     9724          {
     9725            pLmDelete(&pNext(p));
     9726            pp = pNext(p);
     9727            deleted = TRUE;
     9728          }
     9729          else
     9730          {
     9731            p = pp;
     9732            pp = pNext(p);
     9733          }
     9734        }
     9735        else
     9736        {
     9737          p = pp;
     9738          pp = pNext(p);
     9739        }
     9740      }
     9741    }
     9742  }
     9743  h->SetLmCurrRing();
     9744  if(deleted)
     9745    strat->initEcart(h);
     9746}
     9747
     9748void postReduceByMonSig(LObject* h, kStrategy strat)
     9749{
     9750  if(!nCoeff_is_Ring_Z(currRing->cf))
     9751      return;
     9752  printf("\npostreducebymon\n");
     9753  poly hSig = h->sig;
     9754  poly pH = h->GetP();
     9755  poly p,pp;
     9756  p = pH;
     9757  bool deleted = FALSE, ok = FALSE;
     9758  for(int i = 0; i<=strat->sl; i++)
     9759  {
     9760    p = pH;
     9761    if(pNext(strat->S[i]) == NULL)
     9762    {
     9763      printf("\n------------------\n");
     9764      pWrite(p);
     9765      pWrite(strat->S[i]);
     9766      while(ok == FALSE)
     9767      {
     9768        if(pLmDivisibleBy(strat->S[i], p))
     9769        {
     9770          poly dum = pDivideM(pHead(p),pHead(strat->S[i]));
     9771          pWrite(dum);getchar();
    97029772          number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
    97039773          p_SetCoeff(p,dummy,currRing);
  • kernel/GBEngine/kutil.h

    r7aa6ed r978a8c  
    748748poly preIntegerCheck(ideal F, ideal Q);
    749749void postReduceByMon(LObject* h, kStrategy strat);
     750void postReduceByMonSig(LObject* h, kStrategy strat);
    750751void finalReduceByMon(kStrategy strat);
    751752#endif
Note: See TracChangeset for help on using the changeset viewer.