Changeset 03c742 in git
- Timestamp:
- Jun 26, 2020, 6:03:59 PM (3 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- f87a54f01779194a0163ca39873f5b4255a4f510
- Parents:
- b666c768103c724ed3617954c684de0e621144d2
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/misc_ip.cc
rb666c7 r03c742 1328 1328 * initialize components of Singular 1329 1329 */ 1330 #ifdef HAVE_FLINT 1331 extern "C" 1332 { 1333 GLOBAL_VAR flint_rand_t FLINTrandom; 1334 } 1335 #endif 1336 1330 1337 void siInit(char *name) 1331 1338 { … … 1390 1397 siRandomStart=t; 1391 1398 feOptSpec[FE_OPT_RANDOM].value = (void*) ((long)siRandomStart); 1399 #ifdef HAVE_FLINT 1400 flint_randinit(FLINTrandom); 1401 #endif 1392 1402 1393 1403 // ressource table: ---------------------------------------------------- -
factory/FLINTconvert.h
rb666c7 r03c742 42 42 #include <flint/fq_nmod_mat.h> 43 43 #endif 44 45 EXTERN_VAR flint_rand_t FLINTrandom; 46 44 47 #ifdef __cplusplus 45 48 } -
factory/cfEzgcd.cc
rb666c7 r03c742 25 25 #include "cfModGcd.h" 26 26 #include "cf_util.h" 27 #include "cf_iter.h" 27 28 #include "cf_map_ext.h" 28 29 #include "cf_algorithm.h" … … 34 35 #include "facHensel.h" 35 36 37 #ifdef HAVE_FLINT 38 #include "FLINTconvert.h" 39 #endif 40 36 41 #ifdef HAVE_NTL 37 42 #include "NTLconvert.h" 43 #endif 38 44 39 45 static const double log2exp= 1.442695041; … … 290 296 } 291 297 298 #ifdef HAVE_NTL // nonMonicHenselLift2 292 299 static inline 293 300 int Hensel (const CanonicalForm & UU, CFArray & G, const Evaluation & AA, … … 370 377 return 1; 371 378 } 379 #endif 372 380 373 381 static … … 477 485 } 478 486 487 #ifdef HAVE_NTL // Hensel 479 488 /// real implementation of EZGCD over Z 480 489 static CanonicalForm … … 838 847 #endif 839 848 849 #ifdef HAVE_NTL // Hensel 840 850 /// Extended Zassenhaus GCD over Z. 841 851 /// In case things become too dense we switch to a modular algorithm. … … 843 853 ezgcd ( const CanonicalForm & FF, const CanonicalForm & GG ) 844 854 { 845 #ifdef HAVE_NTL846 855 REvaluation b; 847 856 return ezgcd( FF, GG, b, false ); 848 #else 849 Off (SW_USE_EZGCD); 850 return gcd (FF, GG); 851 On (SW_USE_EZGCD); 857 } 852 858 #endif 853 } 854 855 #ifdef HAVE_NTL 859 860 #if defined(HAVE_NTL) || defined(HAVE_FLINT) 856 861 // parameters for heuristic 857 862 STATIC_VAR int maxNumEval= 200; … … 860 865 /// Extended Zassenhaus GCD for finite fields. 861 866 /// In case things become too dense we switch to a modular algorithm. 867 #ifdef HAVE_NTL // primitiveElement, FindRoot 862 868 CanonicalForm EZGCD_P( const CanonicalForm & FF, const CanonicalForm & GG ) 863 869 { … … 1008 1014 if (p == 2 && d < 6) 1009 1015 { 1010 if (fac_NTL_char != p)1011 {1012 fac_NTL_char= p;1013 zz_p::init (p);1014 }1015 1016 bool primFail= false; 1016 1017 Variable vBuf; … … 1019 1020 if (d < 3) 1020 1021 { 1022 #ifdef HAVE_FLINT 1023 nmod_poly_t Irredpoly; 1024 nmod_poly_init(Irredpoly,p); 1025 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 3*d+1); 1026 CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 1027 nmod_poly_clear(Irredpoly); 1028 #elif defined(HAVE_NTL) 1029 if (fac_NTL_char != p) 1030 { 1031 fac_NTL_char= p; 1032 zz_p::init (p); 1033 } 1021 1034 zz_pX NTLIrredpoly; 1022 1035 BuildIrred (NTLIrredpoly, d*3); 1023 1036 CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1)); 1037 #endif 1024 1038 v2= rootOf (newMipo); 1025 1039 } 1026 1040 else 1027 1041 { 1042 #ifdef HAVE_FLINT 1043 nmod_poly_t Irredpoly; 1044 nmod_poly_init(Irredpoly,p); 1045 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 2*d+1); 1046 CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 1047 nmod_poly_clear(Irredpoly); 1048 #elif defined(HAVE_NTL) 1049 if (fac_NTL_char != p) 1050 { 1051 fac_NTL_char= p; 1052 zz_p::init (p); 1053 } 1028 1054 zz_pX NTLIrredpoly; 1029 1055 BuildIrred (NTLIrredpoly, d*2); 1030 1056 CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1)); 1057 #endif 1031 1058 v2= rootOf (newMipo); 1032 1059 } … … 1036 1063 else if ((p == 3 && d < 4) || ((p == 5 || p == 7) && d < 3)) 1037 1064 { 1038 if (fac_NTL_char != p)1039 {1040 fac_NTL_char= p;1041 zz_p::init (p);1042 }1043 1065 bool primFail= false; 1044 1066 Variable vBuf; 1045 1067 primElem= primitiveElement (a, vBuf, primFail); 1046 1068 ASSERT (!primFail, "failure in integer factorizer"); 1069 #ifdef HAVE_FLINT 1070 nmod_poly_t Irredpoly; 1071 nmod_poly_init(Irredpoly,p); 1072 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 2*d+1); 1073 CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 1074 nmod_poly_clear(Irredpoly); 1075 #elif defined(HAVE_NTL) 1076 if (fac_NTL_char != p) 1077 { 1078 fac_NTL_char= p; 1079 zz_p::init (p); 1080 } 1047 1081 zz_pX NTLIrredpoly; 1048 1082 BuildIrred (NTLIrredpoly, d*2); 1049 1083 CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1)); 1084 #endif 1050 1085 v2= rootOf (newMipo); 1051 1086 imPrimElem= mapPrimElem (primElem, a, v2); … … 1467 1502 return N (d*cand); 1468 1503 } 1504 #endif /*HAVE_NTL*/ 1469 1505 #endif 1470 -
factory/cfGcdUtil.cc
rb666c7 r03c742 14 14 #endif 15 15 16 #ifdef HAVE_FLINT 17 #include "FLINTconvert.h" 18 #endif 19 16 20 /// Coprimality Check. f and g are assumed to have the same level. If swap is 17 21 /// true, the main variables of f and g are swapped with Variable(1). If the 18 22 /// result is false, d is set to the degree of the gcd of f and g evaluated at a 19 23 /// random point in K^n-1. This gcd is a gcd of univariate polynomials. 24 #ifdef HAVE_NTL // primitiveElement, FindRoot 20 25 bool 21 26 gcd_test_one ( const CanonicalForm & f, const CanonicalForm & g, bool swap, int & d ) … … 83 88 else if (p > 0 && p < TEST_ONE_MAX && algExtension) 84 89 { 85 #if def HAVE_NTL90 #if defined(HAVE_NTL) || defined(HAVE_FLINT) 86 91 int d= degree (getMipo (v)); 87 92 CFList source, dest; … … 90 95 if (p == 2 && d < 6) 91 96 { 92 if (fac_NTL_char != 2)93 {94 fac_NTL_char= 2;95 zz_p::init (p);96 }97 97 bool primFail= false; 98 98 Variable vBuf; … … 101 101 if (d < 3) 102 102 { 103 #ifdef HAVE_FLINT 104 nmod_poly_t Irredpoly; 105 nmod_poly_init(Irredpoly,p); 106 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 3*d+1); 107 CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 108 nmod_poly_clear(Irredpoly); 109 #elif defined(HAVE_NTL) 110 if (fac_NTL_char != 2) 111 { 112 fac_NTL_char= 2; 113 zz_p::init (p); 114 } 103 115 zz_pX NTLIrredpoly; 104 116 BuildIrred (NTLIrredpoly, d*3); 105 117 CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1)); 118 #endif 106 119 v2= rootOf (newMipo); 107 120 } 108 121 else 109 122 { 123 #ifdef HAVE_FLINT 124 nmod_poly_t Irredpoly; 125 nmod_poly_init(Irredpoly,p); 126 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 3*d+1); 127 CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 128 nmod_poly_clear(Irredpoly); 129 #elif defined(HAVE_NTL) 130 if (fac_NTL_char != 2) 131 { 132 fac_NTL_char= 2; 133 zz_p::init (p); 134 } 110 135 zz_pX NTLIrredpoly; 111 136 BuildIrred (NTLIrredpoly, d*2); 112 137 CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1)); 138 #endif 113 139 v2= rootOf (newMipo); 114 140 } … … 118 144 else if ((p == 3 && d < 4) || ((p == 5 || p == 7) && d < 3)) 119 145 { 146 bool primFail= false; 147 Variable vBuf; 148 primElem= primitiveElement (v, vBuf, primFail); 149 ASSERT (!primFail, "failure in integer factorizer"); 150 #ifdef HAVE_FLINT 151 nmod_poly_t Irredpoly; 152 nmod_poly_init(Irredpoly,p); 153 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, 2*d+1); 154 CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 155 nmod_poly_clear(Irredpoly); 156 #elif defined(HAVE_NTL) 120 157 if (fac_NTL_char != p) 121 158 { … … 123 160 zz_p::init (p); 124 161 } 125 bool primFail= false;126 Variable vBuf;127 primElem= primitiveElement (v, vBuf, primFail);128 ASSERT (!primFail, "failure in integer factorizer");129 162 zz_pX NTLIrredpoly; 130 163 BuildIrred (NTLIrredpoly, d*2); 131 164 CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1)); 165 #endif 132 166 v2= rootOf (newMipo); 133 167 imPrimElem= mapPrimElem (primElem, v, v2); … … 219 253 return result; 220 254 } 255 #endif 221 256 222 257 /** -
factory/cfModGcd.cc
rb666c7 r03c742 85 85 } 86 86 87 #if def HAVE_NTL87 #if defined(HAVE_NTL)|| defined(HAVE_FLINT) 88 88 89 89 static const double log2exp= 1.442695041; … … 422 422 Variable chooseExtension (const Variable & alpha) 423 423 { 424 if (fac_NTL_char != getCharacteristic())425 {426 fac_NTL_char= getCharacteristic();427 zz_p::init (getCharacteristic());428 }429 zz_pX NTLIrredpoly;430 424 int i, m; 431 425 // extension of F_p needed … … 440 434 m= degree (getMipo (alpha)); 441 435 } 436 #ifdef HAVE_FLINT 437 nmod_poly_t Irredpoly; 438 nmod_poly_init(Irredpoly,getCharacteristic()); 439 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, i*m+1); 440 CanonicalForm newMipo=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 441 nmod_poly_clear(Irredpoly); 442 #else 443 if (fac_NTL_char != getCharacteristic()) 444 { 445 fac_NTL_char= getCharacteristic(); 446 zz_p::init (getCharacteristic()); 447 } 448 zz_pX NTLIrredpoly; 442 449 BuildIrred (NTLIrredpoly, i*m); 443 450 CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1)); 451 #endif 444 452 return rootOf (newMipo); 445 453 } 446 454 455 #ifdef HAVE_NTL 447 456 CanonicalForm 448 457 modGCDFq (const CanonicalForm& F, const CanonicalForm& G, 449 458 CanonicalForm& coF, CanonicalForm& coG, 450 459 Variable & alpha, CFList& l, bool& topLevel); 451 460 #endif 461 462 #ifdef HAVE_NTL // modGCDFq 452 463 CanonicalForm 453 464 modGCDFq (const CanonicalForm& F, const CanonicalForm& G, … … 459 470 return result; 460 471 } 472 #endif 461 473 462 474 /// GCD of F and G over \f$ F_{p}(\alpha ) \f$ , … … 464 476 /// based on Alg. 7.2. as described in "Algorithms for 465 477 /// Computer Algebra" by Geddes, Czapor, Labahn 478 #ifdef HAVE_NTL // primitiveElement, FindRoot 466 479 CanonicalForm 467 480 modGCDFq (const CanonicalForm& F, const CanonicalForm& G, … … 799 812 } while (1); 800 813 } 814 #endif 801 815 802 816 /// compute a random element a of GF, s.t. F(a) \f$ \neq 0 \f$ , F is a … … 1189 1203 } 1190 1204 1205 #ifdef HAVE_NTL // primitiveElement, FindRoot 1191 1206 CanonicalForm 1192 1207 modGCDFp (const CanonicalForm& F, const CanonicalForm& G, 1193 1208 CanonicalForm& coF, CanonicalForm& coG, 1194 1209 bool& topLevel, CFList& l); 1195 1210 #endif 1211 1212 #ifdef HAVE_NTL // primitiveElement, FindRoot 1196 1213 CanonicalForm 1197 1214 modGCDFp (const CanonicalForm& F, const CanonicalForm& G, … … 1202 1219 return result; 1203 1220 } 1204 1221 #endif 1222 1223 #ifdef HAVE_NTL // primitiveElement, FindRoot 1205 1224 CanonicalForm 1206 1225 modGCDFp (const CanonicalForm& F, const CanonicalForm& G, … … 1557 1576 } while (1); 1558 1577 } 1578 #endif 1559 1579 1560 1580 CFArray … … 1763 1783 } 1764 1784 1785 #ifdef HAVE_NTL //gauss, zz_pE 1765 1786 long 1766 1787 gaussianElimFq (CFMatrix& M, CFArray& L, const Variable& alpha) … … 1801 1822 return rk; 1802 1823 } 1824 #endif 1803 1825 1804 1826 CFArray … … 1854 1876 } 1855 1877 1878 #ifdef HAVE_NTL //gauss, zz_pE 1856 1879 CFArray 1857 1880 solveSystemFq (const CFMatrix& M, const CFArray& L, const Variable& alpha) … … 1893 1916 return A; 1894 1917 } 1918 #endif 1895 1919 #endif 1896 1920 … … 2137 2161 } 2138 2162 2163 #ifdef HAVE_NTL // primitiveElement,FindRoot 2139 2164 CanonicalForm 2140 2165 monicSparseInterpol (const CanonicalForm& F, const CanonicalForm& G, … … 2420 2445 } 2421 2446 } 2422 2447 #endif 2448 2449 #ifdef HAVE_NTL // primitiveElement, FindRoot 2423 2450 CanonicalForm 2424 2451 nonMonicSparseInterpol (const CanonicalForm& F, const CanonicalForm& G, … … 3068 3095 } 3069 3096 } 3070 3097 #endif 3098 3099 #ifdef HAVE_NTL // primitiveElement,FindRoot 3071 3100 CanonicalForm sparseGCDFq (const CanonicalForm& F, const CanonicalForm& G, 3072 3101 const Variable & alpha, CFList& l, bool& topLevel) … … 3500 3529 } while (1); 3501 3530 } 3502 3531 #endif 3532 3533 #ifdef HAVE_NTL // primitiveElement,FindRoot 3503 3534 CanonicalForm sparseGCDFp (const CanonicalForm& F, const CanonicalForm& G, 3504 3535 bool& topLevel, CFList& l) … … 4008 4039 } while (1); //end of first do 4009 4040 } 4041 #endif 4010 4042 4011 4043 TIMING_DEFINE_PRINT(modZ_termination) -
factory/cfModResultant.cc
rb666c7 r03c742 38 38 #endif 39 39 40 #if def HAVE_NTL40 #if defined(HAVE_NTL) || defined(HAVE_FLINT) 41 41 TIMING_DEFINE_PRINT(fac_resultant_p) 42 42 … … 255 255 CanonicalForm uniResultant (const CanonicalForm& F, const CanonicalForm& G) 256 256 { 257 #ifdef HAVE_NTL258 257 ASSERT (getCharacteristic() > 0, "characteristic > 0 expected"); 259 258 if (F.inCoeffDomain() && G.inCoeffDomain()) … … 274 273 return CanonicalForm ((long) FLINTresult); 275 274 } 276 #else 275 return resultant (F, G, F.mvar()); 276 #elif defined(HAVE_NTL) 277 277 if (!hasFirstAlgVar (F, alpha) && !hasFirstAlgVar (G,alpha)) 278 278 { … … 289 289 return CanonicalForm (to_long (rep (NTLResult))); 290 290 } 291 #endif292 291 //at this point F or G has an algebraic var. 293 292 if (fac_NTL_char != getCharacteristic()) … … 346 345 } 347 346 347 #ifdef HAVE_NTL // primitiveElement 348 348 CanonicalForm 349 349 resultantFp (const CanonicalForm& A, const CanonicalForm& B, const Variable& x, … … 522 522 return N (H); 523 523 } 524 #endif 524 525 525 526 static inline … … 557 558 } 558 559 560 #ifdef HAVE_NTL // resultantFp 559 561 CanonicalForm 560 562 resultantZ (const CanonicalForm& A, const CanonicalForm& B, const Variable& x, … … 685 687 } 686 688 #endif 687 689 #endif 690 -
factory/cfSubResGcd.cc
rb666c7 r03c742 51 51 C = gcd( Ci, Ci1 ); 52 52 int d= 0; 53 #ifdef HAVE_NTL // gcd_test_one, primitiveElement 53 54 if ( !( pi.isUnivariate() && pi1.isUnivariate() ) ) 54 55 { … … 62 63 } 63 64 else 65 #endif 64 66 { 65 67 bpure = isPurePoly(pi) && isPurePoly(pi1); … … 196 198 #endif 197 199 } 200 #ifdef HAVE__NTL // gcd_test_one, primitievElement 198 201 else if ( gcd_test_one( pi1, pi, true, d ) ) 199 202 return C; 203 #else 204 else if (gcd(pi1,pi)==1) 205 return C; 206 #endif 200 207 Variable v = f.mvar(); 201 208 Hi = power( LC( pi1, v ), delta ); -
factory/cf_gcd.cc
rb666c7 r03c742 141 141 else 142 142 #endif 143 #ifdef HAVE_NTL 143 144 if ( isOn( SW_USE_EZGCD ) ) 144 145 fc= ezgcd (fc, gc); 146 #endif 145 147 #ifdef HAVE_NTL 146 148 else if (isOn(SW_USE_CHINREM_GCD)) 147 149 fc = modGCDZ( fc, gc); 148 #endif149 else150 else 151 #endif 150 152 { 151 153 fc = subResGCD_0( fc, gc ); -
factory/cf_irred.cc
rb666c7 r03c742 14 14 #ifdef HAVE_NTL 15 15 #include "NTLconvert.h" 16 #endif 17 18 #ifdef HAVE_FLINT 19 #include "FLINTconvert.h" 16 20 #endif 17 21 … … 36 40 } 37 41 38 #if def HAVE_NTL42 #if defined(HAVE_NTL) || defined(HAVE_FLINT) 39 43 /// computes a random monic irreducible univariate polynomial in x over Fp of 40 /// degree i via NTL 44 /// degree i via NTL/FLINT 41 45 CanonicalForm 42 46 randomIrredpoly (int i, const Variable & x) 43 47 { 44 48 int p= getCharacteristic(); 49 #ifdef HAVE_FLINT 50 nmod_poly_t Irredpoly; 51 nmod_poly_init(Irredpoly,p); 52 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, i+1); 53 CanonicalForm CFirredpoly=convertnmod_poly_t2FacCF(Irredpoly,Variable(1)); 54 nmod_poly_clear(Irredpoly); 55 #elif defined(HAVE_NTL) 45 56 if (fac_NTL_char != p) 46 57 { … … 49 60 } 50 61 zz_pX NTLirredpoly; 51 CanonicalForm CFirredpoly;52 62 BuildIrred (NTLirredpoly, i); 53 CFirredpoly= convertNTLzzpX2CF (NTLirredpoly, x); 63 CanonicalForm CFirredpoly= convertNTLzzpX2CF (NTLirredpoly, x); 64 #endif 54 65 return CFirredpoly; 55 66 } -
factory/cf_map_ext.cc
rb666c7 r03c742 306 306 } 307 307 308 #ifdef HAVE_NTL 308 #ifdef HAVE_NTL // FindRoot 309 309 CanonicalForm 310 310 primitiveElement (const Variable& alpha, Variable& beta, bool& fail) … … 323 323 int d= degree (mipo); 324 324 int p= getCharacteristic (); 325 //#if !defined(HAVE_FLINT) && defined(AHVE_NTL) 325 326 if (fac_NTL_char != p) 326 327 { … … 329 330 } 330 331 zz_pX NTL_mipo; 332 //#endif 331 333 CanonicalForm mipo2; 332 334 primitive= false; … … 335 337 do 336 338 { 339 //#ifdef HAVE_FLINT 340 //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) 337 346 BuildIrred (NTL_mipo, d); 338 347 mipo2= convertNTLzzpX2CF (NTL_mipo, Variable (1)); 348 //#endif 339 349 if (!initialized) 340 350 beta= rootOf (mipo2); -
factory/facBivar.cc
rb666c7 r03c742 26 26 #include "cf_primes.h" 27 27 28 #ifdef HAVE_NTL29 28 TIMING_DEFINE_PRINT(fac_uni_factorizer) 30 29 TIMING_DEFINE_PRINT(fac_bi_hensel_lift) … … 185 184 } 186 185 186 #ifdef HAVE_NTL // resultatnt(ZZ), discrimeninat 187 187 CFList biFactorize (const CanonicalForm& F, const Variable& v) 188 188 { … … 607 607 return factors; 608 608 } 609 610 609 #endif -
factory/facFqBivar.cc
rb666c7 r03c742 39 39 #ifdef HAVE_NTL 40 40 #include "NTLconvert.h" 41 #endif 41 42 42 43 #ifdef HAVE_FLINT … … 79 80 } 80 81 82 #if defined(HAVE_NTL) || defined(HAVE_FLINT) 81 83 CanonicalForm evalPoint (const CanonicalForm& F, CanonicalForm & eval, 82 84 const Variable& alpha, CFList& list, const bool& GF, … … 170 172 Variable beta= rootOf (mipo.mapinto()); 171 173 CanonicalForm buf= GF2FalphaRep (A, beta); 174 #ifdef HAVE_NTL 172 175 if (getCharacteristic() > 2) 176 #else 177 if (getCharacteristic() > 0) 178 #endif 173 179 { 174 180 #if (HAVE_FLINT && __FLINT_RELEASE >= 20400) … … 215 221 #endif 216 222 } 223 #ifdef HAVE_NTL 217 224 else 218 225 { … … 226 233 x, beta); 227 234 } 235 #endif 228 236 setCharacteristic (getCharacteristic(), k, cGFName); 229 237 for (CFFListIterator i= factorsA; i.hasItem(); i++) … … 237 245 else if (alpha.level() != 1) 238 246 { 247 #ifdef HAVE_NTL 239 248 if (getCharacteristic() > 2) 249 #else 250 if (getCharacteristic() > 0) 251 #endif 240 252 { 241 253 #if (HAVE_FLINT && __FLINT_RELEASE >= 20400) … … 282 294 #endif 283 295 } 296 #ifdef HAVE_NTL 284 297 else 285 298 { … … 293 306 x, alpha); 294 307 } 308 #endif 295 309 } 296 310 else 297 311 { 298 312 #ifdef HAVE_FLINT 313 #ifdef HAVE_NTL 299 314 if (degree (A) < 300) 315 #endif 300 316 { 301 317 nmod_poly_t FLINTA; … … 310 326 nmod_poly_clear (FLINTA); 311 327 } 328 #ifdef HAVE_NTL 312 329 else 313 330 #endif 331 #endif /* HAVE_FLINT */ 332 #ifdef HAVE_NTL 314 333 if (getCharacteristic() > 2) 315 334 { … … 334 353 x); 335 354 } 355 #endif 336 356 } 337 357 CFList uniFactors; … … 780 800 Variable chooseExtension (const Variable & alpha, const Variable& beta, int k) 781 801 { 802 #if 0//#ifdef HAVE_NTL 782 803 if (fac_NTL_char != getCharacteristic()) 783 804 { … … 786 807 } 787 808 zz_pX NTLIrredpoly; 809 #elif defined(HAVE_FLINT) 810 nmod_poly_t Irredpoly; 811 nmod_poly_init(Irredpoly,getCharacteristic()); 812 #endif 788 813 int i=1, m= 2; 789 814 // extension of F_p needed … … 808 833 i= degree (getMipo (alpha))/m + 1; 809 834 } 835 #if 0 //#ifdef HAVE_NTL 810 836 BuildIrred (NTLIrredpoly, i*m); 811 837 CanonicalForm newMipo= convertNTLzzpX2CF (NTLIrredpoly, Variable (1)); 838 #elif defined(HAVE_FLINT) 839 nmod_poly_randtest_monic_irreducible(Irredpoly,FLINTrandom,i*m+1); 840 CanonicalForm newMipo= convertnmod_poly_t2FacCF(Irredpoly,Variable (1)); 841 #endif 812 842 return rootOf (newMipo); 813 843 } … … 1112 1142 } 1113 1143 1144 #ifdef HAVE_NTL // henselLift12 1114 1145 CFList 1115 1146 henselLiftAndEarly (CanonicalForm& A, bool& earlySuccess, CFList& … … 1412 1443 return bufUniFactors; 1413 1444 } 1414 1445 #endif 1446 1447 #ifdef HAVE_NTL // henselLiftAndEarly 1415 1448 CFList 1416 1449 henselLiftAndEarly (CanonicalForm& A, bool& earlySuccess, CFList& … … 1424 1457 uniFactors, info, eval, dummy, den); 1425 1458 } 1459 #endif 1426 1460 1427 1461 #ifndef HAVE_FLINT … … 1462 1496 } 1463 1497 #endif 1464 1498 1499 #ifdef HAVE_NTL // mat_zz_pE 1465 1500 long isReduced (const mat_zz_pE& M) 1466 1501 { … … 1479 1514 return 1; 1480 1515 } 1516 #endif 1481 1517 1482 1518 #ifndef HAVE_FLINT … … 1532 1568 #endif 1533 1569 1570 #ifdef HAVE_NTL // mat_zz_pE 1534 1571 int * extractZeroOneVecs (const mat_zz_pE& M) 1535 1572 { … … 1555 1592 return result; 1556 1593 } 1557 1594 #endif 1595 1596 #ifdef HAVE_NTL // mat_zz_pE 1558 1597 void 1559 1598 reconstructionTry (CFList& reconstructedFactors, CanonicalForm& F, const CFList& … … 1637 1676 F= bufF (y+eval,y); 1638 1677 } 1678 #endif 1639 1679 1640 1680 #ifndef HAVE_FLINT … … 1806 1846 #endif 1807 1847 1848 #ifdef HAVE_NTL //mat_zz_pE 1808 1849 CFList 1809 1850 reconstruction (CanonicalForm& G, CFList& factors, int* zeroOneVecs, int … … 1854 1895 return result; 1855 1896 } 1856 1897 #endif 1898 1899 #ifdef HAVE_NTL // mat_zz_pE 1857 1900 CFList 1858 1901 monicReconstruction (CanonicalForm& G, CFList& factors, int* zeroOneVecs, … … 1905 1948 return result; 1906 1949 } 1950 #endif 1907 1951 1908 1952 #ifndef HAVE_FLINT … … 2431 2475 2432 2476 #ifndef HAVE_FLINT 2477 #ifdef HAVE_NTL // logarithmicDerivative 2433 2478 //over Fp 2434 2479 int … … 2554 2599 } 2555 2600 #endif 2556 2557 #ifdef HAVE_FLINT 2601 #endif 2602 2603 #ifdef HAVE_FLINT 2604 #ifdef HAVE_NTL // henselLift12 2558 2605 int 2559 2606 liftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds, int … … 2691 2738 } 2692 2739 #endif 2740 #endif 2693 2741 2694 2742 #ifndef HAVE_FLINT 2743 #ifdef HAVE_NTL //logarithmicDerivative 2695 2744 //over field extension 2696 2745 int … … 2889 2938 } 2890 2939 #endif 2891 2892 #ifdef HAVE_FLINT 2940 #endif 2941 2942 #ifdef HAVE_FLINT 2943 #ifdef HAVE_NTL // henselLift12 2893 2944 //over field extension 2894 2945 int … … 3097 3148 } 3098 3149 #endif 3150 #endif 3099 3151 3100 3152 // over Fq 3153 #ifdef HAVE_NTL 3101 3154 int 3102 3155 liftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds, … … 3230 3283 return l; 3231 3284 } 3232 3285 #endif 3286 3287 #ifdef HAVE_NTL // henselLift12 3233 3288 #ifdef HAVE_FLINT 3234 3289 int … … 3412 3467 return l; 3413 3468 } 3414 3469 #endif 3470 3471 #ifdef HAVE_NTL // logarithmicDerivative 3415 3472 CFList 3416 3473 increasePrecision (CanonicalForm& F, CFList& factors, int factorsFound, … … 3619 3676 return CFList(); 3620 3677 } 3621 3678 #endif 3679 3680 #ifdef HAVE_NTL // mat_zz_pE 3622 3681 CFList 3623 3682 increasePrecision (CanonicalForm& F, CFList& factors, int factorsFound, … … 3758 3817 return CFList(); 3759 3818 } 3760 3819 #endif 3820 3821 #ifdef HAVE_NTL // logarithmicDerivative 3761 3822 //over field extension 3762 3823 CFList … … 4065 4126 return CFList(); 4066 4127 } 4067 4128 #endif 4129 4130 #ifdef HAVE_NTL // mat_zz_pE 4068 4131 CFList 4069 4132 increasePrecision2 (const CanonicalForm& F, CFList& factors, … … 4196 4259 return CFList(); 4197 4260 } 4198 4261 #endif 4262 4263 #ifdef HAVE_NTL // logarithmicDerivative 4199 4264 CFList 4200 4265 increasePrecisionFq2Fp (CanonicalForm& F, CFList& factors, int factorsFound, … … 4404 4469 return CFList(); 4405 4470 } 4406 4471 #endif 4472 4473 #ifdef HAVE_NTL // logarithmicDerivative 4407 4474 #ifdef HAVE_FLINT 4408 4475 CFList … … 4572 4639 return result; 4573 4640 } 4574 4641 #endif 4642 4643 #ifdef HAVE_NTL // mat_zz_pE 4575 4644 CFList 4576 4645 increasePrecision (CanonicalForm& F, CFList& factors, int oldL, int … … 4677 4746 return result; 4678 4747 } 4748 #endif 4679 4749 4680 4750 //over field extension 4751 #ifdef HAVE_NTL // logarithmicDerivative 4681 4752 #ifdef HAVE_FLINT 4682 4753 CFList … … 4934 5005 return result; 4935 5006 } 4936 5007 #endif 5008 5009 #ifdef HAVE_NTL // logarithmicDerivative 4937 5010 #ifdef HAVE_FLINT 4938 5011 CFList … … 5092 5165 return result; 5093 5166 } 5094 5167 #endif 5168 5169 #ifdef HAVE_NTL // logarithmicDerivative 5095 5170 #ifdef HAVE_FLINT 5096 5171 CFList … … 5325 5400 return CFList(); 5326 5401 } 5402 #endif 5327 5403 5328 5404 //Fq 5405 #ifdef HAVE_NTL 5329 5406 CFList 5330 5407 furtherLiftingAndIncreasePrecision (CanonicalForm& F, CFList& … … 5470 5547 return CFList(); 5471 5548 } 5549 #endif 5472 5550 5473 5551 //over field extension 5552 #ifdef HAVE_NTL // logarithmicDerivative 5474 5553 #ifdef HAVE_FLINT 5475 5554 CFList … … 5785 5864 return CFList(); 5786 5865 } 5787 5866 #endif 5867 5868 #ifdef HAVE_NTL // logarithmicDerivative 5788 5869 #ifdef HAVE_FLINT 5789 5870 CFList … … 6018 6099 return CFList(); 6019 6100 } 6101 #endif 6020 6102 6021 6103 #ifndef HAVE_FLINT … … 6052 6134 6053 6135 #ifdef HAVE_FLINT 6136 #ifdef HAVE_NTL // henselLift12 6054 6137 void 6055 6138 refineAndRestartLift (const CanonicalForm& F, const nmod_mat_t FLINTN, int … … 6082 6165 } 6083 6166 #endif 6084 6167 #endif 6168 6169 #ifdef HAVE_NTL // mat_zz_pE 6085 6170 void 6086 6171 refineAndRestartLift (const CanonicalForm& F, const mat_zz_pE& NTLN, int … … 6112 6197 henselLift12 (F, factors, l, Pi, diophant, M); 6113 6198 } 6199 #endif 6114 6200 6115 6201 #ifdef HAVE_FLINT … … 6327 6413 } 6328 6414 6415 #ifdef HAVE_NTL // mat_zz_pE 6329 6416 CFList 6330 6417 earlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_pE& N, … … 6483 6570 return result; 6484 6571 } 6572 #endif 6485 6573 6486 6574 //over field extension … … 6668 6756 } 6669 6757 6758 #ifdef HAVE_NTL // henselLift12 6670 6759 CFList 6671 6760 sieveSmallFactors (const CanonicalForm& G, CFList& uniFactors, DegreePattern& … … 6712 6801 } 6713 6802 } 6714 6803 #endif 6804 6805 #ifdef HAVE_NTL // henselLift12 6715 6806 CFList 6716 6807 extSieveSmallFactors (const CanonicalForm& G, CFList& uniFactors, DegreePattern& … … 6760 6851 } 6761 6852 } 6762 6853 #endif 6854 6855 #ifdef HAVE_NTL // matrix Fq 6763 6856 CFList 6764 6857 henselLiftAndLatticeRecombi (const CanonicalForm& G, const CFList& uniFactors, … … 7556 7649 } 7557 7650 } 7558 7651 #endif 7652 7653 #ifdef HAVE_NTL //primitiveElement 7559 7654 ExtensionInfo 7560 7655 init4ext (const ExtensionInfo& info, const CanonicalForm& evaluation, … … 7609 7704 return info2; 7610 7705 } 7611 7706 #endif 7707 7708 #ifdef HAVE_NTL // init4ext 7612 7709 CFList 7613 7710 extHenselLiftAndLatticeRecombi(const CanonicalForm& G, const CFList& uniFactors, … … 8193 8290 } 8194 8291 } 8195 8292 #endif 8293 8294 #ifdef HAVE_NTL // henselLiftAndLatticeRecombi 8196 8295 CFList 8197 8296 extBiFactorize (const CanonicalForm& F, const ExtensionInfo& info); … … 8821 8920 return factors; 8822 8921 } 8823 8922 #endif 8923 8924 #ifdef HAVE_NTL // primitiveElement 8824 8925 CFList 8825 8926 extBiFactorize (const CanonicalForm& F, const ExtensionInfo& info) … … 8995 9096 } 8996 9097 } 8997 8998 #endif 8999 /* HAVE_NTL */ 9000 9001 9098 #endif 9099 #endif -
factory/facFqBivar.h
rb666c7 r03c742 28 28 #include "cfNewtonPolygon.h" 29 29 #include "fac_util.h" 30 #include "cf_algorithm.h" 30 31 31 32 TIMING_DEFINE_PRINT(fac_fq_bi_sqrf) … … 34 35 static const double log2exp= 1.442695041; 35 36 36 #if def HAVE_NTL37 #if defined(HAVE_NTL) || defined(HAVE_FLINT) 37 38 /// Factorization of a squarefree bivariate polynomials over an arbitrary finite 38 39 /// field, information on the current field we work over is in @a info. @a info -
factory/facHensel.cc
rb666c7 r03c742 36 36 #include <NTL/lzz_pEX.h> 37 37 #include "NTLconvert.h" 38 #endif 38 39 39 40 #ifdef HAVE_FLINT … … 46 47 TIMING_DEFINE_PRINT (hensel23) 47 48 TIMING_DEFINE_PRINT (hensel) 49 50 #if defined (HAVE_NTL) || defined(HAVE_FLINT) 48 51 49 52 #if (!(HAVE_FLINT && __FLINT_RELEASE >= 20400)) … … 466 469 } 467 470 471 #ifdef HAVE_NTL 468 472 CFList 469 473 diophantine (const CanonicalForm& F, const CFList& factors); 470 474 #endif 475 476 #ifdef HAVE_NTL // diophantine 471 477 CFList 472 478 diophantineHensel (const CanonicalForm & F, const CFList& factors, … … 558 564 return result; 559 565 } 566 #endif 560 567 561 568 /// solve \f$ 1=\sum_{i=1}^n{\delta_{i} \prod_{j\neq i}{f_j}} \f$ mod \f$p^k\f$ … … 773 780 /// over \f$ Q(\alpha) \f$ by first computing mod \f$p\f$ and if no zero divisor 774 781 /// occurred compute it mod \f$p^k\f$ 782 #ifdef HAVE_NTL // XGCD, zzp_eX 775 783 CFList 776 784 diophantineQa (const CanonicalForm& F, const CanonicalForm& G, … … 883 891 return result; 884 892 } 885 893 #endif 894 895 #ifdef HAVE_NTL // diophantineQa 886 896 CFList 887 897 diophantine (const CanonicalForm& F, const CanonicalForm& G, … … 934 944 return result; 935 945 } 936 946 #endif 947 948 #ifdef HAVE_NTL // diophantineQa 937 949 CFList 938 950 diophantine (const CanonicalForm& F, const CFList& factors) … … 941 953 return diophantine (F, 1, factors, b); 942 954 } 955 #endif 943 956 944 957 void … … 1145 1158 } 1146 1159 1160 #ifdef HAVE_NTL // diopantineQa 1147 1161 void 1148 1162 henselLift12 (const CanonicalForm& F, CFList& factors, int l, CFArray& Pi, … … 1202 1216 factors.removeFirst(); 1203 1217 } 1204 1218 #endif 1219 1220 #ifdef HAVE_NTL //henselLift12 1205 1221 void 1206 1222 henselLift12 (const CanonicalForm& F, CFList& factors, int l, CFArray& Pi, … … 1210 1226 henselLift12 (F, factors, l, Pi, diophant, M, dummy, sort); 1211 1227 } 1228 #endif 1212 1229 1213 1230 void … … 1236 1253 } 1237 1254 1255 #ifdef HAVE_NTL // diophantine 1238 1256 CFList 1239 1257 biDiophantine (const CanonicalForm& F, const CFList& factors, int d) … … 1335 1353 } 1336 1354 } 1355 #endif 1337 1356 1338 1357 CFList … … 1650 1669 } 1651 1670 1671 #ifdef HAVE_NTL // biDiophantine 1652 1672 CFList 1653 1673 henselLift23 (const CFList& eval, const CFList& factors, int* l, CFList& … … 1690 1710 return result; 1691 1711 } 1712 #endif 1692 1713 1693 1714 void … … 1757 1778 } 1758 1779 1780 #ifdef HAVE_NTL // henselLift23 1759 1781 CFList 1760 1782 henselLift (const CFList& eval, const CFList& factors, int* l, int lLength, … … 1791 1813 return result; 1792 1814 } 1815 #endif 1793 1816 1794 1817 // nonmonic … … 2015 2038 } 2016 2039 2040 #ifdef HAVE_NTL // diophantine 2017 2041 void 2018 2042 nonMonicHenselLift12 (const CanonicalForm& F, CFList& factors, int l, … … 2091 2115 return; 2092 2116 } 2093 2094 2117 #endif 2118 2119 #ifdef HAVE_NTL 2095 2120 /// solve \f$ E=\sum_{i= 1}^r{\sigma_{i}\prod_{j=1, j\neq i}^{r}{f_{j}}} \f$ 2096 2121 /// mod M, @a products contains \f$ \prod_{j=1, j\neq i}^{r}{f_{j}} \f$ … … 2172 2197 return result; 2173 2198 } 2174 2199 #endif 2200 2201 #ifdef HAVE_NTL // diophantine 2175 2202 void 2176 2203 nonMonicHenselStep (const CanonicalForm& F, const CFList& factors, … … 2411 2438 return; 2412 2439 } 2440 #endif 2413 2441 2414 2442 // wrt. Variable (1) … … 2426 2454 } 2427 2455 2456 #ifdef HAVE_NTL // nonMonicHenselStep 2428 2457 CFList 2429 2458 nonMonicHenselLift232(const CFList& eval, const CFList& factors, int* l, CFList& … … 2487 2516 return result; 2488 2517 } 2489 2490 2518 #endif 2519 2520 #ifdef HAVE_NTL // nonMonicHenselStep 2491 2521 CFList 2492 2522 nonMonicHenselLift2 (const CFList& F, const CFList& factors, const CFList& MOD, … … 2551 2581 return result; 2552 2582 } 2553 2583 #endif 2584 2585 #ifdef HAVE_NTL // nonMonicHenselStep 2554 2586 CFList 2555 2587 nonMonicHenselLift2 (const CFList& eval, const CFList& factors, int* l, int … … 2603 2635 return result; 2604 2636 } 2605 2637 #endif 2638 2639 #ifdef HAVE_NTL // diophantine 2606 2640 CFList 2607 2641 nonMonicHenselLift23 (const CanonicalForm& F, const CFList& factors, const … … 2705 2739 return result; 2706 2740 } 2707 2741 #endif 2742 2743 #ifdef HAVE_NTL // nonMonicHenselStep 2708 2744 CFList 2709 2745 nonMonicHenselLift (const CFList& F, const CFList& factors, const CFList& LCs, … … 2788 2824 return result; 2789 2825 } 2790 2826 #endif 2827 2828 #ifdef HAVE_NTL // nonMonicHenselLift23 2791 2829 CFList 2792 2830 nonMonicHenselLift (const CFList& eval, const CFList& factors, … … 2839 2877 return result; 2840 2878 } 2841 2842 #endif 2843 /* HAVE_NTL */ 2844 2879 #endif 2880 #endif -
factory/facHensel.h
rb666c7 r03c742 27 27 #include "fac_util.h" 28 28 29 #ifdef HAVE_NTL30 29 /// sort a list of polynomials by their degree in @a x. 31 30 /// … … 240 239 ///< correspondence 241 240 ); 242 #endif /* HAVE_NTL */243 241 #endif 244 242 /* FAC_HENSEL_H */ -
factory/facMul.cc
rb666c7 r03c742 41 41 42 42 // univariate polys 43 #if defined(HAVE_NTL) || defined(HAVE_FLINT) 43 44 44 45 #ifdef HAVE_FLINT … … 3747 3748 // end division 3748 3749 3750 #else 3751 CanonicalForm 3752 mulNTL (const CanonicalForm& F, const CanonicalForm& G, const modpk& b) 3753 { return F*G; } 3754 #endif
Note: See TracChangeset
for help on using the changeset viewer.