Changeset bf25df in git


Ignore:
Timestamp:
Nov 29, 2017, 8:45:44 AM (6 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
5116b546441146e8fe7a07b449c4c32e173e6fc4
Parents:
77acb83e7bb1f81429e6839e46a08965368c0e89
git-author:
Christian Eder <ederc@mathematik.uni-kl.de>2017-11-29 08:45:44+01:00
git-committer:
Christian Eder <ederc@mathematik.uni-kl.de>2018-08-16 09:52:17+02:00
Message:
smaller optimization when checking for possible reducers over the integers
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/kstd2.cc

    r77acb8 rbf25df  
    570570     * this is postponed and checked directly before deciding how to reduce h */
    571571    j = kFindDivisibleByInT(strat, h);
    572     if (j < 0)
     572    if (j < 0) {
    573573      j = kFindDivisibleByInTIntegers(strat, h);
    574     if (j < 0)
    575     {
    576       // over ZZ: cleanup coefficients by complete reduction with monomials
    577       postReduceByMon(h, strat);
    578       if(h->p == NULL)
    579       {
    580         if (h->lcm!=NULL) pLmDelete(h->lcm);
    581         h->Clear();
    582         tj.Clear();
    583         return 0;
    584       }
    585       if(nIsZero(pGetCoeff(h->p))) return 2;
    586       j = kFindDivisibleByInT(strat, h);
    587       if(j < 0)
    588       {
    589         if(strat->tl >= 0)
    590             h->i_r1 = strat->tl;
    591         else
    592             h->i_r1 = -1;
    593         if (h->GetLmTailRing() == NULL)
     574      if (j < 0)
     575      {
     576        // over ZZ: cleanup coefficients by complete reduction with monomials
     577        postReduceByMon(h, strat);
     578        if(h->p == NULL)
    594579        {
    595580          if (h->lcm!=NULL) pLmDelete(h->lcm);
     
    598583          return 0;
    599584        }
    600         return 1;
    601       }
    602     }
    603     if(n_DivBy(pGetCoeff(h->p), pGetCoeff(strat->T[j].p), currRing->cf)) {
     585        if(nIsZero(pGetCoeff(h->p))) return 2;
     586        j = kFindDivisibleByInT(strat, h);
     587        if(j < 0)
     588        {
     589          if(strat->tl >= 0)
     590              h->i_r1 = strat->tl;
     591          else
     592              h->i_r1 = -1;
     593          if (h->GetLmTailRing() == NULL)
     594          {
     595            if (h->lcm!=NULL) pLmDelete(h->lcm);
     596            h->Clear();
     597            tj.Clear();
     598            return 0;
     599          }
     600          return 1;
     601        }
     602      } else {
     603        /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))
     604        * => gcd-poly reduction */
     605
     606        /* first copy T[j] in order to multiply it with a coefficient later on */
     607        tj  = strat->T[j];
     608        tj.Copy();
     609        /* compute division with remainder of lc(h) and lc(T[j]) */
     610        rest = n_QuotRem(pGetCoeff(h->p), pGetCoeff(strat->T[j].p),
     611            &mult, currRing->cf);
     612        /* set corresponding new lead coefficient already. we do not
     613        * remove the lead term in ksReducePolyLC, but only apply
     614        * a lead coefficient reduction */
     615        tj.Mult_nn(rest);
     616        ksReducePolyLC(h, &tj, NULL, &mult, strat);
     617        tj.Delete();
     618      }
     619    } else {
    604620      ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat);
    605     } else {
    606       /* add h to T: it may be useful as a better reducer */
    607       /* enterT(*h, strat); */
    608       /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))
    609        * => gcd-poly reduction */
    610 
    611       /* first copy T[j] in order to multiply it with a coefficient later on */
    612       tj  = strat->T[j];
    613       tj.Copy();
    614       /* compute division with remainder of lc(h) and lc(T[j]) */
    615       rest = n_QuotRem(pGetCoeff(h->p), pGetCoeff(strat->T[j].p),
    616           &mult, currRing->cf);
    617       /* set corresponding new lead coefficient already. we do not
    618        * remove the lead term in ksReducePolyLC, but only apply
    619        * a lead coefficient reduction */
    620       tj.Mult_nn(rest);
    621       ksReducePolyLC(h, &tj, NULL, &mult, strat);
    622       tj.Delete();
    623621    }
    624622    /* printf("\nAfter small red: ");pWrite(h->p); */
Note: See TracChangeset for help on using the changeset viewer.