Changeset 4ec288 in git for factory/facFqBivar.cc
- Timestamp:
- Apr 11, 2012, 3:11:20 PM (12 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 98adcdd62df51a4c6090574f59ad2b9a5d432d39
- Parents:
- 4bafa67969ab030397c6410e512aadf5574be0dc0a7d0ca68a61f160eb5b83774592a019ed99f025
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facFqBivar.cc
r4bafa67 r4ec288 30 30 #include "cf_random.h" 31 31 #include "facHensel.h" 32 #include "facMul.h" 32 33 #include "cf_map.h" 33 34 #include "cf_gcd_smallp.h" … … 35 36 #include "facFqBivar.h" 36 37 #include "cfNewtonPolygon.h" 38 #include "algext.h" 37 39 38 40 #ifdef HAVE_NTL … … 42 44 TIMING_DEFINE_PRINT(fac_hensel_lift12) 43 45 44 CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M )46 CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M, const modpk& b) 45 47 { 46 48 if (L.isEmpty()) … … 49 51 return mod (L.getFirst()(0, 1) , M); 50 52 else if (L.length() == 2) 51 return mod (mulNTL (L.getFirst()(0, 1),L.getLast()(0, 1) ), M);53 return mod (mulNTL (L.getFirst()(0, 1),L.getLast()(0, 1), b), M); 52 54 else 53 55 { … … 59 61 tmp1.append (i.getItem()); 60 62 tmp2= Difference (L, tmp1); 61 buf1= prodMod0 (tmp1, M );62 buf2= prodMod0 (tmp2, M );63 return mod (mulNTL (buf1,buf2 ), M);63 buf1= prodMod0 (tmp1, M, b); 64 buf2= prodMod0 (tmp2, M, b); 65 return mod (mulNTL (buf1,buf2, b), M); 64 66 } 65 67 } … … 143 145 { 144 146 Variable x= A.mvar(); 145 ASSERT (A.isUnivariate(), "univariate polynomial expected"); 147 ASSERT (A.isUnivariate() || A.inCoeffDomain(), 148 "univariate polynomial expected or constant expected"); 146 149 CFFList factorsA; 147 150 ZZ p= to_ZZ (getCharacteristic()); … … 149 152 if (GF) 150 153 { 151 Variable beta= rootOf (gf_mipo);152 154 int k= getGFDegree(); 153 155 char cGFName= gf_name; 156 CanonicalForm mipo= gf_mipo; 154 157 setCharacteristic (getCharacteristic()); 158 Variable beta= rootOf (mipo.mapinto()); 155 159 CanonicalForm buf= GF2FalphaRep (A, beta); 156 160 if (getCharacteristic() > 2) 157 161 { 158 ZZ_pX NTLMipo= convertFacCF2NTLZZpX ( gf_mipo);162 ZZ_pX NTLMipo= convertFacCF2NTLZZpX (mipo.mapinto()); 159 163 ZZ_pE::init (NTLMipo); 160 164 ZZ_pEX NTLA= convertFacCF2NTLZZ_pEX (buf, NTLMipo); … … 167 171 else 168 172 { 169 GF2X NTLMipo= convertFacCF2NTLGF2X ( gf_mipo);173 GF2X NTLMipo= convertFacCF2NTLGF2X (mipo.mapinto()); 170 174 GF2E::init (NTLMipo); 171 175 GF2EX NTLA= convertFacCF2NTLGF2EX (buf, NTLMipo); … … 268 272 269 273 DEBOUTLN (cerr, "LC (F, 1)*prodMod (factors, M) == F " << 270 ( LC (F, 1)*prodMod (factors, M) == F));274 (mod (LC (F, 1)*prodMod (factors, M), M)/Lc (mod (LC (F, 1)*prodMod (factors, M), M)) == F/Lc (F))); 271 275 int degMipoBeta= 1; 272 276 if (!k && beta.level() != 1) … … 449 453 factorRecombination (CFList& factors, CanonicalForm& F, 450 454 const CanonicalForm& N, DegreePattern& degs, int s, 451 int thres 455 int thres, const modpk& b 452 456 ) 453 457 { … … 463 467 return result; 464 468 } 465 DEBOUTLN (cerr, "LC (F, 1)*prodMod (factors, N) == F " << 466 (LC (F, 1)*prodMod (factors, N) == F)); 469 #ifdef DEBUGOUTPUT 470 if (b.getp() == 0) 471 DEBOUTLN (cerr, "LC (F, 1)*prodMod (factors, N) == F " << 472 (mod (LC (F, 1)*prodMod (factors, N),N)/Lc (mod (LC (F, 1)*prodMod (factors, N),N)) == F/Lc(F))); 473 else 474 DEBOUTLN (cerr, "LC (F, 1)*prodMod (factors, N) == F " << 475 (mod (b(LC (F, 1)*prodMod (factors, N)),N)/Lc (mod (b(LC (F, 1)*prodMod (factors, N)),N)) == F/Lc(F))); 476 #endif 467 477 CFList T, S; 468 478 … … 486 496 bool recombination= false; 487 497 CanonicalForm test; 488 CanonicalForm buf0= buf (0, x)*LCBuf; 498 bool isRat= (isOn (SW_RATIONAL) && getCharacteristic() == 0) || getCharacteristic() > 0; 499 if (!isRat) 500 On (SW_RATIONAL); 501 CanonicalForm buf0= mulNTL (buf (0, x), LCBuf); 502 if (!isRat) 503 Off (SW_RATIONAL); 504 buf0= buf(0,x)*LCBuf; 489 505 while (T.length() >= 2*s && s <= thres) 490 506 { … … 498 514 T.insert (LCBuf); 499 515 g= prodMod (T, M); 516 if (b.getp() != 0) 517 g= b(g); 500 518 T.removeFirst(); 501 519 result.append (g/content (g, x)); … … 518 536 else 519 537 { 538 if (!isRat) 539 On (SW_RATIONAL); 520 540 test= prodMod0 (S, M); 521 test *= LCBuf; 522 test = mod (test, M); 523 if (fdivides (test, buf0)) 524 { 541 if (!isRat) 542 { 543 test *= bCommonDen (test); 544 Off (SW_RATIONAL); 545 } 546 test= mulNTL (test, LCBuf, b); 547 test= mod (test, M); 548 if (uniFdivides (test, buf0)) 549 { 550 if (!isRat) 551 On (SW_RATIONAL); 525 552 S.insert (LCBuf); 526 553 g= prodMod (S, M); 527 554 S.removeFirst(); 555 if (!isRat) 556 { 557 g *= bCommonDen(g); 558 Off (SW_RATIONAL); 559 } 560 if (b.getp() != 0) 561 g= b(g); 562 if (!isRat) 563 On (SW_RATIONAL); 528 564 g /= content (g, x); 529 565 if (fdivides (g, buf, quot)) … … 536 572 l -= degree (g); 537 573 M= power (y, l); 538 buf0= buf (0, x)*LCBuf; 574 buf0= mulNTL (buf (0, x), LCBuf); 575 if (!isRat) 576 Off (SW_RATIONAL); 539 577 // compute new possible degree pattern 540 578 bufDegs2= DegreePattern (T); … … 562 600 if (nosubset) break; 563 601 } 602 if (!isRat) 603 Off (SW_RATIONAL); 564 604 } 565 605 } … … 638 678 earlyFactorDetection (CFList& reconstructedFactors, CanonicalForm& F, CFList& 639 679 factors, int& adaptedLiftBound, int*& factorsFoundIndex, 640 DegreePattern& degs, bool& success, int deg) 680 DegreePattern& degs, bool& success, int deg, 681 const modpk& b) 641 682 { 642 683 DegreePattern bufDegs1= degs; … … 650 691 adaptedLiftBound= 0; 651 692 int d= degree (F), l= 0; 693 bool isRat= (isOn (SW_RATIONAL) && getCharacteristic() == 0) || getCharacteristic() > 0; 694 if (!isRat) 695 On (SW_RATIONAL); 696 CanonicalForm buf0= mulNTL (buf (0,x), LCBuf); 697 CanonicalForm buf1= mulNTL (buf (1,x), LCBuf); 698 if (!isRat) 699 Off (SW_RATIONAL); 700 CanonicalForm test0, test1; 701 652 702 for (CFListIterator i= factors; i.hasItem(); i++, l++) 653 703 { … … 656 706 else 657 707 { 658 g= mulMod2 (i.getItem(), LCBuf, M); 659 g /= content (g, x); 660 if (fdivides (g, buf, quot)) 661 { 662 reconstructedFactors.append (g); 663 factorsFoundIndex[l]= 1; 664 buf= quot; 665 d -= degree (g); 666 LCBuf= LC (buf, x); 667 T= Difference (T, CFList (i.getItem())); 668 F= buf; 669 670 // compute new possible degree pattern 671 bufDegs2= DegreePattern (T); 672 bufDegs1.intersect (bufDegs2); 673 bufDegs1.refine (); 674 if (bufDegs1.getLength() <= 1) 675 { 676 reconstructedFactors.append (buf); 677 break; 708 test1= mod (mulNTL (i.getItem() (1,x), LCBuf, b), M); 709 if (uniFdivides (test1, buf1)) 710 { 711 test0= mod (mulNTL (i.getItem() (0,x), LCBuf, b), M); 712 if (uniFdivides (test0, buf0)) 713 { 714 if (!isRat) 715 On (SW_RATIONAL); 716 g= mulMod2 (i.getItem(), LCBuf, M); 717 if (!isRat) 718 { 719 g *= bCommonDen(g); 720 Off (SW_RATIONAL); 721 } 722 if (b.getp() != 0) 723 g= b(g); 724 if (!isRat) 725 On (SW_RATIONAL); 726 g /= content (g, x); 727 if (fdivides (g, buf, quot)) 728 { 729 reconstructedFactors.append (g); 730 factorsFoundIndex[l]= 1; 731 buf= quot; 732 d -= degree (g); 733 LCBuf= LC (buf, x); 734 buf0= mulNTL (buf (0,x), LCBuf); 735 buf1= mulNTL (buf (1,x), LCBuf); 736 if (!isRat) 737 Off (SW_RATIONAL); 738 T= Difference (T, CFList (i.getItem())); 739 F= buf; 740 741 // compute new possible degree pattern 742 bufDegs2= DegreePattern (T); 743 bufDegs1.intersect (bufDegs2); 744 bufDegs1.refine (); 745 if (bufDegs1.getLength() <= 1) 746 { 747 reconstructedFactors.append (buf); 748 break; 749 } 750 } 751 if (!isRat) 752 Off (SW_RATIONAL); 678 753 } 679 754 } … … 859 934 earlyFactors, DegreePattern& degs, int& liftBound, 860 935 const CFList& uniFactors, const ExtensionInfo& info, 861 const CanonicalForm& eval )936 const CanonicalForm& eval, modpk& b) 862 937 { 863 938 Variable alpha= info.getAlpha(); … … 875 950 CFList diophant; 876 951 CFList bufUniFactors= uniFactors; 952 CanonicalForm bufA= A; 953 CanonicalForm lcA0= 0; 954 bool mipoHasDen= false; 955 if (getCharacteristic() == 0 && b.getp() != 0) 956 { 957 if (alpha.level() == 1) 958 { 959 lcA0= lc (A (0, 2)); 960 A *= b.inverse (lcA0); 961 A= b (A); 962 for (CFListIterator i= bufUniFactors; i.hasItem(); i++) 963 i.getItem()= b (i.getItem()*b.inverse (lc (i.getItem()))); 964 } 965 else 966 { 967 lcA0= Lc (A (0,2)); 968 On (SW_RATIONAL); 969 mipoHasDen= !bCommonDen(getMipo(alpha)).isOne(); 970 Off (SW_RATIONAL); 971 CanonicalForm lcA0inverse= b.inverse (lcA0); 972 A *= lcA0inverse; 973 A= b (A); 974 // Lc of bufUniFactors is in Z 975 for (CFListIterator i= bufUniFactors; i.hasItem(); i++) 976 i.getItem()= b (i.getItem()*b.inverse (lc (i.getItem()))); 977 } 978 } 877 979 bufUniFactors.insert (LC (A, x)); 878 980 CFMatrix M= CFMatrix (liftBound, bufUniFactors.length() - 1); … … 885 987 for (int i= 0; i < uniFactors.length(); i++) 886 988 factorsFoundIndex [i]= 0; 887 CanonicalForm bufA= A; 888 989 990 CFList bufBufUniFactors; 991 Variable v= alpha; 889 992 if (smallFactorDeg >= liftBound || degree (A,y) <= 4) 890 henselLift12 (A, bufUniFactors, liftBound, Pi, diophant, M );993 henselLift12 (A, bufUniFactors, liftBound, Pi, diophant, M, b, true); 891 994 else if (sizeOfLiftPre > 1 && sizeOfLiftPre < 30) 892 995 { 893 henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M); 996 henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M, b, true); 997 if (mipoHasDen) 998 { 999 for (CFListIterator iter= bufUniFactors; iter.hasItem(); iter++) 1000 if (hasFirstAlgVar (iter.getItem(), v)) 1001 break; 1002 if (v != alpha) 1003 { 1004 bufBufUniFactors= bufUniFactors; 1005 for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++) 1006 iter.getItem()= replacevar (iter.getItem(), v, alpha); 1007 A= replacevar (A, alpha, v); 1008 } 1009 } 1010 894 1011 if (!extension) 895 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 896 factorsFoundIndex, degs, earlySuccess, 897 smallFactorDeg); 1012 { 1013 if (v==alpha) 1014 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 1015 factorsFoundIndex, degs, earlySuccess, 1016 smallFactorDeg, b); 1017 else 1018 earlyFactorDetection(earlyFactors, bufA, bufBufUniFactors, newLiftBound, 1019 factorsFoundIndex, degs, earlySuccess, 1020 smallFactorDeg, b); 1021 } 898 1022 else 899 1023 extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, … … 907 1031 bufUniFactors.insert (LC (A, x)); 908 1032 henselLiftResume12 (A, bufUniFactors, smallFactorDeg, 909 liftPre[sizeOfLiftPre-1] + 1, Pi, diophant, M); 1033 liftPre[sizeOfLiftPre-1] + 1, Pi, diophant, M, b); 1034 if (v!=alpha) 1035 { 1036 bufBufUniFactors= bufUniFactors; 1037 for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++) 1038 iter.getItem()= replacevar (iter.getItem(), v, alpha); 1039 } 910 1040 if (!extension) 1041 { 1042 if (v==alpha) 911 1043 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 912 1044 factorsFoundIndex, degs, earlySuccess, 913 liftPre[sizeOfLiftPre-1] + 1); 1045 liftPre[sizeOfLiftPre-1] + 1, b); 1046 else 1047 earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound, 1048 factorsFoundIndex, degs, earlySuccess, 1049 liftPre[sizeOfLiftPre-1] + 1, b); 1050 } 914 1051 else 915 extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors,newLiftBound,1052 extEarlyFactorDetection (earlyFactors,bufA,bufUniFactors,newLiftBound, 916 1053 factorsFoundIndex, degs, earlySuccess, info, 917 1054 eval, liftPre[sizeOfLiftPre-1] + 1); … … 928 1065 bufUniFactors.insert (LC (A, x)); 929 1066 henselLiftResume12 (A, bufUniFactors, liftPre[i] + 1, 930 liftPre[i-1] + 1, Pi, diophant, M); 1067 liftPre[i-1] + 1, Pi, diophant, M, b); 1068 if (v!=alpha) 1069 { 1070 bufBufUniFactors= bufUniFactors; 1071 for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++) 1072 iter.getItem()= replacevar (iter.getItem(), v, alpha); 1073 } 931 1074 if (!extension) 1075 { 1076 if (v==alpha) 932 1077 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 933 1078 factorsFoundIndex, degs, earlySuccess, 934 liftPre[i-1] + 1); 1079 liftPre[i-1] + 1, b); 1080 else 1081 earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound, 1082 factorsFoundIndex, degs, earlySuccess, 1083 liftPre[i-1] + 1, b); 1084 } 935 1085 else 936 extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors,newLiftBound,1086 extEarlyFactorDetection (earlyFactors,bufA,bufUniFactors,newLiftBound, 937 1087 factorsFoundIndex, degs, earlySuccess, info, 938 1088 eval, liftPre[i-1] + 1); … … 951 1101 else 952 1102 { 953 henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M); 1103 henselLift12 (A, bufUniFactors, smallFactorDeg, Pi, diophant, M, b, true); 1104 if (mipoHasDen) 1105 { 1106 for (CFListIterator iter= bufUniFactors; iter.hasItem(); iter++) 1107 if (hasFirstAlgVar (iter.getItem(), v)) 1108 break; 1109 if (v != alpha) 1110 { 1111 bufBufUniFactors= bufUniFactors; 1112 for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++) 1113 iter.getItem()= replacevar (iter.getItem(), v, alpha); 1114 A= replacevar (A, alpha, v); 1115 } 1116 } 954 1117 if (!extension) 1118 { 1119 if (v==alpha) 955 1120 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 956 1121 factorsFoundIndex, degs, earlySuccess, 957 smallFactorDeg); 1122 smallFactorDeg, b); 1123 else 1124 earlyFactorDetection (earlyFactors, bufA, bufBufUniFactors, newLiftBound, 1125 factorsFoundIndex, degs, earlySuccess, 1126 smallFactorDeg, b); 1127 } 958 1128 else 959 1129 extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, … … 968 1138 bufUniFactors.insert (LC (A, x)); 969 1139 henselLiftResume12 (A, bufUniFactors, smallFactorDeg, 970 dummy, Pi, diophant, M); 1140 dummy, Pi, diophant, M, b); 1141 if (v!=alpha) 1142 { 1143 bufBufUniFactors= bufUniFactors; 1144 for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++) 1145 iter.getItem()= replacevar (iter.getItem(), v, alpha); 1146 } 971 1147 if (!extension) 1148 { 1149 if (v==alpha) 972 1150 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 973 factorsFoundIndex, degs, earlySuccess, dummy); 1151 factorsFoundIndex, degs, earlySuccess, dummy, b); 1152 else 1153 earlyFactorDetection (earlyFactors, bufA,bufBufUniFactors, newLiftBound, 1154 factorsFoundIndex, degs, earlySuccess, dummy, b); 1155 } 974 1156 else 975 extEarlyFactorDetection (earlyFactors, bufA, 1157 extEarlyFactorDetection (earlyFactors, bufA,bufUniFactors, newLiftBound, 976 1158 factorsFoundIndex, degs, earlySuccess, info, 977 1159 eval, dummy); … … 984 1166 dummy= tmin (degree (A,y)+1, (degree (A,y)/4)*(i+1)+4); 985 1167 henselLiftResume12 (A, bufUniFactors, (degree (A,y)/4)*i + 4, 986 dummy, Pi, diophant, M); 1168 dummy, Pi, diophant, M, b); 1169 if (v!=alpha) 1170 { 1171 bufBufUniFactors= bufUniFactors; 1172 for (CFListIterator iter= bufBufUniFactors; iter.hasItem(); iter++) 1173 iter.getItem()= replacevar (iter.getItem(), v, alpha); 1174 } 987 1175 if (!extension) 1176 { 1177 if (v==alpha) 988 1178 earlyFactorDetection (earlyFactors, bufA, bufUniFactors, newLiftBound, 989 factorsFoundIndex, degs, earlySuccess, dummy); 1179 factorsFoundIndex, degs, earlySuccess, dummy,b); 1180 else 1181 earlyFactorDetection (earlyFactors,bufA,bufBufUniFactors,newLiftBound, 1182 factorsFoundIndex, degs, earlySuccess, dummy,b); 1183 } 990 1184 else 991 extEarlyFactorDetection (earlyFactors, bufA, bufUniFactors,newLiftBound,1185 extEarlyFactorDetection (earlyFactors,bufA,bufUniFactors,newLiftBound, 992 1186 factorsFoundIndex, degs, earlySuccess, info, 993 1187 eval, dummy); … … 1016 1210 1017 1211 return bufUniFactors; 1212 } 1213 1214 CFList 1215 henselLiftAndEarly (CanonicalForm& A, bool& earlySuccess, CFList& 1216 earlyFactors, DegreePattern& degs, int& liftBound, 1217 const CFList& uniFactors, const ExtensionInfo& info, 1218 const CanonicalForm& eval) 1219 { 1220 modpk dummy= modpk(); 1221 return henselLiftAndEarly (A, earlySuccess, earlyFactors, degs, liftBound, 1222 uniFactors, info, eval, dummy); 1018 1223 } 1019 1224 … … 1592 1797 { 1593 1798 if (A[ii].size() - 1 >= i) 1799 { 1594 1800 buf= getCoeffs (A[ii] [i], k); 1595 writeInMatrix (C, buf, ii + 1, 0); 1801 writeInMatrix (C, buf, ii + 1, 0); 1802 } 1596 1803 } 1597 1804 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); … … 1760 1967 buf= getCoeffs (A[ii] [i], k, l, degMipo, gamma, 0, *NTLMat); 1761 1968 } 1969 writeInMatrix (C, buf, ii + 1, 0); 1762 1970 } 1763 writeInMatrix (C, buf, ii + 1, 0);1764 1971 if (GF) 1765 1972 setCharacteristic (getCharacteristic(), degMipo, info.getGFName()); … … 1884 2091 1885 2092 if (A[ii].size() - 1 >= i) 2093 { 1886 2094 buf= getCoeffs (A[ii] [i], k); 1887 writeInMatrix (C, buf, ii + 1, 0); 2095 writeInMatrix (C, buf, ii + 1, 0); 2096 } 1888 2097 } 1889 2098 … … 2000 2209 { 2001 2210 if (A[ii].size() - 1 >= i) 2211 { 2002 2212 buf= getCoeffs (A[ii] [i], k, alpha); 2003 writeInMatrix (C, buf, ii + 1, 0); 2213 writeInMatrix (C, buf, ii + 1, 0); 2214 } 2004 2215 } 2005 2216 … … 2104 2315 { 2105 2316 if (A[ii].size() - 1 >= i) 2317 { 2106 2318 buf= getCoeffs (A[ii] [i], k); 2107 writeInMatrix (C, buf, ii + 1, 0); 2319 writeInMatrix (C, buf, ii + 1, 0); 2320 } 2108 2321 } 2109 2322 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); … … 2235 2448 { 2236 2449 if (A[ii].size() - 1 >= i) 2450 { 2237 2451 buf= getCoeffs (A[ii] [i], k); 2238 writeInMatrix (C, buf, ii + 1, 0); 2452 writeInMatrix (C, buf, ii + 1, 0); 2453 } 2239 2454 } 2240 2455 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); … … 2414 2629 buf= getCoeffs (A[ii] [i], k, l, degMipo, gamma, 0, *NTLMat); 2415 2630 } 2631 writeInMatrix (C, buf, ii + 1, 0); 2416 2632 } 2417 writeInMatrix (C, buf, ii + 1, 0);2418 2633 if (GF) 2419 2634 setCharacteristic (getCharacteristic(), degMipo, info.getGFName()); … … 2558 2773 { 2559 2774 if (A[ii].size() - 1 >= i) 2775 { 2560 2776 buf= getCoeffs (A[ii] [i], k); 2561 writeInMatrix (C, buf, ii + 1, 0); 2777 writeInMatrix (C, buf, ii + 1, 0); 2778 } 2562 2779 } 2563 2780 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); … … 2678 2895 { 2679 2896 if (A[ii].size() - 1 >= i) 2897 { 2680 2898 buf= getCoeffs (A[ii] [i], k, alpha); 2681 writeInMatrix (C, buf, ii + 1, 0); 2899 writeInMatrix (C, buf, ii + 1, 0); 2900 } 2682 2901 } 2683 2902 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); … … 2801 3020 { 2802 3021 if (A[ii].size() - 1 >= i) 3022 { 2803 3023 buf= getCoeffs (A[ii] [i], k); 2804 writeInMatrix (C, buf, ii + 1, 0); 3024 writeInMatrix (C, buf, ii + 1, 0); 3025 } 2805 3026 } 2806 3027 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); … … 2903 3124 { 2904 3125 if (A[ii].size() - 1 >= i) 3126 { 2905 3127 buf= getCoeffs (A[ii] [i], k); 2906 writeInMatrix (C, buf, ii + 1, 0); 3128 writeInMatrix (C, buf, ii + 1, 0); 3129 } 2907 3130 } 2908 3131 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); … … 3058 3281 buf= getCoeffs (A[ii] [i], k, oldL, degMipo, gamma, 0, *NTLMat); 3059 3282 } 3283 writeInMatrix (C, buf, ii + 1, 0); 3060 3284 } 3061 writeInMatrix (C, buf, ii + 1, 0);3062 3285 if (GF) 3063 3286 setCharacteristic (getCharacteristic(), degMipo, info.getGFName()); … … 3182 3405 { 3183 3406 if (A[ii].size() - 1 >= i) 3407 { 3184 3408 buf= getCoeffs (A[ii] [i], k, alpha); 3185 writeInMatrix (C, buf, ii + 1, 0); 3409 writeInMatrix (C, buf, ii + 1, 0); 3410 } 3186 3411 } 3187 3412 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); … … 3286 3511 { 3287 3512 if (A[ii].size() - 1 >= i) 3513 { 3288 3514 buf= getCoeffs (A[ii] [i], k); 3289 writeInMatrix (C, buf, ii + 1, 0); 3515 writeInMatrix (C, buf, ii + 1, 0); 3516 } 3290 3517 } 3291 3518 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); … … 3422 3649 { 3423 3650 if (A[ii].size() - 1 >= i) 3651 { 3424 3652 buf= getCoeffs (A[ii] [i], k); 3425 writeInMatrix (C, buf, ii + 1, 0); 3653 writeInMatrix (C, buf, ii + 1, 0); 3654 } 3426 3655 } 3427 3656 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); … … 3611 3840 buf= getCoeffs (A[ii] [i], k, l, degMipo, gamma, 0, *NTLMat); 3612 3841 } 3842 writeInMatrix (C, buf, ii + 1, 0); 3613 3843 } 3614 writeInMatrix (C, buf, ii + 1, 0);3615 3844 if (GF) 3616 3845 setCharacteristic (getCharacteristic(), degMipo, info.getGFName()); … … 3761 3990 CFArray buf; 3762 3991 if (A[ii].size() - 1 >= i) 3992 { 3763 3993 buf= getCoeffs (A[ii] [i], k, alpha); 3764 writeInMatrix (C, buf, ii + 1, 0); 3994 writeInMatrix (C, buf, ii + 1, 0); 3995 } 3765 3996 } 3766 3997 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); … … 4353 4584 bool success; 4354 4585 smallFactors= sieveSmallFactors (F, bufUniFactors, degs, H, diophant, Pi, M, 4355 success, 2*(minBound + 1)4586 success, minBound + 1 4356 4587 ); 4357 4588 … … 4478 4709 { 4479 4710 if (alpha.level() == 1) 4480 oldL= liftAndComputeLattice (F, bounds, d, 2*(minBound + 1), liftBound,4711 oldL= liftAndComputeLattice (F, bounds, d, minBound + 1, liftBound, 4481 4712 minBound, bufUniFactors, NTLN, diophant, M, 4482 4713 Pi, bufQ, irreducible … … 4485 4716 { 4486 4717 if (reduceFq2Fp) 4487 oldL= liftAndComputeLatticeFq2Fp (F, bounds, d, 2*(minBound + 1),4718 oldL= liftAndComputeLatticeFq2Fp (F, bounds, d, minBound + 1, 4488 4719 liftBound, minBound, bufUniFactors, 4489 4720 NTLN, diophant, M, Pi, bufQ, … … 4491 4722 ); 4492 4723 else 4493 oldL= liftAndComputeLattice (F, bounds, d, 2*(minBound + 1), liftBound,4724 oldL= liftAndComputeLattice (F, bounds, d, minBound + 1, liftBound, 4494 4725 minBound, bufUniFactors, NTLNe, diophant, 4495 4726 M, Pi, bufQ, irreducible … … 5595 5826 TIMING_END_AND_PRINT (fac_uni_factorizer, 5596 5827 "time for univariate factorization in y: "); 5597 DEBOUTLN (cerr, "Lc ( Aeval2)*prod (uniFactors2)==Aeval2 " <<5828 DEBOUTLN (cerr, "Lc (bufAeval2)*prod (bufUniFactors2)== bufAeval2 " << 5598 5829 (prod (bufUniFactors2)*Lc (bufAeval2) == bufAeval2)); 5599 5830 } … … 5955 6186 factors= biFactorize (A, info2); 5956 6187 5957 Variable vBuf= rootOf (gf_mipo);6188 CanonicalForm mipo= gf_mipo; 5958 6189 setCharacteristic (getCharacteristic()); 6190 Variable vBuf= rootOf (mipo.mapinto()); 5959 6191 for (CFListIterator j= factors; j.hasItem(); j++) 5960 6192 j.getItem()= GF2FalphaRep (j.getItem(), vBuf); … … 6035 6267 // pass to GF(p^k+1) 6036 6268 { 6269 CanonicalForm mipo= gf_mipo; 6037 6270 setCharacteristic (p); 6038 Variable vBuf= rootOf ( gf_mipo);6271 Variable vBuf= rootOf (mipo.mapinto()); 6039 6272 A= GF2FalphaRep (A, vBuf); 6040 6273 setCharacteristic (p, extensionDeg, 'Z'); … … 6044 6277 else // not able to pass to another GF, pass to F_p(\alpha) 6045 6278 { 6279 CanonicalForm mipo= gf_mipo; 6046 6280 setCharacteristic (p); 6047 Variable vBuf= rootOf ( gf_mipo);6281 Variable vBuf= rootOf (mipo.mapinto()); 6048 6282 A= GF2FalphaRep (A, vBuf); 6049 6283 Variable v= chooseExtension (vBuf, beta, k); … … 6064 6298 else // not able to pass to GF (p^2k), pass to F_p (\alpha) 6065 6299 { 6300 CanonicalForm mipo= gf_mipo; 6066 6301 setCharacteristic (p); 6067 Variable v1= rootOf ( gf_mipo);6302 Variable v1= rootOf (mipo.mapinto()); 6068 6303 A= GF2FalphaRep (A, v1); 6069 6304 Variable v2= chooseExtension (v1, v1, k);
Note: See TracChangeset
for help on using the changeset viewer.