Changeset 1130ffc in git for factory/cf_gcd_smallp.cc
- Timestamp:
- Oct 25, 2012, 2:25:59 PM (12 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 139f6f800b915490dfaa914ef7676d29a3236b92186df6b3fe891f605e0e3e7324333e7713165436
- Parents:
- becbea965e6c5de8e8ab195c7f480cabc295ac0cd91423947d67c2ab2eaf1aae4a61f9f2988e9510
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_gcd_smallp.cc
rbecbea r1130ffc 45 45 TIMING_DEFINE_PRINT(gcd_recursion) 46 46 TIMING_DEFINE_PRINT(newton_interpolation) 47 TIMING_DEFINE_PRINT(termination_test) 48 TIMING_DEFINE_PRINT(ez_p_compress) 49 TIMING_DEFINE_PRINT(ez_p_hensel_lift) 50 TIMING_DEFINE_PRINT(ez_p_eval) 51 TIMING_DEFINE_PRINT(ez_p_content) 47 52 48 53 bool … … 797 802 if ((uni_lcoeff (H) == gcdlcAlcB) || (G_m == H)) 798 803 { 804 TIMING_START (termination_test); 799 805 if (gcdlcAlcB.isOne()) 800 806 cH= 1; … … 831 837 coF= N ((cA/gcdcAcB)*ppCoF); 832 838 coG= N ((cB/gcdcAcB)*ppCoG); 839 TIMING_END_AND_PRINT (termination_test, 840 "time for successful termination test Fq: "); 833 841 return N(gcdcAcB*ppH); 834 842 } … … 846 854 } 847 855 coF= N ((cA/gcdcAcB)*ppCoF); 848 coG= N ((cB/gcdcAcB)*ppCoG);; 856 coG= N ((cB/gcdcAcB)*ppCoG); 857 TIMING_END_AND_PRINT (termination_test, 858 "time for successful termination test Fq: "); 849 859 return N(gcdcAcB*ppH); 850 860 } 861 TIMING_END_AND_PRINT (termination_test, 862 "time for unsuccessful termination test Fq: "); 851 863 } 852 864 … … 1237 1249 if ((uni_lcoeff (H) == gcdlcAlcB) || (G_m == H)) 1238 1250 { 1251 TIMING_START (termination_test); 1239 1252 if (gcdlcAlcB.isOne()) 1240 1253 cH= 1; … … 1270 1283 coG= N ((cB/gcdcAcB)*ppCoG); 1271 1284 setCharacteristic (p, k, gf_name_buf); 1285 TIMING_END_AND_PRINT (termination_test, 1286 "time for successful termination GF: "); 1272 1287 return N(gcdcAcB*ppH); 1273 1288 } … … 1288 1303 coF= N ((cA/gcdcAcB)*ppCoF); 1289 1304 coG= N ((cB/gcdcAcB)*ppCoG); 1305 TIMING_END_AND_PRINT (termination_test, 1306 "time for successful termination GF: "); 1290 1307 return N(gcdcAcB*ppH); 1291 1308 } 1292 1309 } 1310 TIMING_END_AND_PRINT (termination_test, 1311 "time for unsuccessful termination GF: "); 1293 1312 } 1294 1313 … … 1744 1763 if ((uni_lcoeff (H) == gcdlcAlcB) || (G_m == H)) 1745 1764 { 1765 TIMING_START (termination_test); 1746 1766 if (gcdlcAlcB.isOne()) 1747 1767 cH= 1; … … 1769 1789 coF= N ((cA/gcdcAcB)*ppCoF); 1770 1790 coG= N ((cB/gcdcAcB)*ppCoG); 1791 TIMING_END_AND_PRINT (termination_test, 1792 "time for successful termination Fp: "); 1771 1793 return N(gcdcAcB*ppH); 1772 1794 } 1795 TIMING_END_AND_PRINT (termination_test, 1796 "time for unsuccessful termination Fp: "); 1773 1797 } 1774 1798 … … 4450 4474 CFMap M,N; 4451 4475 int smallestDegLev; 4476 TIMING_START (ez_p_compress) 4452 4477 int best_level= compress4EZGCD (F, G, M, N, smallestDegLev); 4453 4478 … … 4456 4481 F= M (F); 4457 4482 G= M (G); 4458 4483 TIMING_END_AND_PRINT (ez_p_compress, "time for compression in EZ_P: ") 4484 4485 TIMING_START (ez_p_content) 4459 4486 f = content( F, x ); g = content( G, x ); 4460 4487 d = gcd( f, g ); 4461 4488 F /= f; G /= g; 4489 TIMING_END_AND_PRINT (ez_p_content, "time to extract content in EZ_P: ") 4462 4490 4463 4491 if( F.isUnivariate() && G.isUnivariate() ) … … 4598 4626 while( !gcdfound ) 4599 4627 { 4628 TIMING_START (ez_p_eval); 4600 4629 if( !findeval_P( F, G, Fb, Gb, Db, b, delta, degF, degG, maxeval, count, o, 4601 4630 maxeval/maxNumVars, t )) … … 4620 4649 return N (d*result); 4621 4650 } 4651 TIMING_END_AND_PRINT (ez_p_eval, "time for eval point search in EZ_P1: "); 4622 4652 delta = degree( Db ); 4623 4653 if( delta == 0 ) … … 4632 4662 { 4633 4663 bt = b; 4664 TIMING_START (ez_p_eval); 4634 4665 if( !findeval_P(F,G,Fbt,Gbt,Dbt, bt, delta, degF, degG, maxeval, count, o, 4635 4666 maxeval/maxNumVars, t )) … … 4654 4685 return N (d*result); 4655 4686 } 4687 TIMING_END_AND_PRINT (ez_p_eval, "time for eval point search in EZ_P2: "); 4656 4688 int dd = degree( Dbt ); 4657 4689 if( dd == 0 ) … … 4807 4839 } 4808 4840 4841 TIMING_START (ez_p_hensel_lift); 4809 4842 gcdfound= Hensel_P (B*lcD, DD, b, lcDD); 4810 4811 if (gcdfound == -1) 4812 { 4813 Off (SW_USE_EZGCD_P); 4814 result= gcd (F,G); 4815 On (SW_USE_EZGCD_P); 4816 if (passToGF) 4817 { 4818 CanonicalForm mipo= gf_mipo; 4819 setCharacteristic (p); 4820 Variable alpha= rootOf (mipo.mapinto()); 4821 result= GF2FalphaRep (result, alpha); 4843 TIMING_END_AND_PRINT (ez_p_hensel_lift, "time for Hensel lift in EZ_P: "); 4844 4845 if (gcdfound == -1) //things became dense 4846 { 4847 if (algExtension) 4848 { 4849 result= GCD_Fp_extension (F, G, a); 4850 if (extOfExt) 4851 result= mapDown (result, primElem, imPrimElem, oldA, dest, source); 4852 return N (d*result); 4822 4853 } 4823 if (k > 1) 4824 { 4825 result= GFMapDown (result, k); 4826 setCharacteristic (p, k, gf_name); 4854 if (CFFactory::gettype() == GaloisFieldDomain) 4855 { 4856 result= GCD_GF (F, G); 4857 if (passToGF) 4858 { 4859 CanonicalForm mipo= gf_mipo; 4860 setCharacteristic (p); 4861 Variable alpha= rootOf (mipo.mapinto()); 4862 result= GF2FalphaRep (result, alpha); 4863 } 4864 if (k > 1) 4865 { 4866 result= GFMapDown (result, k); 4867 setCharacteristic (p, k, gf_name); 4868 } 4869 return N (d*result); 4827 4870 } 4828 if (extOfExt) 4829 result= mapDown (result, primElem, imPrimElem, oldA, dest, source); 4830 return N (d*result); 4871 else 4872 return N (d*GCD_small_p (F,G)); 4831 4873 } 4832 4874 4833 4875 if (gcdfound == 1) 4834 4876 { 4877 TIMING_START (termination_test); 4835 4878 contcand= content (DD[2], Variable (1)); 4836 4879 cand = DD[2] / contcand; … … 4839 4882 else 4840 4883 gcdfound = fdivides( cand, F ) && cand*(DD[1]/(lcD/contcand)) == G; 4884 TIMING_END_AND_PRINT (termination_test, 4885 "time for termination test EZ_P: "); 4841 4886 4842 4887 if (passToGF && gcdfound)
Note: See TracChangeset
for help on using the changeset viewer.