Changeset b7cc2b in git
- Timestamp:
- Jun 27, 2020, 5:46:56 PM (3 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 3c175a38073991b37dd623f38ad1ef4cfe9eaf3f
- Parents:
- 9084a3bd47a1b5b8a96897a02c274a361e4e2c9c
- Location:
- factory
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cfEzgcd.cc
r9084a3 rb7cc2b 865 865 /// Extended Zassenhaus GCD for finite fields. 866 866 /// In case things become too dense we switch to a modular algorithm. 867 #ifdef HAVE_NTL // primitiveElement, FindRoot867 #ifdef HAVE_NTL // Hensel 868 868 CanonicalForm EZGCD_P( const CanonicalForm & FF, const CanonicalForm & GG ) 869 869 { … … 1502 1502 return N (d*cand); 1503 1503 } 1504 #endif /*HAVE_NTL*/1505 1504 #endif 1505 #endif -
factory/cfGcdUtil.cc
r9084a3 rb7cc2b 22 22 /// result is false, d is set to the degree of the gcd of f and g evaluated at a 23 23 /// random point in K^n-1. This gcd is a gcd of univariate polynomials. 24 #ifdef HAVE_NTL // primitiveElement, FindRoot24 #ifdef HAVE_NTL // mapPrimElem 25 25 bool 26 26 gcd_test_one ( const CanonicalForm & f, const CanonicalForm & g, bool swap, int & d ) -
factory/cfModGcd.cc
r9084a3 rb7cc2b 476 476 /// based on Alg. 7.2. as described in "Algorithms for 477 477 /// Computer Algebra" by Geddes, Czapor, Labahn 478 #ifdef HAVE_NTL // primitiveElement, FindRoot478 #ifdef HAVE_NTL // mapPrimElem 479 479 CanonicalForm 480 480 modGCDFq (const CanonicalForm& F, const CanonicalForm& G, … … 1203 1203 } 1204 1204 1205 #ifdef HAVE_NTL // primitiveElement, FindRoot1205 #ifdef HAVE_NTL 1206 1206 CanonicalForm 1207 1207 modGCDFp (const CanonicalForm& F, const CanonicalForm& G, … … 1210 1210 #endif 1211 1211 1212 #ifdef HAVE_NTL // primitiveElement, FindRoot1212 #ifdef HAVE_NTL 1213 1213 CanonicalForm 1214 1214 modGCDFp (const CanonicalForm& F, const CanonicalForm& G, … … 1221 1221 #endif 1222 1222 1223 #ifdef HAVE_NTL // primitiveElement, FindRoot1223 #ifdef HAVE_NTL // mapPrimElem 1224 1224 CanonicalForm 1225 1225 modGCDFp (const CanonicalForm& F, const CanonicalForm& G, … … 2161 2161 } 2162 2162 2163 #ifdef HAVE_NTL // primitiveElement,FindRoot2164 2163 CanonicalForm 2165 2164 monicSparseInterpol (const CanonicalForm& F, const CanonicalForm& G, … … 2445 2444 } 2446 2445 } 2447 #endif 2448 2449 #ifdef HAVE_NTL // primitiveElement, FindRoot 2446 2450 2447 CanonicalForm 2451 2448 nonMonicSparseInterpol (const CanonicalForm& F, const CanonicalForm& G, … … 3095 3092 } 3096 3093 } 3097 #endif 3098 3099 #ifdef HAVE_NTL // primitiveElement,FindRoot 3094 3100 3095 CanonicalForm sparseGCDFq (const CanonicalForm& F, const CanonicalForm& G, 3101 3096 const Variable & alpha, CFList& l, bool& topLevel) … … 3529 3524 } while (1); 3530 3525 } 3531 #endif 3532 3533 #ifdef HAVE_NTL // primitiveElement,FindRoot 3526 3534 3527 CanonicalForm sparseGCDFp (const CanonicalForm& F, const CanonicalForm& G, 3535 3528 bool& topLevel, CFList& l) … … 4039 4032 } while (1); //end of first do 4040 4033 } 4041 #endif4042 4034 4043 4035 TIMING_DEFINE_PRINT(modZ_termination) -
factory/cfModResultant.cc
r9084a3 rb7cc2b 345 345 } 346 346 347 #ifdef HAVE_NTL // primitiveElement347 #ifdef HAVE_NTL // mapPrimElem 348 348 CanonicalForm 349 349 resultantFp (const CanonicalForm& A, const CanonicalForm& B, const Variable& x, … … 557 557 return result; 558 558 } 559 560 #ifdef HAVE_NTL // resultantFp 559 #ifdef HAVE_NTL // mapPrimitiveElem 561 560 CanonicalForm 562 561 resultantZ (const CanonicalForm& A, const CanonicalForm& B, const Variable& x, -
factory/cf_cyclo.cc
r9084a3 rb7cc2b 133 133 } 134 134 135 #ifdef HAVE_NTL136 135 bool isPrimitive (const Variable& alpha, bool& fail) 137 136 { … … 147 146 return false; 148 147 } 149 150 #endif -
factory/cf_gcd.cc
r9084a3 rb7cc2b 127 127 fc=modGCDFp (fc, gc); 128 128 } 129 else130 #endif129 #endif 130 else 131 131 fc = subResGCD_p( fc, gc ); 132 132 } -
factory/cf_map_ext.cc
r9084a3 rb7cc2b 29 29 #endif 30 30 31 #ifdef HAVE_FLINT 32 #include "FLINTconvert.h" 33 #endif 34 31 35 // cyclotomoic polys: 32 36 #include "cf_cyclo.h" … … 61 65 } 62 66 63 #ifdef HAVE_NTL64 67 /// \f$ F_{p} (\alpha ) \subset F_{p}(\beta ) \f$ and \f$ \alpha \f$ is a 65 68 /// primitive element, returns the image of \f$ \alpha \f$ … … 68 71 { 69 72 int p= getCharacteristic (); 73 #ifdef HAVE_FLINT 74 // convert mipo1 75 nmod_poly_t mipo1; 76 convertFacCF2nmod_poly_t(mipo1,getMipo(beta)); 77 fq_nmod_ctx_t ctx; 78 fq_nmod_ctx_init_modulus(ctx,mipo1,"t"); 79 nmod_poly_clear(mipo1); 80 // convert mipo2 (alpah) 81 fq_nmod_poly_t mipo2; 82 convertFacCF2Fq_nmod_poly_t(mipo2,getMipo(alpha),ctx); 83 fq_nmod_poly_factor_t fac; 84 fq_nmod_poly_factor_init(fac,ctx); 85 fq_nmod_poly_roots(fac, mipo2, 0, ctx); 86 // root of first factor: 87 fq_nmod_t r0; 88 fq_nmod_init(r0, ctx); 89 fq_nmod_poly_get_coeff(r0,fac->poly,0,ctx); 90 // convert 91 CanonicalForm r1=convertFq_nmod_t2FacCF(r0,beta); 92 // cleanup 93 fq_nmod_poly_factor_clear(fac,ctx); 94 fq_nmod_clear(r0, ctx); 95 fq_nmod_poly_clear(mipo2,ctx); 96 fq_nmod_ctx_clear(ctx); 97 return r1; 98 #elif defined(HAVE_NTL) 70 99 if (fac_NTL_char != p) 71 100 { … … 78 107 zz_pE root= FindRoot (NTL_alpha_mipo); 79 108 return convertNTLzzpE2CF (root, beta); 80 } 81 82 #endif 109 #endif 110 } 111 83 112 84 113 /// the CanonicalForm G is the output of map_up, returns F considered as an … … 306 335 } 307 336 308 #ifdef HAVE_NTL // FindRoot309 337 CanonicalForm 310 338 primitiveElement (const Variable& alpha, Variable& beta, bool& fail) … … 323 351 int d= degree (mipo); 324 352 int p= getCharacteristic (); 325 //#if !defined(HAVE_FLINT) && defined(AHVE_NTL)353 #if !defined(HAVE_FLINT) && defined(HAVE_NTL) 326 354 if (fac_NTL_char != p) 327 355 { … … 330 358 } 331 359 zz_pX NTL_mipo; 332 //#endif360 #endif 333 361 CanonicalForm mipo2; 334 362 primitive= false; … … 337 365 do 338 366 { 339 //#ifdef HAVE_FLINT340 //nmod_poly_t Irredpoly;341 //nmod_poly_init(Irredpoly,p);342 //nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, d+1);343 //mipo2=convertnmod_poly_t2FacCF(Irredpoly,Variable(1));344 //nmod_poly_clear(Irredpoly);345 //#elif defined(HAVE_NTL)367 #ifdef HAVE_FLINT 368 nmod_poly_t Irredpoly; 369 nmod_poly_init(Irredpoly,p); 370 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, d+1); 371 mipo2=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 372 nmod_poly_clear(Irredpoly); 373 #elif defined(HAVE_NTL) 346 374 BuildIrred (NTL_mipo, d); 347 375 mipo2= convertNTLzzpX2CF (NTL_mipo, Variable (1)); 348 //#endif376 #endif 349 377 if (!initialized) 350 378 beta= rootOf (mipo2); … … 357 385 return 0; 358 386 } while (1); 387 #ifdef HAVE_FLINT 388 // convert alpha_mipo 389 nmod_poly_t alpha_mipo; 390 convertFacCF2nmod_poly_t(alpha_mipo,mipo); 391 fq_nmod_ctx_t ctx; 392 fq_nmod_ctx_init_modulus(ctx,alpha_mipo,"t"); 393 nmod_poly_clear(alpha_mipo); 394 // convert beta_mipo (mipo2) 395 fq_nmod_poly_t FLINT_beta_mipo; 396 convertFacCF2Fq_nmod_poly_t(FLINT_beta_mipo,mipo2,ctx); 397 fq_nmod_poly_factor_t fac; 398 fq_nmod_poly_factor_init(fac,ctx); 399 fq_nmod_poly_roots(fac, FLINT_beta_mipo, 0, ctx); 400 // root of first factor: 401 fq_nmod_t r0; 402 fq_nmod_init(r0, ctx); 403 fq_nmod_poly_get_coeff(r0,fac->poly,0,ctx); 404 // convert 405 CanonicalForm r1=convertFq_nmod_t2FacCF(r0,alpha); 406 // cleanup 407 fq_nmod_poly_factor_clear(fac,ctx); 408 fq_nmod_clear(r0, ctx); 409 fq_nmod_poly_clear(FLINT_beta_mipo,ctx); 410 fq_nmod_ctx_clear(ctx); 411 return r1; 412 #elif defined(NTL) 359 413 zz_pX alpha_mipo= convertFacCF2NTLzzpX (mipo); 360 414 zz_pE::init (alpha_mipo); … … 362 416 zz_pE root= FindRoot (NTL_beta_mipo); 363 417 return convertNTLzzpE2CF (root, alpha); 364 } 365 #endif 418 #endif 419 } 366 420 367 421 CanonicalForm … … 383 437 } 384 438 385 #ifdef HAVE_NTL 439 #ifdef HAVE_NTL // findMinPoly 386 440 CanonicalForm 387 441 mapPrimElem (const CanonicalForm& primElem, const Variable& alpha, … … 394 448 CanonicalForm primElemMipo= findMinPoly (primElem, alpha); 395 449 int p= getCharacteristic (); 450 #ifdef HAVE_FLINT 451 // convert mipo1 452 nmod_poly_t mipo1; 453 convertFacCF2nmod_poly_t(mipo1,getMipo(beta)); 454 fq_nmod_ctx_t ctx; 455 fq_nmod_ctx_init_modulus(ctx,mipo1,"t"); 456 nmod_poly_clear(mipo1); 457 // convert mipo2 (primElemMipo) 458 fq_nmod_poly_t mipo2; 459 convertFacCF2Fq_nmod_poly_t(mipo2,primElemMipo,ctx); 460 fq_nmod_poly_factor_t fac; 461 fq_nmod_poly_factor_init(fac,ctx); 462 fq_nmod_poly_roots(fac, mipo2, 0, ctx); 463 // root of first factor: 464 fq_nmod_t r0; 465 fq_nmod_init(r0, ctx); 466 fq_nmod_poly_get_coeff(r0,fac->poly,0,ctx); 467 // convert 468 CanonicalForm r1=convertFq_nmod_t2FacCF(r0,alpha); 469 // cleanup 470 fq_nmod_poly_factor_clear(fac,ctx); 471 fq_nmod_clear(r0, ctx); 472 fq_nmod_poly_clear(mipo2,ctx); 473 fq_nmod_ctx_clear(ctx); 474 return r1; 475 #elif defined(HAVE_NTL) 396 476 if (fac_NTL_char != p) 397 477 { … … 404 484 zz_pE root= FindRoot (NTLPrimElemMipo); 405 485 return convertNTLzzpE2CF (root, beta); 406 } 407 } 408 486 #endif 487 } 488 } 489 #endif 490 491 #ifdef HAVE_NTL 409 492 CanonicalForm 410 493 map (const CanonicalForm& primElem, const Variable& alpha, -
factory/facAbsBiFact.cc
r9084a3 rb7cc2b 32 32 33 33 #ifdef HAVE_NTL 34 35 34 TIMING_DEFINE_PRINT(fac_Qa_factorize) 36 35 TIMING_DEFINE_PRINT(fac_evalpoint) … … 780 779 return result; 781 780 } 782 783 781 #endif 784 785 -
factory/facAbsFact.cc
r9084a3 rb7cc2b 36 36 #endif 37 37 38 #if def HAVE_NTL38 #if defined(HAVE_NTL) 39 39 TIMING_DEFINE_PRINT(abs_fac_bi_factorizer) 40 40 TIMING_DEFINE_PRINT(abs_fac_hensel_lift) -
factory/facAbsFact.h
r9084a3 rb7cc2b 16 16 #include "facAbsBiFact.h" 17 17 18 #if def HAVE_NTL18 #if defined(HAVE_NTL) 19 19 /// main absolute factorization routine, expects poly which is 20 20 /// irreducible over Q … … 32 32 33 33 /*BEGINPUBLIC*/ 34 #if def HAVE_NTL34 #if defined(HAVE_NTL) 35 35 /// absolute factorization of a multivariate poly over Q 36 36 ///
Note: See TracChangeset
for help on using the changeset viewer.