Changeset cbc616 in git


Ignore:
Timestamp:
Jul 25, 2008, 12:23:09 PM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
fe7424e916aeb90c55dfb281c0392f267f374df6
Parents:
3f685ce735ca6b7086ca139f15b88896cb2decd0
Message:
*hannes:bbaPart


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

Legend:

Unmodified
Added
Removed
  • kernel/kstd2.cc

    r3f685c rcbc616  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.71 2008-07-24 10:27:17 Singular Exp $ */
     4/* $Id: kstd2.cc,v 1.72 2008-07-25 10:23:09 Singular Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    1414
    1515#include "mod2.h"
     16#ifdef HAVE_PLURAL
     17#define PLURAL_INTERNAL_DECLARATIONS 1
     18#endif
    1619#include "kutil.h"
    1720#include "structs.h"
     
    12431246  {
    12441247    completeReduce(strat);
     1248#ifdef HAVE_TAIL_RING
    12451249    if (strat->completeReduce_retry)
    12461250    {
     
    12531257      completeReduce(strat);
    12541258    }
     1259#endif
    12551260  }
    12561261  else if (TEST_OPT_PROT) PrintLn();
     
    12711276  return (strat->Shdl);
    12721277}
    1273 
     1278#ifdef HAVE_PLURAL
     1279ideal bbaPart (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat)
     1280{
     1281  om_Opts.MinTrack = 5;
     1282  int   srmax,lrmax, red_result = 1;
     1283  int   olddeg,reduc;
     1284  int hilbeledeg=1,hilbcount=0,minimcnt=0;
     1285  BOOLEAN withT = FALSE;
     1286
     1287  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
     1288  nc_gr_initBba(F,strat);
     1289  initBuchMoraPos(strat);
     1290  //initHilbCrit(F,Q,&hilb,strat);
     1291  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
     1292  /*Shdl=*/initBuchMora(F, Q,strat);
     1293  //if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
     1294  strat->posInT=posInT110;
     1295
     1296  srmax = strat->sl;
     1297  reduc = olddeg = lrmax = 0;
     1298
     1299#ifndef NO_BUCKETS
     1300  if (!TEST_OPT_NOT_BUCKETS)
     1301    strat->use_buckets = 1;
     1302#endif
     1303
     1304  // redtailBBa against T for inhomogenous input
     1305  if (!K_TEST_OPT_OLDSTD)
     1306    withT = ! strat->homog;
     1307
     1308  // strat->posInT = posInT_pLength;
     1309  kTest_TS(strat);
     1310
     1311//#ifdef HAVE_TAIL_RING
     1312//  kStratInitChangeTailRing(strat);
     1313//#endif
     1314
     1315  /* compute------------------------------------------------------- */
     1316  while (strat->Ll >= 0)
     1317  {
     1318    if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
     1319    #ifdef KDEBUG
     1320      #ifdef HAVE_RINGS
     1321        if (TEST_OPT_DEBUG) PrintS("--- next step ---\n");
     1322      #endif
     1323      if (TEST_OPT_DEBUG) messageSets(strat);
     1324    #endif
     1325    if (strat->Ll== 0) strat->interpt=TRUE;
     1326    if (TEST_OPT_DEGBOUND
     1327        && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
     1328            || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
     1329    {
     1330      /*
     1331       *stops computation if
     1332       * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
     1333       *a predefined number Kstd1_deg
     1334       */
     1335      while ((strat->Ll >= 0)
     1336        && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
     1337        && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
     1338            || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
     1339        )
     1340        deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
     1341      if (strat->Ll<0) break;
     1342      else strat->noClearS=TRUE;
     1343    }
     1344    /* picks the last element from the lazyset L */
     1345    strat->P = strat->L[strat->Ll];
     1346    strat->Ll--;
     1347
     1348    if (pNext(strat->P.p) == strat->tail)
     1349    {
     1350      // deletes the short spoly
     1351#ifdef HAVE_RINGS
     1352      if (rField_is_Ring(currRing))
     1353        pLmDelete(strat->P.p);
     1354      else
     1355#endif
     1356        pLmFree(strat->P.p);
     1357      strat->P.p = NULL;
     1358      poly m1 = NULL, m2 = NULL;
     1359
     1360//#ifdef HAVE_TAIL_RING
     1361//      // check that spoly creation is ok
     1362//      while (strat->tailRing != currRing &&
     1363//             !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
     1364//      {
     1365//        assume(m1 == NULL && m2 == NULL);
     1366//        // if not, change to a ring where exponents are at least
     1367//        // large enough
     1368//        kStratChangeTailRing(strat);
     1369//      }
     1370//#endif
     1371      // create the real one
     1372      strat->P.p = nc_CreateSpoly(strat->P.p1,strat->P.p2,currRing);
     1373    }
     1374    //else if (strat->P.p1 == NULL)
     1375    //{
     1376    //  if (strat->minim > 0)
     1377    //    strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
     1378    //  // for input polys, prepare reduction
     1379    //  strat->P.PrepareRed(strat->use_buckets);
     1380    //}
     1381
     1382    if (strat->P.p == NULL && strat->P.t_p == NULL)
     1383    {
     1384      red_result = 0;
     1385    }
     1386    else
     1387    {
     1388      if (TEST_OPT_PROT)
     1389        message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
     1390                &olddeg,&reduc,strat, red_result);
     1391
     1392      /* reduction of the element choosen from L */
     1393      red_result = strat->red(&strat->P,strat);
     1394    }
     1395
     1396    // reduction to non-zero new poly
     1397    if (red_result == 1)
     1398    {
     1399      /* statistic */
     1400      if (TEST_OPT_PROT) PrintS("s");
     1401
     1402      // get the polynomial (canonicalize bucket, make sure P.p is set)
     1403      strat->P.GetP(strat->lmBin);
     1404
     1405      int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
     1406
     1407      // reduce the tail and normalize poly
     1408      // in the ring case we cannot expect LC(f) = 1,
     1409      // therefore we call pContent instead of pNorm
     1410      if ((TEST_OPT_INTSTRATEGY) || (rField_is_Ring(currRing)))
     1411      {
     1412        strat->P.pCleardenom();
     1413        if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
     1414        {
     1415          strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
     1416          strat->P.pCleardenom();
     1417        }
     1418      }
     1419      else
     1420      {
     1421        strat->P.pNorm();
     1422        if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
     1423          strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
     1424      }
     1425
     1426#ifdef KDEBUG
     1427      if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
     1428#endif
     1429
     1430      // min_std stuff
     1431      //if ((strat->P.p1==NULL) && (strat->minim>0))
     1432      //{
     1433      //  if (strat->minim==1)
     1434      //  {
     1435      //    strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
     1436      //    p_Delete(&strat->P.p2, currRing, strat->tailRing);
     1437      //  }
     1438      //  else
     1439      //  {
     1440      //    strat->M->m[minimcnt]=strat->P.p2;
     1441      //    strat->P.p2=NULL;
     1442      //  }
     1443      //  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
     1444      //    pNext(strat->M->m[minimcnt])
     1445      //      = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
     1446      //                                     strat->tailRing, currRing,
     1447      //                                     currRing->PolyBin);
     1448      //  minimcnt++;
     1449      //}
     1450
     1451      // enter into S, L, and T
     1452      //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
     1453        enterT(strat->P, strat);
     1454#ifdef HAVE_RINGS
     1455      if (rField_is_Ring(currRing))
     1456        superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
     1457      else
     1458#endif
     1459        enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
     1460      // posInS only depends on the leading term
     1461      if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
     1462      {
     1463      strat->enterS(strat->P, pos, strat, strat->tl);
     1464      }
     1465      else
     1466      {
     1467      //  strat->P.Delete(); // syzComp test: it is in T
     1468      }
     1469      //if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
     1470//      Print("[%d]",hilbeledeg);
     1471      if (strat->P.lcm!=NULL)
     1472#ifdef HAVE_RINGS
     1473        pLmDelete(strat->P.lcm);
     1474#else
     1475        pLmFree(strat->P.lcm);
     1476#endif
     1477      if (strat->sl>srmax) srmax = strat->sl;
     1478    }
     1479    //else if (strat->P.p1 == NULL && strat->minim > 0)
     1480    //{
     1481    //  p_Delete(&strat->P.p2, currRing, strat->tailRing);
     1482    //}
     1483
     1484#ifdef KDEBUG
     1485    memset(&(strat->P), 0, sizeof(strat->P));
     1486#endif
     1487    kTest_TS(strat);
     1488  }
     1489#ifdef KDEBUG
     1490  if (TEST_OPT_DEBUG) messageSets(strat);
     1491#endif
     1492  /* complete reduction of the standard basis--------- */
     1493  if (TEST_OPT_SB_1)
     1494  {
     1495    int k=1;
     1496    int j;
     1497    while(k<=strat->sl)
     1498    {
     1499      j=0;
     1500      loop
     1501      {
     1502        if (j>=k) break;
     1503        clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
     1504        j++;
     1505      }
     1506      k++;
     1507    }
     1508  }
     1509
     1510  if (TEST_OPT_REDSB)
     1511  {
     1512    completeReduce(strat);
     1513//#ifdef HAVE_TAIL_RING
     1514//    if (strat->completeReduce_retry)
     1515//    {
     1516//      // completeReduce needed larger exponents, retry
     1517//      // to reduce with S (instead of T)
     1518//      // and in currRing (instead of strat->tailRing)
     1519//      cleanT(strat);strat->tailRing=currRing;
     1520//      int i;
     1521//      for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
     1522//      completeReduce(strat);
     1523//    }
     1524//#endif
     1525  }
     1526  else if (TEST_OPT_PROT) PrintLn();
     1527
     1528  /* release temp data-------------------------------- */
     1529  exitBuchMora(strat);
     1530  if (TEST_OPT_WEIGHTM)
     1531  {
     1532    pRestoreDegProcs(pFDegOld, pLDegOld);
     1533    if (ecartWeights)
     1534    {
     1535      omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
     1536      ecartWeights=NULL;
     1537    }
     1538  }
     1539  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
     1540  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
     1541  return (strat->Shdl);
     1542}
     1543#endif
    12741544poly kNF2 (ideal F,ideal Q,poly q,kStrategy strat, int lazyReduce)
    12751545{
Note: See TracChangeset for help on using the changeset viewer.