Changeset cb7827 in git


Ignore:
Timestamp:
Apr 26, 2012, 3:50:40 PM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
59778389f5075553bef793320610ce298d74b18d
Parents:
47046743f1273df49ef99fda72ed22a1531d10bd
git-author:
Martin Lee <martinlee84@web.de>2012-04-26 15:50:40+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-05-07 14:16:35+02:00
Message:
chg: compute cofactors in chinrem_gcd and use them to test divisibility
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd.cc

    r4704674 rcb7827  
    12601260      minCommonDeg= tmin (minCommonDeg, tmin (degree (g, i), degree (f, i)));
    12611261  }
    1262   b= 2*tmin (maxNorm (f), maxNorm (g))*abs (cl)*power (CanonicalForm (2), minCommonDeg);
     1262  b= 2*tmin (maxNorm (f), maxNorm (g))*abs (cl)*
     1263     power (CanonicalForm (2), minCommonDeg);
    12631264  bool equal= false;
    12641265  i = cf_getNumBigPrimes() - 1;
    12651266
     1267  CanonicalForm cof, cog, cofp, cogp, newCof, newCog, cofn, cogn;
    12661268  //Off (SW_RATIONAL);
    12671269  while ( true )
     
    12771279    setCharacteristic( p );
    12781280    Dp = gcd_poly( mapinto( f ), mapinto( g ) );
     1281    //Dp = GCD_small_p (mapinto (f), mapinto (g), cofp, cogp);
    12791282    Dp /=Dp.lc();
     1283    cofp= mapinto (f)/Dp;
     1284    cogp= mapinto (g)/Dp;
     1285    cofp /= lc (cofp);
     1286    cogp /= lc (cogp);
    12801287    setCharacteristic( 0 );
    12811288    dp_deg=totaldegree(Dp);
     
    12881295    {
    12891296      D = mapinto( Dp );
     1297      cof= mapinto (cofp);
     1298      cog= mapinto (cogp);
    12901299      d_deg=dp_deg;
    12911300      q = p;
     
    12961305      {
    12971306        chineseRemainder( D, q, mapinto( Dp ), p, newD, newq );
     1307        chineseRemainder( cof, q, mapinto (cofp), p, newCof, newq);
     1308        chineseRemainder( cog, q, mapinto (cogp), p, newCog, newq);
     1309        cof= newCof;
     1310        cog= newCog;
    12981311        q = newq;
    12991312        D = newD;
     
    13051318        q = p;
    13061319        D = mapinto( Dp );
     1320        cof= mapinto (cof);
     1321        cog= mapinto (cog);
    13071322        d_deg=dp_deg;
    13081323        test= 0;
     
    13181333    {
    13191334      Dn= Farey(D,q);
     1335      cofn= Farey(cof,q);
     1336      cogn= Farey(cog,q);
    13201337      int is_rat= isOn (SW_RATIONAL);
    13211338      On (SW_RATIONAL);
    13221339      cd = bCommonDen( Dn ); // we need On(SW_RATIONAL)
     1340      cofn *= bCommonDen (cofn);
     1341      cogn *= bCommonDen (cogn);
    13231342      if (!is_rat)
    13241343        Off (SW_RATIONAL);
     
    13291348        equal= true;
    13301349      //Dn /=vcontent(Dn,Variable(1));
    1331       if ((equal || q > b) && fdivides( Dn, f ) && fdivides( Dn, g ) )
     1350      if ((equal || q > b) || ((cofn*Dn==f) && (cogn*Dn==g)))
    13321351      {
    13331352        //printf(" -> success\n");
     
    13481367}
    13491368
     1369
Note: See TracChangeset for help on using the changeset viewer.