Changeset 1c473f in git


Ignore:
Timestamp:
Feb 24, 2008, 6:41:32 PM (16 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
4d43ff458adf4e30c9059ffaf846500aa5d64c61
Parents:
c1d4a79cef5604c9608af4eb2e48128ef65c70fb
Message:
*levandov: modifications of shift free gb


git-svn-id: file:///usr/local/Singular/svn/trunk@10606 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/kstd1.cc

    rc1d4a79 r1c473f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd1.cc,v 1.32 2008-02-08 10:11:28 wienand Exp $ */
     4/* $Id: kstd1.cc,v 1.33 2008-02-24 17:41:31 levandov Exp $ */
    55/*
    66* ABSTRACT:
     
    17151715        r=bba(F,Q,NULL,hilb,strat);
    17161716    }
     1717  }
     1718#ifdef KDEBUG
     1719  idTest(r);
     1720#endif
     1721  if (toReset)
     1722  {
     1723    kModW = NULL;
     1724    pRestoreDegProcs(pFDegOld, pLDegOld);
     1725  }
     1726  pLexOrder = b;
     1727//Print("%d reductions canceled \n",strat->cel);
     1728  HCord=strat->HCord;
     1729  delete(strat);
     1730  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
     1731  return r;
     1732}
     1733
     1734ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
     1735                int newIdeal, intvec *vw, int uptodeg, int lV)
     1736{
     1737  ideal r;
     1738  BOOLEAN b=pLexOrder,toReset=FALSE;
     1739  BOOLEAN delete_w=(w==NULL);
     1740  kStrategy strat=new skStrategy;
     1741
     1742  if(!TEST_OPT_RETURN_SB)
     1743    strat->syzComp = syzComp;
     1744  if (TEST_OPT_SB_1)
     1745    strat->newIdeal = newIdeal;
     1746  if (rField_has_simple_inverse())
     1747    strat->LazyPass=20;
     1748  else
     1749    strat->LazyPass=2;
     1750  strat->LazyDegree = 1;
     1751  strat->ak = idRankFreeModule(F);
     1752  strat->kModW=kModW=NULL;
     1753  strat->kHomW=kHomW=NULL;
     1754  if (vw != NULL)
     1755  {
     1756    pLexOrder=FALSE;
     1757    strat->kHomW=kHomW=vw;
     1758    pFDegOld = pFDeg;
     1759    pLDegOld = pLDeg;
     1760    pSetDegProcs(kHomModDeg);
     1761    toReset = TRUE;
     1762  }
     1763  if (h==testHomog)
     1764  {
     1765    if (strat->ak == 0)
     1766    {
     1767      h = (tHomog)idHomIdeal(F,Q);
     1768      w=NULL;
     1769    }
     1770    else if (!TEST_OPT_DEGBOUND)
     1771    {
     1772      h = (tHomog)idHomModule(F,Q,w);
     1773    }
     1774  }
     1775  pLexOrder=b;
     1776  if (h==isHomog)
     1777  {
     1778    if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
     1779    {
     1780      strat->kModW = kModW = *w;
     1781      if (vw == NULL)
     1782      {
     1783        pFDegOld = pFDeg;
     1784        pLDegOld = pLDeg;
     1785        pSetDegProcs(kModDeg);
     1786        toReset = TRUE;
     1787      }
     1788    }
     1789    pLexOrder = TRUE;
     1790    if (hilb==NULL) strat->LazyPass*=2;
     1791  }
     1792  strat->homog=h;
     1793#ifdef KDEBUG
     1794  idTest(F);
     1795#endif
     1796  if (pOrdSgn==-1)
     1797  {
     1798    /* error: no local ord yet with shifts */
     1799    Print("No local ordering possible for shifts");
     1800    return(NULL);
     1801  }
     1802  else
     1803  {
     1804    /* global ordering */
     1805    if (w!=NULL)
     1806      r=bbaShift(F,Q,*w,hilb,strat,uptodeg,lV);
     1807    else
     1808      r=bbaShift(F,Q,NULL,hilb,strat,uptodeg,lV);
    17171809  }
    17181810#ifdef KDEBUG
  • kernel/kstd1.h

    rc1d4a79 r1c473f  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kstd1.h,v 1.2 2007-07-25 10:53:15 Singular Exp $ */
     6/* $Id: kstd1.h,v 1.3 2008-02-24 17:41:31 levandov Exp $ */
    77/*
    88* ABSTRACT
     
    3333ideal kStd(ideal F, ideal Q, tHomog h, intvec ** mw,intvec *hilb=NULL,
    3434          int syzComp=0,int newIdeal=0, intvec *vw=NULL);
     35
     36ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
     37                int newIdeal, intvec *vw, int uptodeg, int lVblock);
    3538
    3639/* the following global data are defined in kutil.cc */
  • kernel/kstd2.cc

    rc1d4a79 r1c473f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.62 2008-02-23 20:12:51 levandov Exp $ */
     4/* $Id: kstd2.cc,v 1.63 2008-02-24 17:41:31 levandov Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    16911691}
    16921692
     1693
    16931694ideal freegb(ideal I, int uptodeg, int lVblock)
    16941695{
     
    16981699  /* uptodeg and lVblock are correct - test them! */
    16991700
    1700   kStrategy strat = new skStrategy;
     1701  //  kStrategy strat = new skStrategy;
    17011702  /* ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV) */
    17021703  /* at the moment:
     
    17041705- no *w, no *hilb
    17051706  */
    1706   ideal RS = bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
     1707  /* ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
     1708     int newIdeal, intvec *vw) */
     1709  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL, uptodeg, lVblock);
     1710    //bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
    17071711  idSkipZeroes(RS);
    17081712  return(RS);
  • kernel/kutil.cc

    rc1d4a79 r1c473f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.85 2008-02-23 20:12:52 levandov Exp $ */
     4/* $Id: kutil.cc,v 1.86 2008-02-24 17:41:31 levandov Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    43074307  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
    43084308  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
     4309  /* in usual case strat->cv is 0, it gets changed only in shift routines */
     4310  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
    43094311  /*mflush();*/
    43104312}
     
    61706172  strat->cp = 0;
    61716173  strat->c3 = 0;
     6174  strat->cv = 0;
    61726175  strat->tail = pInit();
    61736176  /*- set s -*/
     
    62446247  /* that is create the pairs (f, s \dot g)  */
    62456248
    6246   poly qq = strat->S[i]; // previously thought and now again: lm in currRing, tail in tailRing
    6247 // elt's of S are compl. in currRing
    6248 // previously thought: lm in currRing, tail in tailRing
     6249  poly qq = strat->S[i]; //  lm in currRing, tail in tailRing
    62496250
    62506251  //  poly q = pCopy(pHead(strat->S[i])); // lm in currRing
     
    62556256  /* hence, a total number of elt's to add is: */
    62566257  /*  int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1);  */
    6257   //  int toInsert = uptodeg  - pLastVblock(q, lV) +1;
    62586258  int toInsert =  itoInsert(qq, uptodeg,  lV, strat->tailRing);
    62596259
     
    62866286
    62876287  // for the 0th shift: insert the orig. pair
    6288 
    62896288  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
    62906289
    6291   for (j=1; j<= toInsert; j++) // toIns - 1?
     6290  for (j=1; j<= toInsert; j++)
    62926291  {
    62936292    //    q = pLPshift(strat->S[i],j,uptodeg,lV);
     
    62966295    //    s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
    62976296    //    pNext(q) = s; // in tailRing
    6298     //    qq = pLPshift(q,j,uptodeg,lV); // need move
    6299     // ??? no move needed: in currRing
    6300     //    qq = pMoveCurrTail2poly(qq,strat);
    63016297    /* here we need to call enterOnePair with two polys ... */
    63026298
     
    63136309    enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
    63146310  }
    6315   /* delete qq */
    6316   //  pDelete(&qq);
    63176311}
    63186312
    63196313/*1
    63206314* put the pairs (sh \dot qq,p)  into the set B, ecart=ecart(p)
     6315* despite the name, not only self shifts
    63216316*/
    63226317void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
     
    63256320  /* format: p,qq are in LObject form: lm in CR, tail in TR */
    63266321  /* for true self pairs qq ==p  */
    6327   /* we test both */
     6322  /* we test both qq and p */
    63286323  assume(p_LmCheckIsFromRing(qq,currRing));
    63296324  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
     
    63336328  int j = 0;
    63346329
    6335   /* for such pairs start with 1, not with 0 */
     6330  /* for such self pairs start with 1, not with 0 */
    63366331  if (qq == p) j=1;
    63376332
     
    63396334  /* that is create the pairs (f, s \dot g)  */
    63406335
    6341  /* determine how many elements we have to insert for a given s[i] */
    6342   /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
    6343   /* hence, a total number of elt's to add is: */
    6344   /*  int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1);  */
    6345 
    6346   //  poly q = pHead(qq); // lm in currRing
    6347   //  pNext(q) = prCopyR(pNext(qq), strat->tailRing, currRing);
    6348   //  pTest(q);
    6349 
    63506336  int toInsert =  itoInsert(qq, uptodeg,  lV, strat->tailRing);
    63516337
     
    63576343#endif
    63586344
    6359 //   int toInsert = p_mLastVblock(qq, lV,currRing);
    6360 //   if (pNext(qq) != NULL)
    6361 //   {
    6362 //     toInsert = si_max(toInsert, p_LastVblock(pNext(qq), lV,strat->tailRing) );
    6363 //   }
    6364 //   toInsert = uptodeg  - toInsert +1;
    6365 
    63666345  poly q, s;
    63676346
    6368   //  assume(i<=strat->sl); // from OnePair
    63696347  if (strat->interred_flag) return; // ?
    63706348
     
    63736351  int qfromQ = 0; // strat->fromQ[i];
    63746352
    6375   for (; j<= toInsert; j++) // toIns - 1?
     6353  for (; j<= toInsert; j++)
    63766354  {
    63776355    //    q = pLPshift(strat->S[i],j,uptodeg,lV);
     
    63836361    //    s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
    63846362    //    pNext(q) = s; // in tailRing
    6385     //prMoveR(s,strat->tailRing,currRing); // in currRing
    63866363    /* here we need to call enterOnePair with two polys ... */
    63876364#ifdef KDEBUG
     
    63976374    enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
    63986375  }
    6399   /* delete q? */
    6400   //  pDelete(&q);
    64016376}
    64026377
     
    64076382{
    64086383
    6409   /* New Format: q and p are like strat->P.p, so lm in CR, tail in TR */
    6410   /* Format: q is a poly compl. in currRing, p is like strat->P.p, so lm in CR, tail in TR */
     6384  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
    64116385
    64126386  /* check this Formats: */
    6413   //  assume(p_CheckIsFromRing(q,currRing));
    64146387  assume(p_LmCheckIsFromRing(q,currRing));
    64156388  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
     
    64286401#endif
    64296402
    6430   /* indeed we need LM only before real spoly */
    64316403  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
    64326404
     
    64356407  /* need additionally: int up_to_degree, poly V0 with the variables in (0)  or just the number lV = the length of the first block */
    64366408
    6437   //  atR = -1;
    6438   //  assume(i<=strat->sl); // satisfied automatically
    64396409  if (strat->interred_flag) return;
    64406410
     
    64536423
    64546424  /* apply the V criterion */
    6455   /* or do it in ManyShifts? */
    64566425  if (!isInV(Lp.lcm, lV))
    64576426  {
     
    64686437    pLmFree(Lp.lcm);
    64696438    Lp.lcm=NULL;
     6439    /* + counter for applying the V criterion */
     6440    strat->cv++;
    64706441    return;
    6471     /* + add the counter for applying the V criterion */
    6472     /* like strat->cv */
    64736442  }
    64746443
     
    66726641    /*- the pair (S[i],p) enters B -*/
    66736642    /* both of them should have their LM in currRing and TAIL in tailring */
    6674     Lp.p1 = q;  // already converted with pMove2CurrTail(q,strat);
     6643    Lp.p1 = q;  // already in the needed form
    66756644    Lp.p2 = p; // already in the needed form
    66766645
     
    68206789  /*  int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1);  */
    68216790
    6822   //  int toInsert = uptodeg  - pLastVblock(pCopy(p.p), lV) +1;
    6823   //  int toInsert = uptodeg  - pLastVblock(p.p, lV) +1;
    6824  
    68256791  int toInsert =  itoInsert(p.p, uptodeg,  lV, strat->tailRing);
    68266792
     
    68336799    atT = strat->posInT(strat->T, strat->tl, p);
    68346800 
    6835   //  LObject q;
    6836   //  poly s;
    68376801  /* can call enterT in a sequence, e.g. */
    68386802
    6839   /* first we create the 0th shift */
    6840   //  q = p;
    6841 //   if (q.t_p!=NULL)
    6842 //   {
    6843 //     q.p = pHead(s); // in currRing
    6844 //     q.t_p = prMoveR(s, /* sourcering: */currRing, /* destring: */ strat->tailRing);
    6845 //     if (pNext(q.t_p)!=NULL)
    6846 //     {
    6847 //       pNext(q.p)=pNext(q.t_p);
    6848 //     }
    6849 //   }
    6850 //   else
    6851 //   {
    6852 //     q.p=s;
    6853 //   }
    68546803  /* shift0 = it's our model for further shifts */
    68556804  enterT(p,strat,atT);
     
    68616810    qq.t_p = p_LPshift(p.t_p, i, uptodeg, lV, strat->tailRing); // direct shift
    68626811    qq.GetP();
    6863     /* shift p, that is create another LObject and shift its poly */
    6864     /* change: p.p, p.t_p, */
    6865     /* change: i_r (must be -1 because we're not yet in T ? */
    6866     //    s = pLPshift(pCopyL2p(q,strat), i, uptodeg, lV); // deletes 1st arg, hence pCopy
    6867     //    q.p = pLPshift(q.p, 1, uptodeg, lV);
    6868 //       qq.p = pHead(s); // in currRing
    6869 //       qq.t_p = prMoveR(s, /* sourcering: */currRing, /* destring: */ strat->tailRing);
    6870 //       if (pNext(q.t_p)!=NULL)
    6871 //       {
    6872 //         pNext(q.p)=pNext(q.t_p);
    6873 //       }
    6874 //     }
    6875 //     else
    6876 //     {
    6877 //       q.p=s;
    6878 //     }
    68796812    // update q.sev
    68806813    qq.sev = pGetShortExpVector(qq.p);
     
    68846817    enterT(qq,strat,atT);
    68856818  }
    6886 
    68876819/* Q: what to do with this one in the orig enterT ? */
    68886820/*  strat->R[strat->tl] = &(strat->T[atT]); */
  • kernel/kutil.h

    rc1d4a79 r1c473f  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.33 2008-02-23 20:12:52 levandov Exp $ */
     6/* $Id: kutil.h,v 1.34 2008-02-24 17:41:32 levandov Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for kStd
     
    298298#endif
    299299  int cp,c3;
     300  int cv; // in shift bases: counting V criterion
    300301  int sl,mu;
    301302  int tl,tmax;
     
    649650
    650651ideal freegb(ideal I, int uptodeg, int lVblock);
    651 #endif
     652
     653ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV);
     654#endif
  • kernel/shiftgb.cc

    rc1d4a79 r1c473f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: shiftgb.cc,v 1.5 2008-02-23 20:12:53 levandov Exp $ */
     4/* $Id: shiftgb.cc,v 1.6 2008-02-24 17:41:32 levandov Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for shift GB and free GB
     
    370370}
    371371
     372  /* there should be two routines: */
     373  /* 1. tests squarefreeness: in homog this suffices */
     374  /* 2. test the presence of a hole -> in the tail??? */
    372375
    373376int isInV(poly p, int lV)
    374377{
     378
    375379  if (lV <= 0) return(0);
    376380  /* returns 1 iff p is in V */
     
    431435  //  i = uptodeg  - i +1;
    432436  i = uptodeg  - i;
    433   p_wrp(p,currRing,r); Print("----i:%d",i); PrintLn();
     437  //  p_wrp(p,currRing,r); Print("----i:%d",i); PrintLn();
    434438  return(i);
    435439}
Note: See TracChangeset for help on using the changeset viewer.