Changeset ad1c3b in git for kernel/kstd2.cc


Ignore:
Timestamp:
Mar 13, 2008, 8:25:49 PM (16 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
ba49d9f52b36950f74de618b1a41a677fa14fa07
Parents:
411ea98eecab97fbeac7f8395433a159d6d03584
Message:
*levandov: shift GB nonhomog case


git-svn-id: file:///usr/local/Singular/svn/trunk@10616 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/kstd2.cc

    r411ea98 rad1c3b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.64 2008-02-26 23:35:30 levandov Exp $ */
     4/* $Id: kstd2.cc,v 1.65 2008-03-13 19:25:48 levandov Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    15291529    }
    15301530
     1531    poly qq;
     1532
     1533    /* here in the nonhomog case we shrink the new spoly */
     1534   
     1535    if ( ! strat->homog)
     1536    {
     1537      strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
     1538      /* assume strat->P.t_p != NULL */
     1539      /* in the nonhomog case we have to shrink the polynomial */
     1540      assume(strat->P.t_p!=NULL);
     1541      qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
     1542      if (qq != NULL)
     1543      {
     1544         /* we're here if Shrink is nonzero */
     1545        //         strat->P.p =  NULL;
     1546        //        strat->P.Delete(); /* deletes P.p and P.t_p */ //error
     1547        strat->P.p   =  NULL; // is not set by Delete
     1548        strat->P.t_p =  qq;
     1549        strat->P.GetP(strat->lmBin);
     1550        // update sev and length
     1551        strat->initEcart(&(strat->P));
     1552        strat->P.sev = pGetShortExpVector(strat->P.p);
     1553//         strat->P.FDeg = strat->P.pFDeg();
     1554//         strat->P.length = strat->P.pLDeg();
     1555//         strat->P.pLength =strat->P.GetpLength(); //pLength(strat->P.p);
     1556      }
     1557      else
     1558      {
     1559         /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
     1560#ifdef KDEBUG
     1561         if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
     1562#endif
     1563         //      strat->P.Delete();  // cause error
     1564         strat->P.p = NULL;
     1565         strat->P.t_p = NULL;
     1566           //         strat->P.p = NULL; // or delete strat->P.p ?
     1567       }
     1568    }
     1569      /* end shrinking poly in the nonhomog case */
     1570
    15311571    if (strat->P.p == NULL && strat->P.t_p == NULL)
    15321572    {
     
    15701610          strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
    15711611      }
     1612
     1613      // here we must shrink again! and optionally reduce again
     1614      // or build shrink into redtailBba!
    15721615
    15731616#ifdef KDEBUG
     
    15961639      }
    15971640
     1641    /* here in the nonhomog case we shrink the reduced poly AGAIN */
     1642   
     1643    if ( ! strat->homog)
     1644    {
     1645      strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
     1646      /* assume strat->P.t_p != NULL */
     1647      /* in the nonhomog case we have to shrink the polynomial */
     1648      assume(strat->P.t_p!=NULL); // poly qq defined above
     1649      qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
     1650      if (qq != NULL)
     1651      {
     1652         /* we're here if Shrink is nonzero */
     1653        //         strat->P.p =  NULL;
     1654        //        strat->P.Delete(); /* deletes P.p and P.t_p */ //error
     1655        strat->P.p   =  NULL; // is not set by Delete
     1656        strat->P.t_p =  qq;
     1657        strat->P.GetP(strat->lmBin);
     1658        // update sev and length
     1659        strat->initEcart(&(strat->P));
     1660        strat->P.sev = pGetShortExpVector(strat->P.p);
     1661      }
     1662      else
     1663      {
     1664         /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
     1665#ifdef PDEBUG
     1666         if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
     1667#endif
     1668         //      strat->P.Delete();  // cause error
     1669         strat->P.p = NULL;
     1670         strat->P.t_p = NULL;
     1671           //         strat->P.p = NULL; // or delete strat->P.p ?
     1672         goto     red_shrink2zero;
     1673       }
     1674    }
     1675      /* end shrinking poly AGAIN in the nonhomog case */
     1676
     1677
    15981678      // enter into S, L, and T
    15991679      //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
     
    16011681      //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
    16021682      // the default value for atT = -1 as in bba
    1603       strat->P.GetP(); // because shifts are counted with .p structure
     1683      /*   strat->P.GetP(); */
     1684      // because shifts are counted with .p structure // done before, but ?
    16041685      enterTShift(strat->P,strat,-1,uptodeg, lV);
    1605 //       poly vw;
    1606 //       if (strat->P.t_p!=NULL)
    1607 //       {
    1608 //          vw = pCopyL2p(strat->P,strat);     
    1609 //       }
    1610 //       else
    1611 //       {
    1612 //          vw = pCopy(strat->P.p);
    1613 //       }
    16141686      enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
    16151687      //      enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
    1616       // delete vw ?
    16171688      // posInS only depends on the leading term
    16181689      if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
     
    16241695      //  strat->P.Delete(); // syzComp test: it is in T
    16251696      }
     1697
    16261698      if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
    16271699//      Print("[%d]",hilbeledeg);
     
    16291701      if (strat->sl>srmax) srmax = strat->sl;
    16301702    }
    1631     else if (strat->P.p1 == NULL && strat->minim > 0)
    1632     {
    1633       p_Delete(&strat->P.p2, currRing, strat->tailRing);
     1703    else
     1704    {
     1705    red_shrink2zero:
     1706      if (strat->P.p1 == NULL && strat->minim > 0)
     1707      {
     1708        p_Delete(&strat->P.p2, currRing, strat->tailRing);
     1709      }
    16341710    }
    16351711#ifdef KDEBUG
Note: See TracChangeset for help on using the changeset viewer.