Changeset 4ec288 in git for factory/cf_gcd.cc
- Timestamp:
- Apr 11, 2012, 3:11:20 PM (12 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 98adcdd62df51a4c6090574f59ad2b9a5d432d39
- Parents:
- 4bafa67969ab030397c6410e512aadf5574be0dc0a7d0ca68a61f160eb5b83774592a019ed99f025
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_gcd.cc
r4bafa67 r4ec288 29 29 static CanonicalForm gcd_univar_ntl0( const CanonicalForm &, const CanonicalForm & ); 30 30 static CanonicalForm gcd_univar_ntlp( const CanonicalForm &, const CanonicalForm & ); 31 #endif 32 33 #ifdef HAVE_FLINT 34 #include "FLINTconvert.h" 35 static CanonicalForm gcd_univar_flint0 (const CanonicalForm &, const CanonicalForm &); 36 static CanonicalForm gcd_univar_flintp (const CanonicalForm &, const CanonicalForm &); 31 37 #endif 32 38 … … 290 296 extgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a, CanonicalForm & b ) 291 297 { 298 if (f.isZero()) 299 { 300 a= 0; 301 b= 1; 302 return g; 303 } 304 else if (g.isZero()) 305 { 306 a= 1; 307 b= 0; 308 return f; 309 } 292 310 #ifdef HAVE_NTL 293 311 if (isOn(SW_USE_NTL_GCD_P) && ( getCharacteristic() > 0 ) && (CFFactory::gettype() != GaloisFieldDomain) … … 545 563 { 546 564 bpure = isPurePoly(pi) && isPurePoly(pi1); 565 #ifdef HAVE_FLINT 566 if (bpure && (CFFactory::gettype() != GaloisFieldDomain)) 567 return gcd_univar_flintp(pi,pi1)*C; 568 #else 547 569 #ifdef HAVE_NTL 548 570 if ( isOn(SW_USE_NTL_GCD_P) && bpure && (CFFactory::gettype() != GaloisFieldDomain)) 549 571 return gcd_univar_ntlp(pi, pi1 ) * C; 572 #endif 550 573 #endif 551 574 } … … 618 641 if ( pi.isUnivariate() && pi1.isUnivariate() ) 619 642 { 643 /*#ifdef HAVE_FLINT 644 if (isPurePoly(pi) && isPurePoly(pi1) ) 645 return gcd_univar_flint0(pi, pi1 ) * C; 646 #else*/ 620 647 #ifdef HAVE_NTL 621 648 if ( isOn(SW_USE_NTL_GCD_0) && isPurePoly(pi) && isPurePoly(pi1) ) 622 649 return gcd_univar_ntl0(pi, pi1 ) * C; 623 650 #endif 651 //#endif 624 652 return gcd_poly_univar0( pi, pi1, true ) * C; 625 653 } … … 1044 1072 #endif 1045 1073 1074 #ifdef HAVE_FLINT 1075 static CanonicalForm 1076 gcd_univar_flintp (const CanonicalForm& F, const CanonicalForm& G) 1077 { 1078 nmod_poly_t F1, G1; 1079 convertFacCF2nmod_poly_t (F1, F); 1080 convertFacCF2nmod_poly_t (G1, G); 1081 nmod_poly_gcd (F1, F1, G1); 1082 CanonicalForm result= convertnmod_poly_t2FacCF (F1, F.mvar()); 1083 nmod_poly_clear (F1); 1084 nmod_poly_clear (G1); 1085 return result; 1086 } 1087 1088 static CanonicalForm 1089 gcd_univar_flint0( const CanonicalForm & F, const CanonicalForm & G ) 1090 { 1091 fmpz_poly_t F1, G1; 1092 convertFacCF2Fmpz_poly_t(F1, F); 1093 convertFacCF2Fmpz_poly_t(G1, G); 1094 fmpz_poly_gcd (F1, F1, G1); 1095 CanonicalForm result= convertFmpz_poly_t2FacCF (F1, F.mvar()); 1096 fmpz_poly_clear (F1); 1097 fmpz_poly_clear (G1); 1098 return result; 1099 } 1100 #endif 1101 1102 1046 1103 /* 1047 1104 * compute positions p1 and pe of optimal variables:
Note: See TracChangeset
for help on using the changeset viewer.