Changeset 56d3c6 in git
- Timestamp:
- Aug 18, 2011, 3:49:51 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 12483db42b3ad1ac5499765c4350a6a67250d9c7
- Parents:
- e39eb55793d9d07bba08d482817c1e843a5523df
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_gcd.cc
re39eb55 r56d3c6 683 683 bool gc_isUnivariate=g.isUnivariate(); 684 684 bool fc_and_gc_Univariate=fc_isUnivariate && gc_isUnivariate; 685 #if 1686 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 #endif698 685 cf_prepgcd( f, g, cc, p1, pe); 699 686 if ( cc != 0 ) … … 714 701 fc = f; 715 702 gc = g; 716 if( gcd_avoid_mtaildegree ( fc, gc, d1 ) )717 return d1;718 703 if ( getCharacteristic() != 0 ) 719 704 { … … 727 712 else if ((!fc_and_gc_Univariate) && (isOn( SW_USE_EZGCD_P ))) 728 713 { 729 /*if ( pe == 1 )730 fc = fin_ezgcd( fc, gc );731 else if ( pe > 0 )// no variable at position 1732 {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 else738 {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 }*/744 714 fc= EZGCD_P (fc, gc); 745 715 } … … 774 744 if ( 775 745 isOn(SW_USE_CHINREM_GCD) 776 && (gc.level() >5)777 && (fc.level() >5)778 746 && (isPurePoly_m(fc)) && (isPurePoly_m(gc)) 779 747 ) … … 810 778 } 811 779 } 812 else if (813 isOn(SW_USE_CHINREM_GCD)814 && (isPurePoly_m(fc)) && (isPurePoly_m(gc))815 )816 {817 #if 0818 if ( p1 == fc.level() )819 fc = chinrem_gcd( fc, gc );820 else821 {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 #else827 fc = chinrem_gcd( fc, gc);828 #endif829 }830 780 else 831 781 { … … 1021 971 else 1022 972 { 973 //printf ("here\n"); 1023 974 CanonicalForm cdF = bCommonDen( f ); 1024 975 CanonicalForm cdG = bCommonDen( g ); … … 1288 1239 CanonicalForm chinrem_gcd ( const CanonicalForm & FF, const CanonicalForm & GG ) 1289 1240 { 1241 bool saveRat= isOn (SW_RATIONAL); 1242 if (!saveRat) 1243 On (SW_RATIONAL); 1290 1244 CanonicalForm f, g, cg, cl, q(0), Dp, newD, D, newq; 1291 1245 int p, i, dp_deg, d_deg=-1; … … 1306 1260 cl = f.lc()* g.lc(); 1307 1261 1262 Off (SW_RATIONAL); 1308 1263 while ( true ) 1309 1264 { … … 1324 1279 { 1325 1280 //printf(" -> 1\n"); 1281 if (saveRat) 1282 On (SW_RATIONAL); 1326 1283 return CanonicalForm(1); 1327 1284 } … … 1356 1313 if ( i >= 0 ) 1357 1314 { 1315 On (SW_RATIONAL); 1358 1316 CanonicalForm Dn= Farey(D,q); 1359 int is_rat=isOn(SW_RATIONAL);1360 On(SW_RATIONAL);1361 1317 CanonicalForm cd = bCommonDen( Dn ); // we need On(SW_RATIONAL) 1362 if (!is_rat) Off(SW_RATIONAL);1363 1318 Dn *=cd; 1364 1319 //Dn /=vcontent(Dn,Variable(1)); 1365 1320 if ( fdivides( Dn, f ) && fdivides( Dn, g ) ) 1366 1321 { 1322 if (!saveRat) 1323 Off (SW_RATIONAL); 1367 1324 //printf(" -> success\n"); 1368 1325 return Dn; 1369 1326 } 1327 Off (SW_RATIONAL); 1370 1328 //else: try more primes 1371 1329 } … … 1373 1331 { // try other method 1374 1332 //printf("try other gcd\n"); 1333 if (saveRat) 1334 On (SW_RATIONAL); 1375 1335 Off(SW_USE_CHINREM_GCD); 1376 1336 D=gcd_poly( f, g );
Note: See TracChangeset
for help on using the changeset viewer.