Changeset 0851b0 in git
- Timestamp:
- Oct 12, 2012, 5:31:21 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- cb4f0c3c5277d6de4d18c968650b4169ff1d1b46
- Parents:
- 2a95b234ef67ebbc98057baefb8dd2ed43af3762
- git-author:
- Martin Lee <martinlee84@web.de>2012-10-12 17:31:21+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-10-24 12:26:22+02:00
- Location:
- factory
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facAlgExt.cc
r2a95b2 r0851b0 29 29 #include "fac_sqrfree.h" 30 30 31 TIMING_DEFINE_PRINT(fac_alg_resultant) 32 TIMING_DEFINE_PRINT(fac_alg_norm) 33 TIMING_DEFINE_PRINT(fac_alg_factor_norm) 34 TIMING_DEFINE_PRINT(fac_alg_gcd) 35 TIMING_DEFINE_PRINT(fac_alg_sqrf) 36 TIMING_DEFINE_PRINT(fac_alg_factor_sqrf) 37 31 38 // squarefree part of F 32 39 CanonicalForm … … 53 60 int degmipo= degree (mipo); 54 61 CanonicalForm norm; 62 TIMING_START (fac_alg_resultant); 55 63 if (degg >= 8 || degmipo >= 8) 56 64 norm= resultantZ (g, mipo, x); 57 65 else 58 66 norm= resultant (g, mipo, x); 67 TIMING_END_AND_PRINT (fac_alg_resultant, "time to compute resultant0: "); 59 68 60 69 i= 0; … … 72 81 g= F (y - i*alpha, y); 73 82 g *= bCommonDen (g); 83 TIMING_START (fac_alg_resultant); 74 84 if (degg >= 8 || degmipo >= 8) 75 85 norm= resultantZ (g (x, alpha), mipo, x); 76 86 else 77 87 norm= resultant (g (x, alpha), mipo, x); 88 TIMING_END_AND_PRINT (fac_alg_resultant,"time to compute resultant1: "); 78 89 } 79 90 else … … 81 92 g= F (y + i*alpha, y); 82 93 g *= bCommonDen (g); 94 TIMING_START (fac_alg_resultant); 83 95 if (degg >= 8 || degmipo >= 8) 84 96 norm= resultantZ (g (x, alpha), mipo, x); 85 97 else 86 98 norm= resultant (g (x, alpha), mipo, x); 99 TIMING_END_AND_PRINT (fac_alg_resultant,"time to compute resultant2: "); 87 100 } 88 101 if (degree (gcd (deriv (norm, y), norm)) <= 0) … … 108 121 CanonicalForm f= F*bCommonDen (F); 109 122 int shift; 123 TIMING_START (fac_alg_norm); 110 124 CanonicalForm norm= sqrfNorm (f, alpha, shift); 125 TIMING_END_AND_PRINT (fac_alg_norm, "time to compute sqrf norm: "); 111 126 ASSERT (degree (norm, alpha) <= 0, "wrong norm computed"); 127 TIMING_START (fac_alg_factor_norm); 112 128 CFFList normFactors= factorize (norm); 129 TIMING_END_AND_PRINT (fac_alg_factor_norm, "time to factor norm: "); 113 130 CFList factors; 114 131 if (normFactors.length() <= 2) … … 125 142 { 126 143 ASSERT (i.getItem().exp() == 1, "norm not squarefree"); 144 TIMING_START (fac_alg_gcd); 127 145 if (shift == 0) 128 146 factor= gcd (buf, i.getItem().factor()); … … 130 148 factor= gcd (buf, i.getItem().factor() (f.mvar() + shift*alpha, f.mvar())); 131 149 buf /= factor; 150 TIMING_END_AND_PRINT (fac_alg_gcd, "time to recover factors: "); 132 151 factors.append (factor); 133 152 } … … 149 168 bool save_rat=!isOn (SW_RATIONAL); 150 169 On (SW_RATIONAL); 170 TIMING_START (fac_alg_sqrf); 151 171 CFFList sqrf= sqrFreeZ (F); 172 TIMING_END_AND_PRINT (fac_alg_sqrf, "time for sqrf factors in Q(a)[x]: "); 152 173 CFList factorsSqrf; 153 174 CFFList factors; … … 158 179 { 159 180 if (i.getItem().factor().inCoeffDomain()) continue; 181 TIMING_START (fac_alg_factor_sqrf); 160 182 factorsSqrf= AlgExtSqrfFactorize (i.getItem().factor(), alpha); 183 TIMING_END_AND_PRINT (fac_alg_factor_sqrf, 184 "time to factor sqrf factors in Q(a)[x]: "); 161 185 for (j= factorsSqrf; j.hasItem(); j++) 162 186 { -
factory/facBivar.cc
r2a95b2 r0851b0 13 13 #include "config.h" 14 14 15 #include " assert.h"15 #include "cf_assert.h" 16 16 #include "debug.h" 17 17 #include "timing.h" … … 28 28 TIMING_DEFINE_PRINT(fac_bi_hensel_lift) 29 29 TIMING_DEFINE_PRINT(fac_bi_factor_recombination) 30 TIMING_DEFINE_PRINT(fac_bi_evaluation) 31 TIMING_DEFINE_PRINT(fac_bi_shift_to_zero) 30 32 31 33 // bound on coeffs of f (cf. Musser: Multivariate Polynomial Factorization, … … 334 336 { 335 337 bufAeval= A; 338 TIMING_START (fac_bi_evaluation); 336 339 bufAeval= evalPoint (A, bufEvaluation); 340 TIMING_END_AND_PRINT (fac_bi_evaluation, "time for eval point over Q: "); 337 341 338 342 bufAeval2= buf; 343 TIMING_START (fac_bi_evaluation); 339 344 bufAeval2= evalPoint (buf, bufEvaluation2); 345 TIMING_END_AND_PRINT (fac_bi_evaluation, 346 "time for eval point over Q in y: "); 340 347 341 348 // univariate factorization 342 TIMING_START (uni_factorize); 343 349 TIMING_START (fac_uni_factorizer); 344 350 if (extension) 345 351 bufUniFactors= conv (factorize (bufAeval, v)); 346 352 else 347 353 bufUniFactors= conv (factorize (bufAeval, true)); 348 TIMING_END_AND_PRINT ( uni_factorize,349 "time for univariate factorization : ");354 TIMING_END_AND_PRINT (fac_uni_factorizer, 355 "time for univariate factorization over Q: "); 350 356 DEBOUTLN (cerr, "prod (bufUniFactors)== bufAeval " << 351 357 (prod (bufUniFactors) == bufAeval)); 352 358 353 TIMING_START ( uni_factorize);359 TIMING_START (fac_uni_factorizer); 354 360 if (extension) 355 361 bufUniFactors2= conv (factorize (bufAeval2, v)); 356 362 else 357 363 bufUniFactors2= conv (factorize (bufAeval2, true)); 358 TIMING_END_AND_PRINT ( uni_factorize,359 "time for univariate factorization in y : ");364 TIMING_END_AND_PRINT (fac_uni_factorizer, 365 "time for univariate factorization in y over Q: "); 360 366 DEBOUTLN (cerr, "prod (bufuniFactors2)== bufAeval2 " << 361 367 (prod (bufUniFactors2) == bufAeval2)); … … 544 550 (A, earlySuccess, earlyFactors, degs, liftBound, 545 551 uniFactors, dummy, evaluation, b); 546 TIMING_END_AND_PRINT (fac_bi_hensel_lift, "time for hensel lifting: "); 552 TIMING_END_AND_PRINT (fac_bi_hensel_lift, 553 "time for bivariate hensel lifting over Q: "); 547 554 DEBOUTLN (cerr, "lifted factors= " << uniFactors); 548 555 … … 563 570 Off (SW_RATIONAL); 564 571 572 TIMING_START (fac_bi_factor_recombination); 565 573 factors= factorRecombination (uniFactors, A, MODl, degs, 1, 566 574 uniFactors.length()/2, b); 575 TIMING_END_AND_PRINT (fac_bi_factor_recombination, 576 "time for bivariate factor recombination over Q: "); 567 577 568 578 On (SW_RATIONAL); -
factory/facBivar.h
r2a95b2 r0851b0 14 14 #define FAC_BIVAR_H 15 15 16 #include <config.h> 17 18 #include "assert.h" 16 #include "config.h" 17 18 #include "cf_assert.h" 19 #include "timing.h" 19 20 20 21 #include "facFqBivarUtil.h" … … 26 27 #include "algext.h" 27 28 #include "fac_util.h" 29 30 TIMING_DEFINE_PRINT(fac_bi_sqrf) 31 TIMING_DEFINE_PRINT(fac_bi_factor_sqrf) 28 32 29 33 /// @return @a biFactorize returns a list of factors of F. If F is not monic … … 196 200 vec_ZZ S; 197 201 F= compress (F, M, S); 202 TIMING_START (fac_bi_sqrf); 198 203 CFFList sqrfFactors= sqrFree (F); 204 TIMING_END_AND_PRINT (fac_bi_sqrf, 205 "time for bivariate sqrf factors over Q: "); 199 206 for (CFFListIterator i= sqrfFactors; i.hasItem(); i++) 200 207 { 208 TIMING_START (fac_bi_factor_sqrf); 201 209 CFList tmp= ratBiSqrfFactorize (i.getItem().factor(), v); 210 TIMING_END_AND_PRINT (fac_bi_factor_sqrf, 211 "time to factor bivariate sqrf factors over Q: "); 202 212 for (CFListIterator j= tmp; j.hasItem(); j++) 203 213 { -
factory/facFactorize.cc
r2a95b2 r0851b0 29 29 #include "facSparseHensel.h" 30 30 31 TIMING_DEFINE_PRINT(fac_bi_factorize )31 TIMING_DEFINE_PRINT(fac_bi_factorizer) 32 32 TIMING_DEFINE_PRINT(fac_hensel_lift) 33 33 TIMING_DEFINE_PRINT(fac_factor_recombination) 34 TIMING_DEFINE_PRINT(fac_shift_to_zero) 35 TIMING_DEFINE_PRINT(fac_precompute_leadcoeff) 36 TIMING_DEFINE_PRINT(fac_evaluation) 37 TIMING_DEFINE_PRINT(fac_recover_factors) 38 TIMING_DEFINE_PRINT(fac_preprocess_and_content) 39 TIMING_DEFINE_PRINT(fac_bifactor_total) 40 TIMING_DEFINE_PRINT(fac_luckswang) 41 TIMING_DEFINE_PRINT(fac_lcheuristic) 42 TIMING_DEFINE_PRINT(fac_cleardenom) 43 TIMING_DEFINE_PRINT(fac_content) 44 TIMING_DEFINE_PRINT(fac_compress) 34 45 35 46 #ifdef HAVE_NTL … … 158 169 return CFList (F); 159 170 171 TIMING_START (fac_preprocess_and_content); 160 172 // compress and find main Variable 161 173 CFMap N; 174 TIMING_START (fac_compress) 162 175 CanonicalForm A= myCompress (F, N); 176 TIMING_END_AND_PRINT (fac_compress, "time to compress poly over Q: ") 163 177 164 178 //univariate case … … 186 200 187 201 // remove content 202 TIMING_START (fac_content); 188 203 CFList contentAi; 189 204 CanonicalForm lcmCont= lcmContent (A, contentAi); 190 205 A /= lcmCont; 206 TIMING_END_AND_PRINT (fac_content, "time to extract content over Q: "); 191 207 192 208 // trivial after content removal … … 214 230 215 231 // factorize content 232 TIMING_START (fac_content); 216 233 contentAFactors= multiFactorize (lcmCont, v); 234 TIMING_END_AND_PRINT (fac_content, "time to factor content over Q: "); 217 235 218 236 // univariate after content removal … … 230 248 231 249 A *= bCommonDen (A); 232 // check main variable233 250 CFList Aeval, list, evaluation, bufEvaluation, bufAeval; 234 251 int factorNums= 1; … … 241 258 int differentSecondVar= 0; 242 259 CanonicalForm bufA; 260 TIMING_END_AND_PRINT (fac_preprocess_and_content, 261 "time to preprocess poly and extract content over Q: "); 262 243 263 // several bivariate factorizations 264 TIMING_START (fac_bifactor_total); 244 265 REvaluation E (2, A.level(), IntRandom (25)); 245 266 for (int i= 0; i < factorNums; i++) … … 248 269 bufA= A; 249 270 bufAeval= CFList(); 271 TIMING_START (fac_evaluation); 250 272 bufEvaluation= evalPoints (bufA, bufAeval, E); 273 TIMING_END_AND_PRINT (fac_evaluation, 274 "time to find evaluation point over Q: "); 251 275 E.nextpoint(); 252 276 evalPoly= 0; 253 277 278 TIMING_START (fac_evaluation); 254 279 evaluationWRTDifferentSecondVars (bufAeval2, bufEvaluation, A); 280 TIMING_END_AND_PRINT (fac_evaluation, 281 "time to eval wrt diff second vars over Q: "); 255 282 256 283 for (int j= 0; j < lengthAeval2; j++) … … 262 289 bufLift= degree (A, y) + 1 + degree (LC(A, x), y); 263 290 264 TIMING_START (fac_bi_factorize );291 TIMING_START (fac_bi_factorizer); 265 292 bufBiFactors= ratBiSqrfFactorize (bufAeval.getFirst(), v); 266 TIMING_END_AND_PRINT (fac_bi_factorize ,293 TIMING_END_AND_PRINT (fac_bi_factorizer, 267 294 "time for bivariate factorization: "); 268 295 bufBiFactors.removeFirst(); … … 316 343 int minFactorsLength; 317 344 bool irred= false; 345 TIMING_START (fac_bi_factorizer); 318 346 factorizationWRTDifferentSecondVars (A, Aeval2, minFactorsLength, irred, v); 319 347 TIMING_END_AND_PRINT (fac_bi_factorizer, 348 "time for bivariate factorization wrt diff second vars over Q: "); 349 350 TIMING_END_AND_PRINT (fac_bifactor_total, 351 "total time for eval and bivar factors over Q: "); 320 352 if (irred) 321 353 { … … 376 408 377 409 Variable w; 410 TIMING_START (fac_precompute_leadcoeff); 378 411 CFList leadingCoeffs= precomputeLeadingCoeff (LC (A, 1), biFactorsLCs, x, 379 412 evaluation, Aeval2, lengthAeval2, w); … … 477 510 } 478 511 } 512 TIMING_END_AND_PRINT(fac_precompute_leadcoeff, 513 "time to precompute LC over Q: "); 514 515 TIMING_START (fac_luckswang); 479 516 CFList bufFactors= CFList(); 480 517 bool LCheuristic= false; … … 499 536 delete [] index; 500 537 delete [] Aeval2; 538 TIMING_END_AND_PRINT (fac_luckswang, 539 "time for successful LucksWang over Q: "); 501 540 return factors; 502 541 } … … 837 876 delete [] index; 838 877 } 878 TIMING_END_AND_PRINT (fac_luckswang, "time for LucksWang over Q: "); 879 880 TIMING_START (fac_lcheuristic); 839 881 if (!LCheuristic && !LCmultiplierIsConst && bufFactors.isEmpty() 840 882 && fdivides (getVars (LCmultiplier), testVars)) … … 986 1028 } 987 1029 } 1030 TIMING_END_AND_PRINT (fac_lcheuristic, "time for Lc heuristic over Q: "); 988 1031 989 1032 tryAgainWithoutHeu: 990 1033 //shifting to zero 1034 TIMING_START (fac_shift_to_zero); 991 1035 A= shift2Zero (A, Aeval, evaluation); 992 1036 … … 1007 1051 } 1008 1052 } 1053 TIMING_END_AND_PRINT (fac_shift_to_zero, 1054 "time to shift evaluation point to zero: "); 1009 1055 1010 1056 CFArray Pi; … … 1018 1064 bool noOneToOne= false; 1019 1065 1066 TIMING_START (fac_cleardenom); 1020 1067 CFList commonDenominators; 1021 1068 for (iter=biFactors; iter.hasItem(); iter++) … … 1056 1103 iter.getItem() *= iter2.getItem()*multiplier; 1057 1104 } 1058 1059 1105 TIMING_END_AND_PRINT (fac_cleardenom, "time to clear denominators: "); 1106 1107 TIMING_START (fac_hensel_lift); 1060 1108 factors= nonMonicHenselLift (Aeval, biFactors, leadingCoeffs2, diophant, 1061 1109 Pi, liftBounds, liftBoundsLength, noOneToOne); 1110 TIMING_END_AND_PRINT (fac_hensel_lift, 1111 "time for non monic hensel lifting over Q: "); 1062 1112 1063 1113 if (!noOneToOne) … … 1065 1115 int check= factors.length(); 1066 1116 A= oldA; 1117 TIMING_START (fac_recover_factors); 1067 1118 factors= recoverFactors (A, factors, evaluation); 1119 TIMING_END_AND_PRINT (fac_recover_factors, 1120 "time to recover factors over Q: "); 1068 1121 if (check != factors.length()) 1069 1122 noOneToOne= true; -
factory/facFactorize.h
r2a95b2 r0851b0 14 14 #define FAC_FACTORIZE_H 15 15 16 // #include "config.h" 16 #include "config.h" 17 #include "timing.h" 17 18 18 19 #include "facBivar.h" 19 20 #include "facFqBivarUtil.h" 21 22 TIMING_DEFINE_PRINT (fac_squarefree) 23 TIMING_DEFINE_PRINT (fac_factor_squarefree) 20 24 21 25 /// Factorization over Q (a) … … 120 124 121 125 CFFList result; 126 TIMING_START (fac_squarefree); 122 127 CFFList sqrfFactors= sqrFree (F); 128 TIMING_END_AND_PRINT (fac_squarefree, 129 "time for squarefree factorization over Q: "); 130 131 CFList tmp; 123 132 for (CFFListIterator i= sqrfFactors; i.hasItem(); i++) 124 133 { 125 CFList tmp= ratSqrfFactorize (i.getItem().factor(), v); 134 TIMING_START (fac_factor_squarefree); 135 tmp= ratSqrfFactorize (i.getItem().factor(), v); 136 TIMING_END_AND_PRINT (fac_factor_squarefree, 137 "time to factorize sqrfree factor over Q: "); 126 138 for (CFListIterator j= tmp; j.hasItem(); j++) 127 139 { -
factory/facFqBivar.cc
r2a95b2 r0851b0 46 46 TIMING_DEFINE_PRINT(fac_fq_bi_hensel_lift) 47 47 TIMING_DEFINE_PRINT(fac_fq_bi_factor_recombination) 48 TIMING_DEFINE_PRINT(fac_fq_bi_evaluation) 49 TIMING_DEFINE_PRINT(fac_fq_bi_shift_to_zero) 48 50 49 51 CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M, const modpk& b) … … 6082 6084 { 6083 6085 bufAeval= A; 6086 TIMING_START (fac_fq_bi_evaluation); 6084 6087 bufEvaluation= evalPoint (A, bufAeval, alpha, list, GF, fail); 6088 TIMING_END_AND_PRINT (fac_fq_bi_evaluation, "time to find eval point: "); 6085 6089 if (!derivXZero && !fail2 && !symmetric) 6086 6090 { … … 6091 6095 } 6092 6096 bufAeval2= buf; 6097 TIMING_START (fac_fq_bi_evaluation); 6093 6098 bufEvaluation2= evalPoint (buf, bufAeval2, alpha, list2, GF, fail2); 6099 TIMING_END_AND_PRINT (fac_fq_bi_evaluation, 6100 "time to find eval point wrt y: "); 6094 6101 } 6095 6102 // first try to change main variable if there is no valid evaluation point … … 6132 6139 bufUniFactors= uniFactorizer (bufAeval, alpha, GF); 6133 6140 TIMING_END_AND_PRINT (fac_fq_uni_factorizer, 6134 "time for univariate factorization : ");6141 "time for univariate factorization over Fq: "); 6135 6142 DEBOUTLN (cerr, "Lc (bufAeval)*prod (bufUniFactors)== bufAeval " << 6136 6143 (prod (bufUniFactors)*Lc (bufAeval) == bufAeval)); … … 6141 6148 bufUniFactors2= uniFactorizer (bufAeval2, alpha, GF); 6142 6149 TIMING_END_AND_PRINT (fac_fq_uni_factorizer, 6143 "time for univariate factorization in y : ");6150 "time for univariate factorization in y over Fq: "); 6144 6151 DEBOUTLN (cerr, "Lc (bufAeval2)*prod (bufUniFactors2)== bufAeval2 " << 6145 6152 (prod (bufUniFactors2)*Lc (bufAeval2) == bufAeval2)); … … 6291 6298 } 6292 6299 6300 TIMING_START (fac_fq_bi_shift_to_zero); 6293 6301 A= A (y + evaluation, y); 6302 TIMING_END_AND_PRINT (fac_fq_bi_shift_to_zero, 6303 "time to shift eval to zero: "); 6294 6304 6295 6305 int degMipo= 1; … … 6307 6317 (A, earlySuccess, earlyFactors, degs, liftBound, 6308 6318 uniFactors, info, evaluation); 6309 TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: "); 6319 TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, 6320 "time for bivariate hensel lifting over Fq: "); 6310 6321 DEBOUTLN (cerr, "lifted factors= " << uniFactors); 6311 6322 6312 6323 CanonicalForm MODl= power (y, liftBound); 6313 6324 6325 TIMING_START (fac_fq_bi_factor_recombination); 6314 6326 if (extension) 6315 6327 factors= extFactorRecombination (uniFactors, A, MODl, info, degs, … … 6318 6330 factors= factorRecombination (uniFactors, A, MODl, degs, 1, 6319 6331 uniFactors.length()/2); 6332 TIMING_END_AND_PRINT (fac_fq_bi_factor_recombination, 6333 "time for naive bivariate factor recombi over Fq: "); 6320 6334 6321 6335 if (earlySuccess) … … 6346 6360 factors= Union (lll, factors); 6347 6361 } 6348 TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: "); 6362 TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, 6363 "time to bivar lift and LLL recombi over Fq: "); 6349 6364 DEBOUTLN (cerr, "lifted factors= " << uniFactors); 6350 6365 } … … 6357 6372 (A, earlySuccess, earlyFactors, degs, liftBound, 6358 6373 uniFactors, info, evaluation); 6359 TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: "); 6374 TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, 6375 "time for bivar hensel lifting over Fq: "); 6360 6376 DEBOUTLN (cerr, "lifted factors= " << uniFactors); 6361 6377 … … 6363 6379 if (!extension) 6364 6380 { 6381 TIMING_START (fac_fq_bi_factor_recombination); 6365 6382 factors= factorRecombination (uniFactors, A, MODl, degs, 1, 3); 6383 TIMING_END_AND_PRINT (fac_fq_bi_factor_recombination, 6384 "time for small subset naive recombi over Fq: "); 6366 6385 6367 6386 int oldUniFactorsLength= uniFactors.length(); … … 6369 6388 { 6370 6389 CFList tmp; 6390 TIMING_START (fac_fq_bi_hensel_lift); 6371 6391 if (alpha.level() == 1) 6372 6392 tmp= increasePrecision (A, uniFactors, 0, uniFactors.length(), 1, … … 6384 6404 ); 6385 6405 } 6406 TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, 6407 "time to increase precision: "); 6386 6408 factors= Union (factors, tmp); 6387 6409 if (tmp.length() == 0 || (tmp.length() > 0 && uniFactors.length() != 0 -
factory/facFqBivar.h
r2a95b2 r0851b0 15 15 #define FAC_FQ_BIVAR_H 16 16 17 // #include "config.h" 18 17 #include "config.h" 18 19 #include "timing.h" 19 20 #include "cf_assert.h" 20 21 … … 26 27 #include "cf_map.h" 27 28 #include "cfNewtonPolygon.h" 29 30 TIMING_DEFINE_PRINT(fac_fq_bi_sqrf) 31 TIMING_DEFINE_PRINT(fac_fq_bi_factor_sqrf) 28 32 29 33 static const double log2exp= 1.442695041; … … 273 277 F= compress (F, M, S); 274 278 279 TIMING_START (fac_fq_bi_sqrf); 275 280 CFFList sqrf= FpSqrf (F, false); 281 TIMING_END_AND_PRINT (fac_fq_bi_sqrf, 282 "time for bivariate sqrf factors over Fp: "); 276 283 CFList bufResult; 277 284 sqrf.removeFirst(); … … 279 286 for (CFFListIterator iter= sqrf; iter.hasItem(); iter++) 280 287 { 288 TIMING_START (fac_fq_bi_factor_sqrf); 281 289 bufResult= biFactorize (iter.getItem().factor(), info); 290 TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf, 291 "time to factor bivariate sqrf factors over Fp: "); 282 292 for (i= bufResult; i.hasItem(); i++) 283 293 result.append (CFFactor (N (decompress (i.getItem(), M, S)), … … 374 384 F= compress (F, M, S); 375 385 386 TIMING_START (fac_fq_bi_sqrf); 376 387 CFFList sqrf= FqSqrf (F, alpha, false); 388 TIMING_END_AND_PRINT (fac_fq_bi_sqrf, 389 "time for bivariate sqrf factors over Fq: "); 377 390 CFList bufResult; 378 391 sqrf.removeFirst(); … … 380 393 for (CFFListIterator iter= sqrf; iter.hasItem(); iter++) 381 394 { 395 TIMING_START (fac_fq_bi_factor_sqrf); 382 396 bufResult= biFactorize (iter.getItem().factor(), info); 397 TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf, 398 "time to factor bivariate sqrf factors over Fq: "); 383 399 for (i= bufResult; i.hasItem(); i++) 384 400 result.append (CFFactor (N (decompress (i.getItem(), M, S)), … … 476 492 F= compress (F, M, S); 477 493 494 TIMING_START (fac_fq_bi_sqrf); 478 495 CFFList sqrf= GFSqrf (F, false); 496 TIMING_END_AND_PRINT (fac_fq_bi_sqrf, 497 "time for bivariate sqrf factors over GF: "); 479 498 CFList bufResult; 480 499 sqrf.removeFirst(); … … 482 501 for (CFFListIterator iter= sqrf; iter.hasItem(); iter++) 483 502 { 503 TIMING_START (fac_fq_bi_factor_sqrf); 484 504 bufResult= biFactorize (iter.getItem().factor(), info); 505 TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf, 506 "time to factor bivariate sqrf factors over GF: "); 485 507 for (i= bufResult; i.hasItem(); i++) 486 508 result.append (CFFactor (N (decompress (i.getItem(), M, S)), -
factory/facFqFactorize.cc
r2a95b2 r0851b0 38 38 TIMING_DEFINE_PRINT(fac_fq_hensel_lift) 39 39 TIMING_DEFINE_PRINT(fac_fq_factor_recombination) 40 TIMING_DEFINE_PRINT(fac_fq_shift_to_zero) 41 TIMING_DEFINE_PRINT(fac_fq_precompute_leadcoeff) 42 TIMING_DEFINE_PRINT(fac_fq_evaluation) 43 TIMING_DEFINE_PRINT(fac_fq_recover_factors) 44 TIMING_DEFINE_PRINT(fac_fq_preprocess_and_content) 45 TIMING_DEFINE_PRINT(fac_fq_bifactor_total) 46 TIMING_DEFINE_PRINT(fac_fq_luckswang) 47 TIMING_DEFINE_PRINT(fac_fq_lcheuristic) 48 TIMING_DEFINE_PRINT(fac_fq_content) 49 TIMING_DEFINE_PRINT(fac_fq_check_mainvar) 50 TIMING_DEFINE_PRINT(fac_fq_compress) 40 51 41 52 static inline … … 2196 2207 return CFList (F); 2197 2208 2209 TIMING_START (fac_fq_preprocess_and_content); 2198 2210 // compress and find main Variable 2199 2211 CFMap N; 2212 TIMING_START (fac_fq_compress) 2200 2213 CanonicalForm A= myCompress (F, N); 2214 TIMING_END_AND_PRINT (fac_fq_compress, "time to compress poly over Fq: ") 2201 2215 2202 2216 A /= Lc (A); // make monic … … 2232 2246 2233 2247 // remove content 2248 TIMING_START (fac_fq_content); 2234 2249 CFList contentAi; 2235 2250 CanonicalForm lcmCont= lcmContent (A, contentAi); 2236 2251 A /= lcmCont; 2252 TIMING_END_AND_PRINT (fac_fq_content, "time to extract content over Fq: "); 2237 2253 2238 2254 // trivial after content removal … … 2260 2276 2261 2277 // factorize content 2278 TIMING_START (fac_fq_content); 2262 2279 contentAFactors= multiFactorize (lcmCont, info); 2280 TIMING_END_AND_PRINT (fac_fq_content, "time to factor content over Fq: "); 2263 2281 2264 2282 // univariate after content removal … … 2273 2291 2274 2292 // check main variable 2293 TIMING_START (fac_fq_check_mainvar); 2275 2294 int swapLevel= 0; 2276 2295 CanonicalForm derivZ; … … 2315 2334 } 2316 2335 } 2317 2336 TIMING_END_AND_PRINT (fac_fq_check_mainvar, 2337 "time to check main var over Fq: "); 2338 TIMING_END_AND_PRINT (fac_fq_preprocess_and_content, 2339 "time to preprocess poly and extract content over Fq: "); 2318 2340 2319 2341 CFList Aeval, list, evaluation, bufEvaluation, bufAeval; … … 2335 2357 int differentSecondVar= 0; 2336 2358 // several bivariate factorizations 2359 TIMING_START (fac_fq_bifactor_total); 2337 2360 for (int i= 0; i < factorNums; i++) 2338 2361 { … … 2340 2363 bufA= A; 2341 2364 bufAeval= CFList(); 2365 TIMING_START (fac_fq_evaluation); 2342 2366 bufEvaluation= evalPoints (bufA, bufAeval, alpha, list, GF, fail); 2367 TIMING_END_AND_PRINT (fac_fq_evaluation, 2368 "time to find evaluation point over Fq: "); 2343 2369 evalPoly= 0; 2344 2370 … … 2385 2411 break; 2386 2412 2413 TIMING_START (fac_fq_evaluation); 2387 2414 evaluationWRTDifferentSecondVars (bufAeval2, bufEvaluation, A); 2415 TIMING_END_AND_PRINT (fac_fq_evaluation, 2416 "time for evaluation wrt diff second vars over Fq: "); 2388 2417 2389 2418 for (int j= 0; j < lengthAeval2; j++) … … 2460 2489 int minFactorsLength; 2461 2490 bool irred= false; 2491 TIMING_START (fac_fq_bi_factorizer); 2462 2492 factorizationWRTDifferentSecondVars (A, Aeval2, info, minFactorsLength,irred); 2463 2493 TIMING_END_AND_PRINT (fac_fq_bi_factorizer, 2494 "time for bivariate factorization wrt diff second vars over Fq: "); 2495 2496 TIMING_END_AND_PRINT (fac_fq_bifactor_total, 2497 "total time for eval and bivar factors over Fq: "); 2464 2498 if (irred) 2465 2499 { … … 2532 2566 2533 2567 Variable v; 2568 TIMING_START (fac_fq_precompute_leadcoeff); 2534 2569 CFList leadingCoeffs= precomputeLeadingCoeff (LC (A, 1), biFactorsLCs, alpha, 2535 2570 evaluation, Aeval2, lengthAeval2, v); … … 2631 2666 } 2632 2667 } 2668 TIMING_END_AND_PRINT(fac_fq_precompute_leadcoeff, 2669 "time to precompute LC over Fq: "); 2670 2671 TIMING_START (fac_fq_luckswang); 2633 2672 CFList bufFactors= CFList(); 2634 2673 bool LCheuristic= false; … … 2658 2697 delete [] index; 2659 2698 delete [] Aeval2; 2699 TIMING_END_AND_PRINT (fac_fq_luckswang, 2700 "time for successful LucksWang over Fq: "); 2660 2701 return factors; 2661 2702 } … … 2997 3038 delete [] index; 2998 3039 } 2999 3040 TIMING_END_AND_PRINT (fac_fq_luckswang, "time for LucksWang over Fq: "); 3041 3042 TIMING_START (fac_fq_lcheuristic); 3000 3043 if (!LCheuristic && !LCmultiplierIsConst && bufFactors.isEmpty() 3001 3044 && fdivides (getVars (LCmultiplier), testVars)) … … 3147 3190 } 3148 3191 } 3192 TIMING_END_AND_PRINT (fac_fq_lcheuristic, "time for Lc heuristic over Fq: "); 3149 3193 3150 3194 tryAgainWithoutHeu: 3195 TIMING_START (fac_fq_shift_to_zero); 3151 3196 A= shift2Zero (A, Aeval, evaluation); 3152 3197 … … 3167 3212 } 3168 3213 } 3214 TIMING_END_AND_PRINT (fac_fq_shift_to_zero, 3215 "time to shift evaluation point to zero: "); 3169 3216 3170 3217 CFArray Pi; … … 3177 3224 Aeval.removeFirst(); 3178 3225 bool noOneToOne= false; 3226 TIMING_START (fac_fq_hensel_lift); 3179 3227 factors= nonMonicHenselLift (Aeval, biFactors, leadingCoeffs2, diophant, 3180 3228 Pi, liftBounds, liftBoundsLength, noOneToOne); 3229 TIMING_END_AND_PRINT (fac_fq_hensel_lift, 3230 "time for non monic hensel lifting over Fq: "); 3181 3231 3182 3232 if (!noOneToOne) … … 3184 3234 int check= factors.length(); 3185 3235 A= oldA; 3236 TIMING_START (fac_fq_recover_factors); 3186 3237 factors= recoverFactors (A, factors, evaluation); 3238 TIMING_END_AND_PRINT (fac_fq_recover_factors, 3239 "time to recover factors over Fq: "); 3187 3240 if (check != factors.length()) 3188 3241 noOneToOne= true; … … 3243 3296 (A, MOD, liftBounds, earlySuccess, earlyFactors, 3244 3297 Aeval, biFactors, evaluation, info); 3245 TIMING_END_AND_PRINT (fac_fq_hensel_lift, "time for hensel lifting: "); 3298 TIMING_END_AND_PRINT (fac_fq_hensel_lift, 3299 "time for hensel lifting over Fq: "); 3246 3300 3247 3301 if (!extension) -
factory/facFqFactorize.h
r2a95b2 r0851b0 15 15 #define FAC_FQ_FACTORIZE_H 16 16 17 // #include "config.h" 17 #include "config.h" 18 #include "timing.h" 18 19 19 20 #include "facFqBivar.h" … … 23 24 #include "facFqSquarefree.h" 24 25 #include "facFqBivarUtil.h" 26 27 28 TIMING_DEFINE_PRINT (fac_fq_squarefree) 29 TIMING_DEFINE_PRINT (fac_fq_factor_squarefree) 25 30 26 31 /// Factorization over a finite field … … 150 155 Variable a= Variable (1); 151 156 CanonicalForm LcF= Lc (F); 157 TIMING_START (fac_fq_squarefree); 152 158 CFFList sqrf= FpSqrf (F, false); 159 TIMING_END_AND_PRINT (fac_fq_squarefree, 160 "time for squarefree factorization over Fq: "); 153 161 CFFList result; 154 162 CFList bufResult; … … 157 165 for (CFFListIterator iter= sqrf; iter.hasItem(); iter++) 158 166 { 167 TIMING_START (fac_fq_factor_squarefree); 159 168 bufResult= multiFactorize (iter.getItem().factor(), info); 169 TIMING_END_AND_PRINT (fac_fq_factor_squarefree, 170 "time to factorize sqrfree factor over Fq: "); 160 171 for (i= bufResult; i.hasItem(); i++) 161 172 result.append (CFFactor (i.getItem(), iter.getItem().exp())); … … 227 238 ExtensionInfo info= ExtensionInfo (alpha, false); 228 239 CanonicalForm LcF= Lc (F); 240 TIMING_START (fac_fq_squarefree); 229 241 CFFList sqrf= FqSqrf (F, alpha, false); 242 TIMING_END_AND_PRINT (fac_fq_squarefree, 243 "time for squarefree factorization over Fq: "); 230 244 CFFList result; 231 245 CFList bufResult; … … 234 248 for (CFFListIterator iter= sqrf; iter.hasItem(); iter++) 235 249 { 250 TIMING_START (fac_fq_factor_squarefree); 236 251 bufResult= multiFactorize (iter.getItem().factor(), info); 252 TIMING_END_AND_PRINT (fac_fq_factor_squarefree, 253 "time to factorize sqrfree factor over Fq: "); 237 254 for (i= bufResult; i.hasItem(); i++) 238 255 result.append (CFFactor (i.getItem(), iter.getItem().exp()));
Note: See TracChangeset
for help on using the changeset viewer.