Changeset 186df6 in git for factory/cf_gcd.cc
- Timestamp:
- Oct 26, 2012, 11:30:17 AM (11 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 18ccf2907a4a103e379cecf364131e83e3aebab55c890683760ed725b5c0bb38871a3459d5f5ff2b
- Parents:
- 1130ffcea9f0651b2cb15d5f7ea1758fc8cf75aa7061c1e376e43786ea799c82620a0bbed1dc5dd3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_gcd.cc
r1130ffc r186df6 26 26 #include "NTLconvert.h" 27 27 bool isPurePoly(const CanonicalForm & ); 28 #ifndef HAVE_FLINT 28 29 static CanonicalForm gcd_univar_ntl0( const CanonicalForm &, const CanonicalForm & ); 29 30 static CanonicalForm gcd_univar_ntlp( const CanonicalForm &, const CanonicalForm & ); 31 #endif 30 32 #endif 31 33 … … 307 309 } 308 310 #ifdef HAVE_NTL 311 #ifdef HAVE_FLINT 312 if (( getCharacteristic() > 0 ) && (CFFactory::gettype() != GaloisFieldDomain) 313 && (f.level()==g.level()) && isPurePoly(f) && isPurePoly(g)) 314 { 315 nmod_poly_t F1, G1, A, B, R; 316 convertFacCF2nmod_poly_t (F1, f); 317 convertFacCF2nmod_poly_t (G1, g); 318 nmod_poly_init (R, getCharacteristic()); 319 nmod_poly_init (A, getCharacteristic()); 320 nmod_poly_init (B, getCharacteristic()); 321 nmod_poly_xgcd (R, A, B, F1, G1); 322 a= convertnmod_poly_t2FacCF (A, f.mvar()); 323 b= convertnmod_poly_t2FacCF (B, f.mvar()); 324 CanonicalForm r= convertnmod_poly_t2FacCF (R, f.mvar()); 325 nmod_poly_clear (F1); 326 nmod_poly_clear (G1); 327 nmod_poly_clear (A); 328 nmod_poly_clear (B); 329 nmod_poly_clear (R); 330 return r; 331 } 332 #else 309 333 if (isOn(SW_USE_NTL_GCD_P) && ( getCharacteristic() > 0 ) && (CFFactory::gettype() != GaloisFieldDomain) 310 334 && (f.level()==g.level()) && isPurePoly(f) && isPurePoly(g)) … … 347 371 #endif 348 372 } 373 #endif 374 #ifdef HAVE_FLINT 375 if (( getCharacteristic() ==0) && (f.level()==g.level()) 376 && isPurePoly(f) && isPurePoly(g)) 377 { 378 fmpq_poly_t F1, G1; 379 convertFacCF2Fmpq_poly_t (F1, f); 380 convertFacCF2Fmpq_poly_t (G1, g); 381 fmpq_poly_t R, A, B; 382 fmpq_poly_init (R); 383 fmpq_poly_init (A); 384 fmpq_poly_init (B); 385 fmpq_poly_xgcd (R, A, B, F1, G1); 386 a= convertFmpq_poly_t2FacCF (A, f.mvar()); 387 b= convertFmpq_poly_t2FacCF (B, f.mvar()); 388 CanonicalForm r= convertFmpq_poly_t2FacCF (R, f.mvar()); 389 fmpq_poly_clear (F1); 390 fmpq_poly_clear (G1); 391 fmpq_poly_clear (A); 392 fmpq_poly_clear (B); 393 fmpq_poly_clear (R); 394 return r; 395 } 396 #else 349 397 if (isOn(SW_USE_NTL_GCD_0) && ( getCharacteristic() ==0) 350 398 && (f.level()==g.level()) && isPurePoly(f) && isPurePoly(g)) … … 378 426 CanonicalForm rr=convertZZ2CF(RR); 379 427 ASSERT (!rr.isZero(), "NTL:XGCD failed"); 380 r*=rr;381 if ( r.sign() < 0 ) { r= -r; a= -a; b= -b; }428 a /= rr; 429 b /= rr; 382 430 return r; 383 431 } 384 432 } 433 #endif 385 434 #endif 386 435 // may contain bug in the co-factors, see track 107 … … 669 718 if ( pi.isUnivariate() && pi1.isUnivariate() ) 670 719 { 671 /*#ifdef HAVE_FLINT720 #ifdef HAVE_FLINT 672 721 if (isPurePoly(pi) && isPurePoly(pi1) ) 673 722 return gcd_univar_flint0(pi, pi1 ) * C; 674 #else */723 #else 675 724 #ifdef HAVE_NTL 676 725 if ( isOn(SW_USE_NTL_GCD_0) && isPurePoly(pi) && isPurePoly(pi1) ) 677 726 return gcd_univar_ntl0(pi, pi1 ) * C; 678 727 #endif 679 //#endif728 #endif 680 729 return gcd_poly_univar0( pi, pi1, true ) * C; 681 730 } … … 993 1042 994 1043 #ifdef HAVE_NTL 995 1044 #ifndef HAVE_FLINT 996 1045 static CanonicalForm 997 1046 gcd_univar_ntl0( const CanonicalForm & F, const CanonicalForm & G ) … … 1035 1084 #endif 1036 1085 } 1037 1086 #endif 1038 1087 #endif 1039 1088
Note: See TracChangeset
for help on using the changeset viewer.