Changeset cb4f0c in git


Ignore:
Timestamp:
Oct 20, 2012, 12:03:23 AM (11 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
7964658e19c1f9b2949f81ae9f46b6395fee757c
Parents:
0851b018d4d94918ad78eea2f6350c7012d2a9aa
git-author:
Martin Lee <martinlee84@web.de>2012-10-20 00:03:23+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-10-24 12:32:43+02:00
Message:
chg: switch to modular gcd if psr can get dense
chg: optimization of Hi computation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd.cc

    r0851b0 rcb4f0c  
    573573    Variable v = f.mvar();
    574574    Hi = power( LC( pi1, v ), delta );
     575    int maxNumVars= tmax (getNumVars (pi), getNumVars (pi1));
     576
     577    if (!(pi.isUnivariate() && pi1.isUnivariate()))
     578    {
     579      if (size (Hi)*size (pi)/(maxNumVars*3) > 500) //maybe this needs more tuning
     580      {
     581        On (SW_USE_FF_MOD_GCD);
     582        C *= gcd (pi, pi1);
     583        Off (SW_USE_FF_MOD_GCD);
     584        return C;
     585      }
     586    }
     587
    575588    if ( (delta+1) % 2 )
    576589        bi = 1;
    577590    else
    578591        bi = -1;
    579     int maxNumVars= tmax (getNumVars (pi), getNumVars (pi1));
    580     CanonicalForm oldPi= pi, oldPi1= pi1;
     592    CanonicalForm oldPi= pi, oldPi1= pi1, powHi;
    581593    while ( degree( pi1, v ) > 0 )
    582594    {
     
    605617        {
    606618            delta = degree( pi, v ) - degree( pi1, v );
     619            powHi= power (Hi, delta-1);
    607620            if ( (delta+1) % 2 )
    608                 bi = LC( pi, v ) * power( Hi, delta );
     621                bi = LC( pi, v ) * powHi*Hi;
    609622            else
    610                 bi = -LC( pi, v ) * power( Hi, delta );
    611             Hi = power( LC( pi1, v ), delta ) / power( Hi, delta-1 );
     623                bi = -LC( pi, v ) * powHi*Hi;
     624            Hi = power( LC( pi1, v ), delta ) / powHi;
     625            if (!(pi.isUnivariate() && pi1.isUnivariate()))
     626            {
     627              if (size (Hi)*size (pi)/(maxNumVars*3) > 500) //maybe this needs more tuning
     628              {
     629                On (SW_USE_FF_MOD_GCD);
     630                C *= gcd (oldPi, oldPi1);
     631                Off (SW_USE_FF_MOD_GCD);
     632                return C;
     633              }
     634            }
    612635        }
    613636    }
Note: See TracChangeset for help on using the changeset viewer.