Changeset 4704674 in git


Ignore:
Timestamp:
Apr 26, 2012, 10:46:57 AM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
cb7827a842fd2e9878498f940e9f7735fdbe488e
Parents:
9f84ad2f3376850c4d78697edb203d32c07d3094
git-author:
Martin Lee <martinlee84@web.de>2012-04-26 10:46:57+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-05-07 14:16:24+02:00
Message:
chg: avoid divisibility tests
chg: use a bound on coeffs in chinrem_gcd
Location:
factory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd.cc

    r9f84ad r4704674  
    12371237
    12381238  CanonicalForm Dn, test= 0;
     1239  cl =  gcd (f.lc(),g.lc());
     1240  CanonicalForm b= 1;
     1241  int minCommonDeg= 0;
     1242  CanonicalForm gcdcfcg= gcd (cf, cg);
     1243  for (i= tmax (f.level(), g.level()); i > 0; i--)
     1244  {
     1245    if (degree (f, i) <= 0 || degree (g, i) <= 0)
     1246      continue;
     1247    else
     1248    {
     1249      minCommonDeg= tmin (degree (g, i), degree (f, i));
     1250      break;
     1251    }
     1252  }
     1253  if (i == 0)
     1254    return gcdcfcg;
     1255  for (; i > 0; i--)
     1256  {
     1257    if (degree (f, i) <= 0 || degree (g, i) <= 0)
     1258      continue;
     1259    else
     1260      minCommonDeg= tmin (minCommonDeg, tmin (degree (g, i), degree (f, i)));
     1261  }
     1262  b= 2*tmin (maxNorm (f), maxNorm (g))*abs (cl)*power (CanonicalForm (2), minCommonDeg);
    12391263  bool equal= false;
    12401264  i = cf_getNumBigPrimes() - 1;
    1241   cl =  gcd (f.lc(),g.lc());
    1242 
    1243   CanonicalForm gcdcfcg= gcd (cf, cg);
     1265
    12441266  //Off (SW_RATIONAL);
    12451267  while ( true )
     
    13071329        equal= true;
    13081330      //Dn /=vcontent(Dn,Variable(1));
    1309       if (equal && fdivides( Dn, f ) && fdivides( Dn, g ) )
     1331      if ((equal || q > b) && fdivides( Dn, f ) && fdivides( Dn, g ) )
    13101332      {
    13111333        //printf(" -> success\n");
  • factory/cf_gcd_smallp.cc

    r9f84ad r4704674  
    560560  CanonicalForm prim_elem, im_prim_elem;
    561561  CFList source, dest;
     562  int bound= tmin (degree (ppA, 1), degree (ppB, 1));
     563  int count= 0;
    562564  do
    563565  {
     
    665667      G_m= 0;
    666668      d= d0;
     669      count= 0;
    667670    }
    668671
     
    672675                          "time for newton interpolation: ");
    673676
     677    count++;
    674678    //termination test
    675679    if (uni_lcoeff (H) == gcdlcAlcB)
     
    682686        //maybe it's better to test if ppH is an element of F(\alpha) before
    683687        //mapping down
    684         if (fdivides (ppH, ppA) && fdivides (ppH, ppB))
     688        DEBOUTLN (cerr, "ppH before mapDown= " << ppH);
     689        ppH= mapDown (ppH, prim_elem, im_prim_elem, alpha, u, v);
     690        ppH /= Lc(ppH);
     691        DEBOUTLN (cerr, "ppH after mapDown= " << ppH);
     692        if ((count == bound) || (fdivides (ppH, ppA) && fdivides (ppH, ppB)))
    685693        {
    686694          DEBOUTLN (cerr, "ppH before mapDown= " << ppH);
     
    693701        }
    694702      }
    695       else if (fdivides (ppH, ppA) && fdivides (ppH, ppB))
     703      else if ((count == bound) || (fdivides (ppH, ppA) && fdivides (ppH, ppB)))
    696704      {
    697705        if (compressConvexDense)
     
    882890  int expon;
    883891  char gf_name_buf= gf_name;
     892  int bound= tmin (degree (ppA, 1), degree (ppB, 1));
     893  int count= 0;
    884894  do
    885895  {
     
    963973      G_m= 0;
    964974      d= d0;
     975      count= 0;
    965976    }
    966977
     
    969980    TIMING_END_AND_PRINT (newton_interpolation, "time for newton interpolation: ");
    970981
     982    count++;
    971983    //termination test
    972984    if (uni_lcoeff (H) == gcdlcAlcB)
     
    976988      if (inextension)
    977989      {
    978         if (fdivides(ppH, ppA) && fdivides(ppH, ppB))
     990        if ((count == bound) || (fdivides(ppH, ppA) && fdivides(ppH, ppB)))
    979991        {
    980992          DEBOUTLN (cerr, "ppH before mapDown= " << ppH);
     
    11861198  topLevel= false;
    11871199  CFList source, dest;
     1200  int bound= tmin (degree (ppA, 1), degree (ppB, 1));
     1201  int count= 0;
    11881202  do
    11891203  {
     
    13321346      G_m= 0;
    13331347      d= d0;
     1348      count= 0;
    13341349    }
    13351350
     
    13391354                          "time for newton_interpolation: ");
    13401355
     1356    count++;
    13411357    //termination test
    13421358    if (uni_lcoeff (H) == gcdlcAlcB)
     
    13461362      ppH /= Lc (ppH);
    13471363      DEBOUTLN (cerr, "ppH= " << ppH);
    1348       if (fdivides (ppH, ppA) && fdivides (ppH, ppB))
     1364      if ((count == bound) || (fdivides (ppH, ppA) && fdivides (ppH, ppB)))
    13491365      {
    13501366        if (compressConvexDense)
Note: See TracChangeset for help on using the changeset viewer.