Changeset 9e806f in git for kernel/kstd1.cc


Ignore:
Timestamp:
Jul 12, 2012, 3:24:21 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
010b3f834f90fe0815d115c4a3a4c6934a96ac81
Parents:
cffd3e2f630fbc7b0e35afee97d6fa948cfd0b3e19609cce8ae122e920a77ead0ddc3ea3984ecc0d
Message:
Merge pull request #152 from ederc/sw-sba-ssg

Signature-based algorithms in spielwiese
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/kstd1.cc

    rcffd3e r9e806f  
    10981098}
    10991099
     1100
     1101void initSba(ideal F,kStrategy strat)
     1102{
     1103  int i;
     1104  //idhdl h;
     1105 /* setting global variables ------------------- */
     1106  strat->enterS = enterSSba;
     1107    strat->red2 = redHoney;
     1108  if (strat->honey)
     1109    strat->red2 = redHoney;
     1110  else if (currRing->pLexOrder && !strat->homog)
     1111    strat->red2 = redLazy;
     1112  else
     1113  {
     1114    strat->LazyPass *=4;
     1115    strat->red2 = redHomog;
     1116  }
     1117#ifdef HAVE_RINGS  //TODO Oliver
     1118  if (rField_is_Ring(currRing))
     1119  {
     1120    strat->red2 = redRing;
     1121  }
     1122#endif
     1123  if (currRing->pLexOrder && strat->honey)
     1124    strat->initEcart = initEcartNormal;
     1125  else
     1126    strat->initEcart = initEcartBBA;
     1127  if (strat->honey)
     1128    strat->initEcartPair = initEcartPairMora;
     1129  else
     1130    strat->initEcartPair = initEcartPairBba;
     1131  //strat->kIdeal = NULL;
     1132  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
     1133  //else              strat->kIdeal->rtyp=MODUL_CMD;
     1134  //strat->kIdeal->data=(void *)strat->Shdl;
     1135  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
     1136  {
     1137    //interred  machen   Aenderung
     1138    strat->pOrigFDeg  = currRing->pFDeg;
     1139    strat->pOrigLDeg  = currRing->pLDeg;
     1140    //h=ggetid("ecart");
     1141    //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
     1142    //{
     1143    //  ecartWeights=iv2array(IDINTVEC(h));
     1144    //}
     1145    //else
     1146    {
     1147      ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
     1148      /*uses automatic computation of the ecartWeights to set them*/
     1149      kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights, currRing);
     1150    }
     1151    pRestoreDegProcs(currRing, totaldegreeWecart, maxdegreeWecart);
     1152    if (TEST_OPT_PROT)
     1153    {
     1154      for(i=1; i<=(currRing->N); i++)
     1155        Print(" %d",ecartWeights[i]);
     1156      PrintLn();
     1157      mflush();
     1158    }
     1159  }
     1160  // for sig-safe reductions in signature-based
     1161  // standard basis computations
     1162  strat->red          = redSig;
     1163  //strat->incremental  = TRUE;
     1164  strat->currIdx      = 1;
     1165}
     1166
    11001167void initMora(ideal F,kStrategy strat)
    11011168{
     
    17951862      else
    17961863        r=bba(F,Q,NULL,hilb,strat);
     1864    }
     1865  }
     1866#ifdef KDEBUG
     1867  idTest(r);
     1868#endif
     1869  if (toReset)
     1870  {
     1871    kModW = NULL;
     1872    pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
     1873  }
     1874  currRing->pLexOrder = b;
     1875//Print("%d reductions canceled \n",strat->cel);
     1876  HCord=strat->HCord;
     1877  delete(strat);
     1878  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
     1879  return r;
     1880}
     1881
     1882ideal kSba(ideal F, ideal Q, tHomog h,intvec ** w, int incremental, int arri, intvec *hilb,int syzComp,
     1883          int newIdeal, intvec *vw)
     1884{
     1885  if(idIs0(F))
     1886    return idInit(1,F->rank);
     1887
     1888  ideal r;
     1889  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
     1890  BOOLEAN delete_w=(w==NULL);
     1891  kStrategy strat=new skStrategy;
     1892  if (incremental!=0)
     1893  {
     1894    strat->incremental = TRUE;
     1895  }
     1896  else
     1897  {
     1898    strat->incremental = FALSE;
     1899  }
     1900  if (arri!=0)
     1901  {
     1902    strat->rewCrit1 = arriRewDummy;
     1903    strat->rewCrit2 = arriRewCriterion;
     1904  }
     1905  else
     1906  {
     1907    strat->rewCrit1 = faugereRewCriterion;
     1908    strat->rewCrit2 = faugereRewCriterion;
     1909  }
     1910
     1911  if(!TEST_OPT_RETURN_SB)
     1912    strat->syzComp = syzComp;
     1913  if (TEST_OPT_SB_1)
     1914    strat->newIdeal = newIdeal;
     1915  if (rField_has_simple_inverse(currRing))
     1916    strat->LazyPass=20;
     1917  else
     1918    strat->LazyPass=2;
     1919  strat->LazyDegree = 1;
     1920  strat->enterOnePair=enterOnePairNormal;
     1921  strat->chainCrit=chainCritNormal;
     1922  strat->ak = id_RankFreeModule(F,currRing);
     1923  strat->kModW=kModW=NULL;
     1924  strat->kHomW=kHomW=NULL;
     1925  if (vw != NULL)
     1926  {
     1927    currRing->pLexOrder=FALSE;
     1928    strat->kHomW=kHomW=vw;
     1929    strat->pOrigFDeg = currRing->pFDeg;
     1930    strat->pOrigLDeg = currRing->pLDeg;
     1931    pSetDegProcs(currRing,kHomModDeg);
     1932    toReset = TRUE;
     1933  }
     1934  if (h==testHomog)
     1935  {
     1936    if (strat->ak == 0)
     1937    {
     1938      h = (tHomog)idHomIdeal(F,Q);
     1939      w=NULL;
     1940    }
     1941    else if (!TEST_OPT_DEGBOUND)
     1942    {
     1943      h = (tHomog)idHomModule(F,Q,w);
     1944    }
     1945  }
     1946  currRing->pLexOrder=b;
     1947  if (h==isHomog)
     1948  {
     1949    if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
     1950    {
     1951      strat->kModW = kModW = *w;
     1952      if (vw == NULL)
     1953      {
     1954        strat->pOrigFDeg = currRing->pFDeg;
     1955        strat->pOrigLDeg = currRing->pLDeg;
     1956        pSetDegProcs(currRing,kModDeg);
     1957        toReset = TRUE;
     1958      }
     1959    }
     1960    currRing->pLexOrder = TRUE;
     1961    if (hilb==NULL) strat->LazyPass*=2;
     1962  }
     1963  strat->homog=h;
     1964#ifdef KDEBUG
     1965  idTest(F);
     1966  idTest(Q);
     1967
     1968#if MYTEST
     1969  if (TEST_OPT_DEBUG)
     1970  {
     1971    PrintS("// kSTD: currRing: ");
     1972    rWrite(currRing);
     1973  }
     1974#endif
     1975
     1976#endif
     1977#ifdef HAVE_PLURAL
     1978  if (rIsPluralRing(currRing))
     1979  {
     1980    const BOOLEAN bIsSCA  = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
     1981    strat->no_prod_crit   = ! bIsSCA;
     1982    if (w!=NULL)
     1983      r = nc_GB(F, Q, *w, hilb, strat, currRing);
     1984    else
     1985      r = nc_GB(F, Q, NULL, hilb, strat, currRing);
     1986  }
     1987  else
     1988#endif
     1989#ifdef HAVE_RINGS
     1990  if (rField_is_Ring(currRing))
     1991    r=bba(F,Q,NULL,hilb,strat);
     1992  else
     1993#endif
     1994  {
     1995    if (currRing->OrdSgn==-1)
     1996    {
     1997      if (w!=NULL)
     1998        r=mora(F,Q,*w,hilb,strat);
     1999      else
     2000        r=mora(F,Q,NULL,hilb,strat);
     2001    }
     2002    else
     2003    {
     2004      if (w!=NULL)
     2005        r=sba(F,Q,*w,hilb,strat);
     2006      else
     2007                          r=sba(F,Q,NULL,hilb,strat);
    17972008    }
    17982009  }
Note: See TracChangeset for help on using the changeset viewer.