Changeset 56d3c6 in git for factory/cf_gcd.cc


Ignore:
Timestamp:
Aug 18, 2011, 3:49:51 PM (13 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
12483db42b3ad1ac5499765c4350a6a67250d9c7
Parents:
e39eb55793d9d07bba08d482817c1e843a5523df
Message:
prefer chinrem_gcd to ezgcd 
removed some unused code
switched off gcd_avoid_mtaildegree
handle SW_RATIONAL in chinrem_gcd


git-svn-id: file:///usr/local/Singular/svn/trunk@14373 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd.cc

    re39eb55 r56d3c6  
    683683  bool gc_isUnivariate=g.isUnivariate();
    684684  bool fc_and_gc_Univariate=fc_isUnivariate && gc_isUnivariate;
    685 #if 1
    686   if (( getCharacteristic() == 0 )
    687   && (f.level() >4)
    688   && (g.level() >4)
    689   && isOn( SW_USE_CHINREM_GCD)
    690   && (!fc_and_gc_Univariate)
    691   && (isPurePoly_m(f))
    692   && (isPurePoly_m(g))
    693   )
    694   {
    695       return chinrem_gcd( f, g );
    696   }
    697 #endif
    698685  cf_prepgcd( f, g, cc, p1, pe);
    699686  if ( cc != 0 )
     
    714701  fc = f;
    715702  gc = g;
    716   if( gcd_avoid_mtaildegree ( fc, gc, d1 ) )
    717       return d1;
    718703  if ( getCharacteristic() != 0 )
    719704  {
     
    727712    else if ((!fc_and_gc_Univariate) && (isOn( SW_USE_EZGCD_P )))
    728713    {
    729       /*if ( pe == 1 )
    730         fc = fin_ezgcd( fc, gc );
    731       else if ( pe > 0 )// no variable at position 1
    732       {
    733         fc = replacevar( fc, Variable(pe), Variable(1) );
    734         gc = replacevar( gc, Variable(pe), Variable(1) );
    735         fc = replacevar( fin_ezgcd( fc, gc ), Variable(1), Variable(pe) );
    736       }
    737       else
    738       {
    739         pe = -pe;
    740         fc = swapvar( fc, Variable(pe), Variable(1) );
    741         gc = swapvar( gc, Variable(pe), Variable(1) );
    742         fc = swapvar( fin_ezgcd( fc, gc ), Variable(1), Variable(pe) );
    743       }*/
    744714      fc= EZGCD_P (fc, gc);
    745715    }
     
    774744    if (
    775745    isOn(SW_USE_CHINREM_GCD)
    776     && (gc.level() >5)
    777     && (fc.level() >5)
    778746    && (isPurePoly_m(fc)) && (isPurePoly_m(gc))
    779747    )
     
    810778      }
    811779    }
    812     else if (
    813     isOn(SW_USE_CHINREM_GCD)
    814     && (isPurePoly_m(fc)) && (isPurePoly_m(gc))
    815     )
    816     {
    817     #if 0
    818       if ( p1 == fc.level() )
    819         fc = chinrem_gcd( fc, gc );
    820       else
    821       {
    822         fc = replacevar( fc, Variable(p1), Variable(mp) );
    823         gc = replacevar( gc, Variable(p1), Variable(mp) );
    824         fc = replacevar( chinrem_gcd( fc, gc ), Variable(mp), Variable(p1) );
    825       }
    826     #else
    827       fc = chinrem_gcd( fc, gc);
    828     #endif
    829     }
    830780    else
    831781    {
     
    1021971            else
    1022972            {
     973                //printf ("here\n");
    1023974                CanonicalForm cdF = bCommonDen( f );
    1024975                CanonicalForm cdG = bCommonDen( g );
     
    12881239CanonicalForm chinrem_gcd ( const CanonicalForm & FF, const CanonicalForm & GG )
    12891240{
     1241  bool saveRat= isOn (SW_RATIONAL);
     1242  if (!saveRat)
     1243    On (SW_RATIONAL);
    12901244  CanonicalForm f, g, cg, cl, q(0), Dp, newD, D, newq;
    12911245  int p, i, dp_deg, d_deg=-1;
     
    13061260  cl =  f.lc()* g.lc();
    13071261
     1262  Off (SW_RATIONAL);
    13081263  while ( true )
    13091264  {
     
    13241279    {
    13251280      //printf(" -> 1\n");
     1281      if (saveRat)
     1282        On (SW_RATIONAL);
    13261283      return CanonicalForm(1);
    13271284    }
     
    13561313    if ( i >= 0 )
    13571314    {
     1315      On (SW_RATIONAL);
    13581316      CanonicalForm Dn= Farey(D,q);
    1359       int is_rat=isOn(SW_RATIONAL);
    1360       On(SW_RATIONAL);
    13611317      CanonicalForm cd = bCommonDen( Dn ); // we need On(SW_RATIONAL)
    1362       if (!is_rat) Off(SW_RATIONAL);
    13631318      Dn *=cd;
    13641319      //Dn /=vcontent(Dn,Variable(1));
    13651320      if ( fdivides( Dn, f ) && fdivides( Dn, g ) )
    13661321      {
     1322        if (!saveRat)
     1323          Off (SW_RATIONAL);
    13671324        //printf(" -> success\n");
    13681325        return Dn;
    13691326      }
     1327      Off (SW_RATIONAL);
    13701328      //else: try more primes
    13711329    }
     
    13731331    { // try other method
    13741332      //printf("try other gcd\n");
     1333      if (saveRat)
     1334        On (SW_RATIONAL);
    13751335      Off(SW_USE_CHINREM_GCD);
    13761336      D=gcd_poly( f, g );
Note: See TracChangeset for help on using the changeset viewer.