Changeset 8e903f in git for kernel/GBEngine/kutil.cc


Ignore:
Timestamp:
Apr 24, 2020, 7:01:53 PM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
34ac5c4176020d530d61125750c8457430cd7f22
Parents:
b94a72a3900cee27c0409f0d8cfe58d9e880654c756dc7155d3cba64f765acc3475e5c4e12cdbbff
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2020-04-24 19:01:53+02:00
git-committer:
GitHub <noreply@github.com>2020-04-24 19:01:53+02:00
Message:
Merge pull request #990 from kabouzeid/stable

Fix segfault because of components in LP
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/kutil.cc

    r756dc7 r8e903f  
    234234
    235235#ifdef HAVE_SHIFTBBA
    236 static inline int pLPDivComp(poly p, poly q) {
     236static inline int pLPDivComp(poly p, poly q)
     237{
    237238  if ((currRing->pCompIndex < 0) || (__p_GetComp(p,currRing) == __p_GetComp(q,currRing)))
    238239  {
     
    755756  return -1;
    756757}
    757 
     758#endif
     759
     760#ifdef HAVE_SHIFTBBA
    758761int kFindInTShift(poly p, kStrategy strat)
    759762{
     
    16001603  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
    16011604
    1602   if (!rHasLocalOrMixedOrdering(currRing)) {
     1605  if (!rHasLocalOrMixedOrdering(currRing))
     1606  {
    16031607    unsigned long sev = pGetShortExpVector(gcd);
    16041608
    1605     for (int j = 0; j < strat->sl; j++) {
     1609    for (int j = 0; j < strat->sl; j++)
     1610    {
    16061611      if (j == i)
    16071612        continue;
    16081613
    1609       if (n_DivBy(d, pGetCoeff(strat->S[j]), currRing->cf) &&
    1610           !(strat->sevS[j] & ~sev) &&
    1611           p_LmDivisibleBy(strat->S[j], gcd, currRing)) {
     1614      if (n_DivBy(d, pGetCoeff(strat->S[j]), currRing->cf)
     1615      && !(strat->sevS[j] & ~sev)
     1616      && p_LmDivisibleBy(strat->S[j], gcd, currRing))
     1617      {
    16121618        nDelete(&d);
    16131619        nDelete(&s);
     
    32303236  strat->Bl = -1;
    32313237}
     3238
    32323239/*2
    32333240*the pairset B of pairs of type (s[i],p) is complete now. It will be updated
     
    72877294    return FALSE;
    72887295  int found = -1;
    7289   for (int i=strat->Bl; i>-1; i--) {
     7296  for (int i=strat->Bl; i>-1; i--)
     7297  {
    72907298    if (pLmEqual(strat->B[i].sig,sig))
    72917299    {
     
    78237831      int j;
    78247832      j = kFindDivisibleByInT(strat, &Ln);
    7825       if (j < 0) {
     7833      if (j < 0)
     7834      {
    78267835        j = kFindDivisibleByInT_Z(strat, &Ln);
    7827         if (j < 0) {
     7836        if (j < 0)
     7837        {
    78287838          break;
    7829         } else {
     7839        }
     7840        else
     7841        {
    78307842          /* reduction not cancelling a tail term, but reducing its coefficient */
    78317843          With = &(strat->T[j]);
     
    1232512337// }
    1232612338
    12327 #ifdef HAVE_SHIFTBBA
    1232812339/*2
    1232912340* put the  lcm(q,p)  into the set B, q is the shift of some s[i]
    1233012341*/
     12342#ifdef HAVE_SHIFTBBA
    1233112343static BOOLEAN enterOneStrongPolyShift (poly q, poly p, int /*ecart*/, int /*isFromQ*/, kStrategy strat, int atR, int /*ecartq*/, int qisFromQ, int shiftcount, int ifromS)
    1233212344{
     
    1249212504  return TRUE;
    1249312505}
     12506#endif
     12507
    1249412508
    1249512509/*2
    1249612510* put the pair (q,p)  into the set B, ecart=ecart(p), q is the shift of some s[i] (ring case)
    1249712511*/
     12512#ifdef HAVE_SHIFTBBA
    1249812513static void enterOnePairRingShift (poly q, poly p, int /*ecart*/, int isFromQ, kStrategy strat, int atR, int /*ecartq*/, int qisFromQ, int shiftcount, int ifromS)
    1249912514{
     
    1273612751  kTest_TS(strat);
    1273712752}
    12738 
     12753#endif
     12754
     12755#ifdef HAVE_SHIFTBBA
    1273912756// adds the strong pair and the normal pair for rings (aka gpoly and spoly)
    1274012757static void enterOneStrongPolyAndEnterOnePairRingShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
     
    1274312760  enterOnePairRingShift(q, p, ecart, isFromQ, strat, atR, ecartq, qisFromQ, shiftcount, ifromS); // "spoly"
    1274412761}
    12745 
     12762#endif
     12763
     12764#ifdef HAVE_SHIFTBBA
    1274612765// creates if possible (q,p), (shifts(q),p)
    1274712766static void enterOnePairWithShifts (int q_inS /*also i*/, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_lastVblock)
     
    1283112850#endif
    1283212851
    12833 #ifdef HAVE_SHIFTBBA
    1283412852
    1283512853#ifdef KDEBUG
     
    1284012858* put the pair (q,p)  into the set B, ecart=ecart(p), q is the shift of some s[i]
    1284112859*/
     12860#ifdef HAVE_SHIFTBBA
    1284212861void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
    1284312862{
     
    1295012969            pLmFree(Lp.lcm);
    1295112970#ifdef CRITERION_DEBUG
    12952             if (TEST_OPT_DEBUG) {
     12971            if (TEST_OPT_DEBUG)
     12972            {
    1295312973              Print("--- chain crit using B[%d].lcm=%s\n", j, pString(strat->B[j].lcm));
    1295412974            }
     
    1296312983        {
    1296412984#ifdef CRITERION_DEBUG
    12965           if (TEST_OPT_DEBUG) {
     12985          if (TEST_OPT_DEBUG)
     12986          {
    1296612987            Print("--- chain crit using pair to remove B[%d].lcm=%s\n", j, pString(strat->B[j].lcm));
    1296712988          }
     
    1302713048            pLmFree(Lp.lcm);
    1302813049#ifdef CRITERION_DEBUG
    13029             if (TEST_OPT_DEBUG) {
     13050            if (TEST_OPT_DEBUG)
     13051            {
    1303013052              Print("--- chain crit using B[%d].lcm=%s\n", j, pString(strat->B[j].lcm));
    1303113053            }
     
    1303913061        {
    1304013062#ifdef CRITERION_DEBUG
    13041           if (TEST_OPT_DEBUG) {
     13063          if (TEST_OPT_DEBUG)
     13064          {
    1304213065            Print("--- chain crit using pair to remove B[%d].lcm=%s\n", j, pString(strat->B[j].lcm));
    1304313066          }
     
    1316913192  }
    1317013193}
     13194#endif
    1317113195
    1317213196/*3
     
    1317513199* additionally we put the pairs (h, s \sdot h) for s>=1 to L
    1317613200*/
     13201#ifdef HAVE_SHIFTBBA
    1317713202void initenterpairsShift (poly h,int k,int ecart,int isFromQ, kStrategy strat, int atR)
    1317813203{
     
    1323713262      {
    1323813263        // pairs (shifts(s[1..k]),h), (s[1..k],h)
    13239         for (j=0; j<=k; j++) {
     13264        for (j=0; j<=k; j++)
     13265        {
    1324013266          if (!strat->fromQ[j])
    1324113267          {
     
    1328113307        new_pair=TRUE;
    1328213308        // pairs (shifts(s[1..k]),h), (s[1..k],h)
    13283         for (j=0; j<=k; j++) {
     13309        for (j=0; j<=k; j++)
     13310        {
    1328413311          poly s = strat->S[j];
    1328513312          enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
     
    1335513382      {
    1335613383        // pairs (shifts(s[1..k]),h), (s[1..k],h)
    13357         for (j=0; j<=k; j++) {
     13384        for (j=0; j<=k; j++)
     13385        {
    1335813386          if ((pGetComp(h)==pGetComp(strat->S[j]))
    1335913387              || (pGetComp(strat->S[j])==0))
     
    1341713445  }
    1341813446}
     13447#endif
    1341913448
    1342013449/*3
     
    1342313452* additionally we put the pairs (h, s \sdot h) for s>=1 to L
    1342413453*/
     13454#ifdef HAVE_SHIFTBBA
    1342513455void initenterstrongPairsShift (poly h,int k,int ecart,int isFromQ, kStrategy strat, int atR)
    1342613456{
     
    1348513515      {
    1348613516        // pairs (shifts(s[1..k]),h), (s[1..k],h)
    13487         for (j=0; j<=k; j++) {
     13517        for (j=0; j<=k; j++)
     13518        {
    1348813519          if (!strat->fromQ[j])
    1348913520          {
     
    1351413545        new_pair=TRUE;
    1351513546        // pairs (shifts(s[1..k]),h), (s[1..k],h)
    13516         for (j=0; j<=k; j++) {
     13547        for (j=0; j<=k; j++)
     13548        {
    1351713549          poly s = strat->S[j];
    1351813550          // TODO: cache lastVblock of s[1..k] for later use
     
    1356013592      {
    1356113593        // pairs (shifts(s[1..k]),h), (s[1..k],h)
    13562         for (j=0; j<=k; j++) {
     13594        for (j=0; j<=k; j++)
     13595        {
    1356313596          if ((pGetComp(h)==pGetComp(strat->S[j]))
    1356413597              || (pGetComp(strat->S[j])==0))
     
    1359313626  }
    1359413627}
     13628#endif
    1359513629
    1359613630/*2
     
    1359813632*superfluous elements in S will be deleted
    1359913633*/
     13634#ifdef HAVE_SHIFTBBA
    1360013635void enterpairsShift (poly h,int k,int ecart,int pos,kStrategy strat, int atR)
    1360113636{
     
    1362113656  }
    1362213657}
     13658#endif
    1362313659
    1362413660/*2
     
    1362613662* assumes that p is already in T!
    1362713663*/
     13664#ifdef HAVE_SHIFTBBA
    1362813665void enterTShift(LObject p, kStrategy strat, int atT)
    1362913666{
Note: See TracChangeset for help on using the changeset viewer.