Changeset e21795 in git for kernel/GBEngine/kutil.cc


Ignore:
Timestamp:
May 26, 2016, 4:07:09 PM (8 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'ec94ef7a30b928574c0c3daf41f6804dff5f6b69')
Children:
7510bb63f9801836a7bf75aa5ffc7e82b8cec4fed6e0c0fd81f7fba2ec29faa8a27186e0133b2293
Parents:
c21def206345e194f51f5b0d9c86daf757b940f6
Message:
moved rField_is_Ring out of loops
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/kutil.cc

    rc21def re21795  
    355355  h = pNext(p);
    356356
    357   loop
    358   {
    359     if (h==NULL)
    360     {
    361       p_Delete(&pNext(p), r);
    362       if (!inNF)
    363       {
    364         number eins;
    365         if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
    366           eins = nCopy(lc);
    367         else
    368           eins=nInit(1);
    369         if (L->p != NULL)
    370         {
    371           pSetCoeff(L->p,eins);
    372           if (L->t_p != NULL)
    373             pSetCoeff0(L->t_p,eins);
    374         }
    375         else
    376           pSetCoeff(L->t_p,eins);
    377         /* p and t_p share the same coeff, if both are !=NULL */
    378         /* p==NULL==t_p cannot happen here */
    379       }
    380       L->ecart = 0;
    381       L->length = 1;
    382       //if (L->pLength > 0)
    383       L->pLength = 1;
    384       L->max = NULL;
    385 
    386       if (L->t_p != NULL && pNext(L->t_p) != NULL)
    387         p_Delete(&pNext(L->t_p),r);
    388       if (L->p != NULL && pNext(L->p) != NULL)
    389         pNext(L->p) = NULL;
    390 
    391       return;
    392     }
    393     i = 0;
     357#ifdef HAVE_RINGS
     358  if(rField_is_Ring(currRing))
     359  {
    394360    loop
    395361    {
    396       i++;
    397       if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
    398       if (i == r->N) break; // does divide, try next monom
    399     }
    400     //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
    401     #ifdef HAVE_RINGS
    402     // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
    403     //       domains), no zerodivisor test needed  CAUTION
    404     #if ADIDEBUG
    405     pWrite(h);
    406     #endif
    407     if (rField_is_Ring(r) && !n_DivBy(pGetCoeff(h),lc,r->cf))
    408     {
     362      if (h==NULL)
     363      {
     364        p_Delete(&pNext(p), r);
     365        if (!inNF)
     366        {
     367          number eins= nCopy(lc);
     368          if (L->p != NULL)
     369          {
     370            pSetCoeff(L->p,eins);
     371            if (L->t_p != NULL)
     372              pSetCoeff0(L->t_p,eins);
     373          }
     374          else
     375            pSetCoeff(L->t_p,eins);
     376          /* p and t_p share the same coeff, if both are !=NULL */
     377          /* p==NULL==t_p cannot happen here */
     378        }
     379        L->ecart = 0;
     380        L->length = 1;
     381        //if (L->pLength > 0)
     382        L->pLength = 1;
     383        L->max = NULL;
     384
     385        if (L->t_p != NULL && pNext(L->t_p) != NULL)
     386          p_Delete(&pNext(L->t_p),r);
     387        if (L->p != NULL && pNext(L->p) != NULL)
     388          pNext(L->p) = NULL;
     389
     390        return;
     391      }
     392      i = 0;
     393      loop
     394      {
     395        i++;
     396        if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
     397        if (i == r->N) break; // does divide, try next monom
     398      }
     399      //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
     400      // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
     401      //       domains), no zerodivisor test needed  CAUTION
    409402      #if ADIDEBUG
    410       printf("\nDoes not divide\n");
     403      pWrite(h);
    411404      #endif
    412       return;
    413     }
    414     #if ADIDEBUG
    415     printf("\nDivides. Go On\n");
    416     #endif
    417     #endif
    418     pIter(h);
     405      if (!n_DivBy(pGetCoeff(h),lc,r->cf))
     406      {
     407        #if ADIDEBUG
     408        printf("\nDoes not divide\n");
     409        #endif
     410        return;
     411      }
     412      #if ADIDEBUG
     413      printf("\nDivides. Go On\n");
     414      #endif
     415      pIter(h);
     416    }
     417  }
     418  else
     419#endif
     420  {
     421    loop
     422    {
     423      if (h==NULL)
     424      {
     425        p_Delete(&pNext(p), r);
     426        if (!inNF)
     427        {
     428          number eins=nInit(1);
     429          if (L->p != NULL)
     430          {
     431            pSetCoeff(L->p,eins);
     432            if (L->t_p != NULL)
     433              pSetCoeff0(L->t_p,eins);
     434          }
     435          else
     436            pSetCoeff(L->t_p,eins);
     437          /* p and t_p share the same coeff, if both are !=NULL */
     438          /* p==NULL==t_p cannot happen here */
     439        }
     440        L->ecart = 0;
     441        L->length = 1;
     442        //if (L->pLength > 0)
     443        L->pLength = 1;
     444        L->max = NULL;
     445
     446        if (L->t_p != NULL && pNext(L->t_p) != NULL)
     447          p_Delete(&pNext(L->t_p),r);
     448        if (L->p != NULL && pNext(L->p) != NULL)
     449          pNext(L->p) = NULL;
     450
     451        return;
     452      }
     453      i = 0;
     454      loop
     455      {
     456        i++;
     457        if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
     458        if (i == r->N) break; // does divide, try next monom
     459      }
     460      //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
     461      pIter(h);
     462    }
    419463  }
    420464}
     
    52205264#endif
    52215265
     5266#ifdef HAVE_RINGS
    52225267int posInL11Ringls (const LSet set, const int length,
    52235268              LObject* p,const kStrategy strat)
     
    53015346  }
    53025347}
    5303 
     5348#endif
    53045349
    53055350/*2 Position for rings L: Here I am
     
    60686113      }
    60696114    }
     6115    #ifdef HAVE_RINGS
    60706116    else
    60716117    {
     
    60906136      }
    60916137    }
     6138    #endif
    60926139    // if called from NF, T objects do not exist:
    60936140    if (strat->tl < 0 || strat->S_2_R[j] == -1)
     
    61356182      }
    61366183    }
     6184    #ifdef HAVE_RINGS
    61376185    else
    61386186    {
     
    61636211      }
    61646212    }
     6213    #endif
    61656214  }
    61666215}
     
    80788127* puts p to the set T at position atT
    80798128*/
     8129#ifdef HAVE_RINGS
    80808130void enterT_strong(LObject &p, kStrategy strat, int atT)
    80818131{
     8132  assume(rField_is_Ring(currRing));
    80828133  int i;
    80838134
     
    81578208  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
    81588209  #if 1
    8159   if(rField_is_Ring(currRing)
    8160   && rHasLocalOrMixedOrdering(currRing)
     8210  if(rHasLocalOrMixedOrdering(currRing)
    81618211  && !n_IsUnit(p.p->coef, currRing->cf))
    81628212  {
     
    81858235  kTest_T(&(strat->T[atT]));
    81868236}
    8187 
     8237#endif
    81888238
    81898239/*2
     
    82798329  if (TEST_OPT_SB_1)
    82808330    strat->chainCrit=chainCritOpt_1;
    8281 #ifdef HAVE_RINGS 
     8331#ifdef HAVE_RINGS
    82828332  if (rField_is_Ring(currRing))
    82838333  {
     
    83568406    strat->syzCrit  = syzCriterion;
    83578407  }
    8358 #ifdef HAVE_RINGS 
     8408#ifdef HAVE_RINGS
    83598409  if (rField_is_Ring(currRing))
    83608410  {
     
    87758825  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
    87768826    strat->posInT = posInT1;
     8827#ifdef HAVE_RINGS
    87778828  if (rField_is_Ring(currRing))
    87788829  {
     
    87828833    strat->posInT = posInT11;
    87838834  }
     8835#endif
    87848836  strat->posInLDependsOnLength = FALSE;
    87858837  strat->posInLSba  = posInLSig;
     
    89208972        )
    89218973        {
    8922          
    89238974          for(q=IDELEMS(Q)-1; q>=0;q--)
    89248975          {
     
    89428993      }
    89438994    }
     8995    #ifdef HAVE_RINGS
    89448996    else
    89458997    {
     
    89759027      }
    89769028    }
    8977 
     9029    #endif
    89789030  }
    89799031  else
     
    90199071          for(q=IDELEMS(Q)-1; q>=0;q--)
    90209072          {
    9021             if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
     9073            if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
    90229074            {
    90239075              if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
     
    90449096    if (/*TEST_OPT_REDSB &&*/ reduction_found)
    90459097    {
     9098      #ifdef HAVE_RINGS
    90469099      if(rField_is_Ring(currRing))
    90479100      {
     
    90759128      }
    90769129      else
     9130      #endif
    90779131      {
    90789132        for (l=IDELEMS(r)-1;l>=0;l--)
     
    93499403  return TRUE;
    93509404}
     9405#endif
     9406
     9407#ifdef HAVE_RINGS
    93519408/*!
    93529409  used for GB over ZZ: look for constant and monomial elements in the ideal
     
    95149571  return NULL;
    95159572}
    9516 
     9573#endif
     9574
     9575#ifdef HAVE_RINGS
    95179576/*!
    95189577  used for GB over ZZ: intermediate reduction by monomial elements
     
    95839642    strat->initEcart(h);
    95849643}
    9585 
     9644#endif
     9645
     9646#ifdef HAVE_RINGS
    95869647/*!
    95879648  used for GB over ZZ: final reduction by constant elements
     
    96539714  //idSkipZeroes(strat->Shdl);
    96549715}
    9655 
    96569716#endif
    96579717
Note: See TracChangeset for help on using the changeset viewer.