Changeset 38ffb7 in git
- Timestamp:
- Sep 2, 2011, 11:41:32 AM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- 96f9fdfab406c4f1b69b407c26a25d199352b8c5
- Parents:
- 0349c206d67778742e0d31e4173c6f30b493a2a8
- Location:
- factory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facFactorize.cc
r0349c20 r38ffb7 36 36 bool found= false; 37 37 CanonicalForm deriv_x, gcd_deriv; 38 CFListIterator iter; 38 39 do 39 40 { … … 76 77 continue; 77 78 } 78 CFListIterator i= eval;79 i ++;80 CanonicalForm contentx= content (i .getItem(), x);79 iter= eval; 80 iter++; 81 CanonicalForm contentx= content (iter.getItem(), x); 81 82 if (degree (contentx) > 0) 82 83 { … … 103 104 minFactorsLength= 0; 104 105 irred= false; 106 Variable v; 107 CFList factors; 105 108 for (int j= 0; j < A.level() - 2; j++) 106 109 { 107 110 if (!Aeval[j].isEmpty()) 108 111 { 109 Variablev= Variable (Aeval[j].getFirst().level());110 111 CFListfactors= ratBiSqrfFactorize (Aeval[j].getFirst(), w);112 v= Variable (Aeval[j].getFirst().level()); 113 114 factors= ratBiSqrfFactorize (Aeval[j].getFirst(), w); 112 115 113 116 if (factors.getFirst().inCoeffDomain()) … … 135 138 CFFList*& bufSqrfFactors, CFList& evalSqrfPartF) 136 139 { 140 CanonicalForm tmp; 141 CFListIterator j; 137 142 for (CFListIterator i= uniFactors; i.hasItem(); i++) 138 143 { 139 CanonicalFormtmp= i.getItem();144 tmp= i.getItem(); 140 145 if (i.hasItem()) 141 146 i++; 142 147 else 143 148 break; 144 for ( CFListIteratorj= i; j.hasItem(); j++)149 for (j= i; j.hasItem(); j++) 145 150 { 146 151 if (tmp == j.getItem()) … … 167 172 int k= 0; 168 173 factors= uniFactors; 174 CFFListIterator iter; 169 175 for (CFListIterator i= factors; i.hasItem(); i++, k++) 170 176 { 171 CanonicalFormtmp= 1;177 tmp= 1; 172 178 sqrfFactors= sqrFree (i.getItem()); 173 179 174 for ( CFFListIterator j= sqrfFactors; j.hasItem(); j++)175 { 176 tmp2.append ( j.getItem().factor());177 tmp *= j.getItem().factor();180 for (iter= sqrfFactors; iter.hasItem(); iter++) 181 { 182 tmp2.append (iter.getItem().factor()); 183 tmp *= iter.getItem().factor(); 178 184 } 179 185 i.getItem()= tmp/Lc(tmp); … … 194 200 if (i == 0) 195 201 { 196 for (CFFListIterator k= bufSqrfFactors [i]; k.hasItem(); k++) 197 { 198 k.getItem()= CFFactor (k.getItem().factor()/Lc (k.getItem().factor()), 199 k.getItem().exp()); 200 factors.append (k.getItem().factor()); 202 for (iter= bufSqrfFactors [i]; iter.hasItem(); iter++) 203 { 204 iter.getItem()= CFFactor (iter.getItem().factor()/ 205 Lc (iter.getItem().factor()), 206 iter.getItem().exp()); 207 factors.append (iter.getItem().factor()); 201 208 } 202 209 } 203 210 else 204 211 { 205 for (CFFListIterator k= bufSqrfFactors [i]; k.hasItem(); k++) 206 { 207 k.getItem()= CFFactor (k.getItem().factor()/Lc (k.getItem().factor()), 208 k.getItem().exp()); 209 if (!find (factors, k.getItem().factor())) 210 factors.append (k.getItem().factor()); 212 for (iter= bufSqrfFactors [i]; iter.hasItem(); iter++) 213 { 214 iter.getItem()= CFFactor (iter.getItem().factor()/ 215 Lc (iter.getItem().factor()), 216 iter.getItem().exp()); 217 if (!find (factors, iter.getItem().factor())) 218 factors.append (iter.getItem().factor()); 211 219 } 212 220 } … … 214 222 215 223 test= prod (factors); 216 CanonicalFormtmp= evalSqrfPartF.getFirst() (0,2);224 tmp= evalSqrfPartF.getFirst() (0,2); 217 225 if (test/Lc (test) != tmp/Lc (tmp)) 218 226 return 0; … … 258 266 else 259 267 { 268 CFListIterator j; 260 269 for (int i= 0; i < length; i++) 261 270 { 262 for ( CFListIteratorj= differentSecondVarLCs[i]; j.hasItem(); j++)271 for (j= differentSecondVarLCs[i]; j.hasItem(); j++) 263 272 { 264 273 if (j.getItem().level() == LCFLevel) … … 296 305 CFFList * bufSqrfFactors= new CFFList [factors.length()]; 297 306 CFList evalSqrfPartF; 298 CanonicalForm bufContent;299 307 CFList bufFactors; 300 308 //TODO sqrfPartF einmal berechnen nicht stÀndig … … 319 327 for (int i= 0; i < length; i++) 320 328 { 329 CanonicalForm bufF; 330 CFListIterator iter; 331 CFList bufBufFactors; 321 332 if (!differentSecondVarLCs [i].isEmpty()) 322 333 { 323 334 bool allConstant= true; 324 for (CFListIterator iter= differentSecondVarLCs[i]; iter.hasItem(); 325 iter++) 335 for (iter= differentSecondVarLCs[i]; iter.hasItem(); iter++) 326 336 { 327 337 if (!iter.getItem().inCoeffDomain()) … … 335 345 336 346 bufFactors= differentSecondVarLCs [i]; 337 for ( CFListIteratoriter= bufFactors; iter.hasItem(); iter++)347 for (iter= bufFactors; iter.hasItem(); iter++) 338 348 iter.getItem()= swapvar (iter.getItem(), x, y); 339 CanonicalFormbufF= F;349 bufF= F; 340 350 z= Variable (y.level() - lev); 341 351 bufF= swapvar (bufF, x, z); 342 CFListbufBufFactors= bufFactors;352 bufBufFactors= bufFactors; 343 353 pass= testFactors (bufF, bufBufFactors, sqrfPartF, bufFactors, 344 354 bufSqrfFactors, evalSqrfPartF); … … 348 358 F= bufF; 349 359 CFList l= factors; 350 for ( CFListIteratoriter= l; iter.hasItem(); iter++)360 for (iter= l; iter.hasItem(); iter++) 351 361 iter.getItem()= swapvar (iter.getItem(), x, y); 352 362 differentSecondVarLCs [i]= l; … … 402 412 403 413 CFList result; 414 CFFListIterator k; 415 CanonicalForm tmp; 404 416 for (int i= 0; i < LCFFactors.length(); i++) 405 417 { 406 CanonicalFormtmp= 1;407 for ( CFFListIteratork= bufSqrfFactors[i]; k.hasItem(); k++)418 tmp= 1; 419 for (k= bufSqrfFactors[i]; k.hasItem(); k++) 408 420 { 409 421 int pos= findItem (bufFactors, k.getItem().factor()); -
factory/facFqBivar.cc
r0349c20 r38ffb7 961 961 Variable x= Variable (1); 962 962 CanonicalForm yToL= power (y, liftBound); 963 CanonicalForm quot; 963 CanonicalForm quot, buf; 964 CFListIterator iter; 964 965 for (long i= 1; i <= N.NumCols(); i++) 965 966 { 966 967 if (factorsFoundIndex [i - 1] == 1) 967 968 continue; 968 CFListIterator iter= factors; 969 CanonicalForm buf; 969 iter= factors; 970 970 if (beenInThres) 971 971 { … … 1016 1016 Variable y= Variable (2); 1017 1017 Variable x= Variable (1); 1018 CanonicalForm quot ;1018 CanonicalForm quot, buf; 1019 1019 CanonicalForm yToL= power (y, liftBound); 1020 CFListIterator iter; 1020 1021 for (long i= 1; i <= N.NumCols(); i++) 1021 1022 { 1022 1023 if (factorsFoundIndex [i - 1] == 1) 1023 1024 continue; 1024 CFListIterator iter= factors; 1025 CanonicalForm buf; 1025 iter= factors; 1026 1026 if (beenInThres) 1027 1027 { … … 1073 1073 CanonicalForm F= G; 1074 1074 CanonicalForm yToL= power (y, precision); 1075 CanonicalForm quot ;1076 CFList result ;1075 CanonicalForm quot, buf; 1076 CFList result, factorsConsidered; 1077 1077 CFList bufFactors= factors; 1078 CFList factorsConsidered;1078 CFListIterator iter; 1079 1079 for (long i= 1; i <= N.NumCols(); i++) 1080 1080 { 1081 1081 if (zeroOneVecs [i - 1] == 0) 1082 1082 continue; 1083 CFListIteratoriter= factors;1084 CanonicalFormbuf= 1;1083 iter= factors; 1084 buf= 1; 1085 1085 factorsConsidered= CFList(); 1086 1086 for (long j= 1; j <= N.NumRows(); j++, iter++) … … 1123 1123 CanonicalForm F= G; 1124 1124 CanonicalForm yToL= power (y, precision); 1125 CanonicalForm quot ;1125 CanonicalForm quot, buf, buf2; 1126 1126 CFList result; 1127 1127 CFList bufFactors= factors; 1128 1128 CFList factorsConsidered; 1129 CFListIterator iter; 1129 1130 for (long i= 1; i <= N.NumCols(); i++) 1130 1131 { 1131 1132 if (zeroOneVecs [i - 1] == 0) 1132 1133 continue; 1133 CFListIteratoriter= factors;1134 CanonicalFormbuf= 1;1134 iter= factors; 1135 buf= 1; 1135 1136 factorsConsidered= CFList(); 1136 1137 for (long j= 1; j <= N.NumRows(); j++, iter++) … … 1142 1143 } 1143 1144 } 1144 CanonicalFormbuf2= buf;1145 buf2= buf; 1145 1146 buf *= LC (F, x); 1146 1147 buf= mod (buf, yToL); … … 1183 1184 CFList bufFactors= factors; 1184 1185 CFList factorsConsidered; 1185 CanonicalForm buf2, quot; 1186 CanonicalForm buf2, quot, buf; 1187 CFListIterator iter; 1186 1188 for (long i= 1; i <= N.NumCols(); i++) 1187 1189 { 1188 1190 if (zeroOneVecs [i - 1] == 0) 1189 1191 continue; 1190 CFListIteratoriter= factors;1191 CanonicalFormbuf= 1;1192 iter= factors; 1193 buf= 1; 1192 1194 factorsConsidered= CFList(); 1193 1195 for (long j= 1; j <= N.NumRows(); j++, iter++) … … 1251 1253 CanonicalForm F= G; 1252 1254 CanonicalForm yToL= power (y, precision); 1253 CanonicalForm quot ;1255 CanonicalForm quot, buf; 1254 1256 CFList result; 1255 1257 CFList bufFactors= factors; 1256 1258 CFList factorsConsidered; 1259 CFListIterator iter; 1257 1260 for (long i= 1; i <= N.NumCols(); i++) 1258 1261 { 1259 1262 if (zeroOneVecs [i - 1] == 0) 1260 1263 continue; 1261 CFListIteratoriter= factors;1262 CanonicalFormbuf= 1;1264 iter= factors; 1265 buf= 1; 1263 1266 factorsConsidered= CFList(); 1264 1267 for (long j= 1; j <= N.NumRows(); j++, iter++) … … 1307 1310 CanonicalForm delta= info.getDelta(); 1308 1311 CanonicalForm yToL= power (y, liftBound); 1309 CanonicalForm quot ;1312 CanonicalForm quot, buf, buf2; 1310 1313 CFList source, dest; 1314 CFListIterator iter; 1311 1315 for (long i= 1; i <= N.NumCols(); i++) 1312 1316 { 1313 1317 if (factorsFoundIndex [i - 1] == 1) 1314 1318 continue; 1315 CFListIterator iter= factors; 1316 CanonicalForm buf; 1317 CanonicalForm buf2; 1319 iter= factors; 1318 1320 if (beenInThres) 1319 1321 { … … 1356 1358 else 1357 1359 { 1358 CFList source, dest;1359 1360 if (!isInExtension (buf2, gamma, k, delta, source, dest)) 1360 1361 { … … 1398 1399 int oldL= l/2; 1399 1400 bool reduced= false; 1401 mat_zz_p NTLK, *NTLC; 1402 CFMatrix C; 1403 CFArray buf; 1404 CFListIterator j; 1400 1405 while (l <= liftBound) 1401 1406 { 1402 1403 1407 if (start) 1404 1408 { … … 1415 1419 1416 1420 factors.insert (LCF); 1417 CFListIteratorj= factors;1421 j= factors; 1418 1422 j++; 1419 1423 … … 1421 1425 { 1422 1426 if (!wasInBounds) 1423 {1424 1427 A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ[i]); 1425 }1426 1428 else 1427 1429 A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i], bufQ[i]); … … 1434 1436 wasInBounds= true; 1435 1437 int k= tmin (bounds [i] + 1, l/2); 1436 C FMatrix C= CFMatrix (l - k, factors.length() - 1);1438 C= CFMatrix (l - k, factors.length() - 1); 1437 1439 for (int ii= 0; ii < factors.length() - 1; ii++) 1438 1440 { 1439 CFArray buf;1440 1441 if (A[ii].size() - 1 >= i) 1441 1442 buf= getCoeffs (A[ii] [i], k); 1442 1443 writeInMatrix (C, buf, ii + 1, 0); 1443 1444 } 1444 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);1445 mat_zz_pNTLK= (*NTLC)*NTLN;1445 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 1446 NTLK= (*NTLC)*NTLN; 1446 1447 transpose (NTLK, NTLK); 1447 1448 kernel (NTLK, NTLK); … … 1515 1516 int oldL= l/2; 1516 1517 bool reduced= false; 1518 Variable y= F.mvar(); 1519 Variable x= Variable (1); 1520 CanonicalForm powX, imBasis; 1521 CFMatrix Mat, C; 1522 CFArray buf; 1523 CFIterator iter; 1524 mat_zz_p* NTLMat, *NTLC, NTLK; 1525 CFListIterator j; 1517 1526 while (l <= liftBound) 1518 1527 { … … 1530 1539 } 1531 1540 1532 Variable y= F.mvar();1533 Variable x= Variable (1);1534 1535 1541 factors.insert (LCF); 1536 1542 … … 1538 1544 setCharacteristic (getCharacteristic()); 1539 1545 1540 CanonicalFormpowX= power (y-gamma, l);1541 CFMatrixMat= CFMatrix (l*degMipo, l*degMipo);1546 powX= power (y-gamma, l); 1547 Mat= CFMatrix (l*degMipo, l*degMipo); 1542 1548 for (int i= 0; i < l*degMipo; i++) 1543 1549 { 1544 1545 CanonicalForm imBasis= mod (power (y, i), powX); 1550 imBasis= mod (power (y, i), powX); 1546 1551 imBasis= imBasis (power (y, degMipo), y); 1547 1552 imBasis= imBasis (y, gamma); 1548 CFIteratoriter= imBasis;1553 iter= imBasis; 1549 1554 for (; iter.hasTerms(); iter++) 1550 1555 Mat (iter.exp()+ 1, i+1)= iter.coeff(); 1551 1556 } 1552 1557 1553 mat_zz_p*NTLMat= convertFacCFMatrix2NTLmat_zz_p (Mat);1558 NTLMat= convertFacCFMatrix2NTLmat_zz_p (Mat); 1554 1559 *NTLMat= inv (*NTLMat); 1555 1560 … … 1557 1562 setCharacteristic (getCharacteristic(), degMipo, info.getGFName()); 1558 1563 1559 CFListIteratorj= factors;1564 j= factors; 1560 1565 j++; 1561 1566 … … 1574 1579 wasInBounds= true; 1575 1580 int k= tmin (bounds [i] + 1, (l/2)*degMipo); 1576 C FMatrix C= CFMatrix (l*degMipo - k, factors.length() - 1);1581 C= CFMatrix (l*degMipo - k, factors.length() - 1); 1577 1582 1578 1583 for (int ii= 0; ii < factors.length() - 1; ii++) 1579 1584 { 1580 CFArray buf;1581 1585 if (A[ii].size() - 1 >= i) 1582 1586 { … … 1610 1614 setCharacteristic(getCharacteristic()); 1611 1615 1612 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);1613 mat_zz_pNTLK= (*NTLC)*NTLN;1616 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 1617 NTLK= (*NTLC)*NTLN; 1614 1618 transpose (NTLK, NTLK); 1615 1619 kernel (NTLK, NTLK); … … 1674 1678 int oldL= l/2; 1675 1679 bool reduced= false; 1680 CFListIterator j; 1681 mat_zz_pE* NTLC, NTLK; 1682 CFArray buf; 1683 CFMatrix C; 1676 1684 while (l <= liftBound) 1677 1685 { … … 1690 1698 1691 1699 factors.insert (LCF); 1692 CFListIteratorj= factors;1700 j= factors; 1693 1701 j++; 1694 1702 … … 1713 1721 wasInBounds= true; 1714 1722 int k= tmin (bounds [i] + 1, l/2); 1715 C FMatrix C= CFMatrix (l - k, factors.length() - 1);1723 C= CFMatrix (l - k, factors.length() - 1); 1716 1724 for (int ii= 0; ii < factors.length() - 1; ii++) 1717 1725 { 1718 CFArray buf; 1726 1719 1727 if (A[ii].size() - 1 >= i) 1720 1728 buf= getCoeffs (A[ii] [i], k); … … 1722 1730 } 1723 1731 1724 mat_zz_pE*NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);1725 mat_zz_pENTLK= (*NTLC)*NTLN;1732 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); 1733 NTLK= (*NTLC)*NTLN; 1726 1734 transpose (NTLK, NTLK); 1727 1735 kernel (NTLK, NTLK); … … 1784 1792 int extensionDeg= degree (getMipo (alpha)); 1785 1793 bool reduced= false; 1794 CFListIterator j; 1795 CFMatrix C; 1796 CFArray buf; 1797 mat_zz_p* NTLC, NTLK; 1786 1798 while (l <= liftBound) 1787 1799 { … … 1800 1812 1801 1813 factors.insert (LCF); 1802 CFListIteratorj= factors;1814 j= factors; 1803 1815 j++; 1804 1816 … … 1823 1835 wasInBounds= true; 1824 1836 int k= tmin (bounds [i] + 1, l/2); 1825 C FMatrix C= CFMatrix ((l - k)*extensionDeg, factors.length() - 1);1837 C= CFMatrix ((l - k)*extensionDeg, factors.length() - 1); 1826 1838 for (int ii= 0; ii < factors.length() - 1; ii++) 1827 1839 { 1828 CFArray buf;1829 1840 if (A[ii].size() - 1 >= i) 1830 1841 buf= getCoeffs (A[ii] [i], k, alpha); … … 1832 1843 } 1833 1844 1834 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);1835 mat_zz_pNTLK= (*NTLC)*NTLN;1845 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 1846 NTLK= (*NTLC)*NTLN; 1836 1847 transpose (NTLK, NTLK); 1837 1848 kernel (NTLK, NTLK); … … 1900 1911 bool useOldQs= false; 1901 1912 bool hitBound= false; 1913 CFListIterator j; 1914 CFMatrix C; 1915 CFArray buf; 1916 mat_zz_p* NTLC, NTLK; 1902 1917 while (l <= precision) 1903 1918 { 1904 CFListIteratorj= factors;1919 j= factors; 1905 1920 if (useOldQs) 1906 1921 { … … 1921 1936 { 1922 1937 int k= tmin (bounds [i] + 1, l/2); 1923 C FMatrix C= CFMatrix (l - k, factors.length());1938 C= CFMatrix (l - k, factors.length()); 1924 1939 for (int ii= 0; ii < factors.length(); ii++) 1925 1940 { 1926 CFArray buf;1927 1941 if (A[ii].size() - 1 >= i) 1928 1942 buf= getCoeffs (A[ii] [i], k); 1929 1943 writeInMatrix (C, buf, ii + 1, 0); 1930 1944 } 1931 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);1932 mat_zz_pNTLK= (*NTLC)*NTLN;1945 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 1946 NTLK= (*NTLC)*NTLN; 1933 1947 transpose (NTLK, NTLK); 1934 1948 kernel (NTLK, NTLK); … … 1960 1974 factorsFoundIndex, NTLN, false 1961 1975 ); 1962 F= bufF; 1963 if (result.length() > 0) 1976 if (result.length() == NTLN.NumCols()) 1964 1977 { 1965 1978 delete [] factorsFoundIndex; … … 2025 2038 bool useOldQs= false; 2026 2039 bool hitBound= false; 2040 CFListIterator j; 2041 CFMatrix C; 2042 mat_zz_pE* NTLC, NTLK; 2043 CFArray buf; 2027 2044 while (l <= precision) 2028 2045 { 2029 CFListIteratorj= factors;2046 j= factors; 2030 2047 if (useOldQs) 2031 2048 { … … 2046 2063 { 2047 2064 int k= tmin (bounds [i] + 1, l/2); 2048 C FMatrix C= CFMatrix (l - k, factors.length());2065 C= CFMatrix (l - k, factors.length()); 2049 2066 for (int ii= 0; ii < factors.length(); ii++) 2050 2067 { 2051 CFArray buf;2052 2068 if (A[ii].size() - 1 >= i) 2053 2069 buf= getCoeffs (A[ii] [i], k); 2054 2070 writeInMatrix (C, buf, ii + 1, 0); 2055 2071 } 2056 mat_zz_pE*NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);2057 mat_zz_pENTLK= (*NTLC)*NTLN;2072 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); 2073 NTLK= (*NTLC)*NTLN; 2058 2074 transpose (NTLK, NTLK); 2059 2075 kernel (NTLK, NTLK); … … 2156 2172 CanonicalForm primElemAlpha= info.getGamma(); 2157 2173 CanonicalForm imPrimElemAlpha= info.getDelta(); 2174 CFListIterator j; 2175 Variable y= F.mvar(); 2176 CanonicalForm powX, imBasis; 2177 CFMatrix Mat, C; 2178 CFIterator iter; 2179 mat_zz_p* NTLMat,*NTLC, NTLK; 2180 CFArray buf; 2158 2181 while (l <= precision) 2159 2182 { 2160 CFListIteratorj= factors;2183 j= factors; 2161 2184 if (GF) 2162 2185 setCharacteristic (getCharacteristic()); 2163 Variable y= F.mvar(); 2164 CanonicalForm powX= power (y-gamma, l); 2165 CFMatrix Mat= CFMatrix (l*degMipo, l*degMipo); 2186 powX= power (y-gamma, l); 2187 Mat= CFMatrix (l*degMipo, l*degMipo); 2166 2188 for (int i= 0; i < l*degMipo; i++) 2167 2189 { 2168 2169 CanonicalForm imBasis= mod (power (y, i), powX); 2190 imBasis= mod (power (y, i), powX); 2170 2191 imBasis= imBasis (power (y, degMipo), y); 2171 2192 imBasis= imBasis (y, gamma); 2172 CFIteratoriter= imBasis;2193 iter= imBasis; 2173 2194 for (; iter.hasTerms(); iter++) 2174 2195 Mat (iter.exp()+ 1, i+1)= iter.coeff(); 2175 2196 } 2176 2197 2177 mat_zz_p*NTLMat= convertFacCFMatrix2NTLmat_zz_p (Mat);2198 NTLMat= convertFacCFMatrix2NTLmat_zz_p (Mat); 2178 2199 *NTLMat= inv (*NTLMat); 2179 2200 if (GF) … … 2198 2219 { 2199 2220 int k= tmin (bounds [i] + 1, (l/2)*degMipo); 2200 C FMatrix C= CFMatrix (l*degMipo - k, factors.length());2221 C= CFMatrix (l*degMipo - k, factors.length()); 2201 2222 for (int ii= 0; ii < factors.length(); ii++) 2202 2223 { 2203 CFArray buf;2204 2224 if (A[ii].size() - 1 >= i) 2205 2225 { … … 2233 2253 setCharacteristic(getCharacteristic()); 2234 2254 2235 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);2236 mat_zz_pNTLK= (*NTLC)*NTLN;2255 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 2256 NTLK= (*NTLC)*NTLN; 2237 2257 transpose (NTLK, NTLK); 2238 2258 kernel (NTLK, NTLK); … … 2261 2281 if (isReduced (NTLN)) 2262 2282 { 2263 int * factorsFoundIndex= new int [NTLN.NumCols()]; 2264 for (long i= 0; i < NTLN.NumCols(); i++) 2265 factorsFoundIndex[i]= 0; 2266 int factorsFound2= 0; 2267 CFList result; 2268 CanonicalForm bufF= F; 2269 extReconstructionTry (result, bufF, factors, degree (F)+1, factorsFound2, 2270 factorsFoundIndex, NTLN, false, info, evaluation 2271 ); 2272 if (result.length() == NTLN.NumCols()) 2273 { 2283 int * factorsFoundIndex= new int [NTLN.NumCols()]; 2284 for (long i= 0; i < NTLN.NumCols(); i++) 2285 factorsFoundIndex[i]= 0; 2286 int factorsFound2= 0; 2287 CFList result; 2288 CanonicalForm bufF= F; 2289 extReconstructionTry (result, bufF, factors,degree (F)+1, factorsFound2, 2290 factorsFoundIndex, NTLN, false, info, evaluation 2291 ); 2292 if (result.length() == NTLN.NumCols()) 2293 { 2294 delete [] factorsFoundIndex; 2295 delete [] A; 2296 delete [] bounds; 2297 return result; 2298 } 2274 2299 delete [] factorsFoundIndex; 2275 delete [] A;2276 delete [] bounds;2277 return result;2278 }2279 delete [] factorsFoundIndex;2280 2300 } 2281 2301 else if (l == precision) … … 2338 2358 bool hitBound= false; 2339 2359 Variable y= Variable (2); 2360 CFListIterator j; 2361 CFMatrix C; 2362 CFArray buf; 2363 mat_zz_pE* NTLC, NTLK; 2340 2364 while (l <= precision) 2341 2365 { 2342 CFListIteratorj= factors;2366 j= factors; 2343 2367 if (useOldQs) 2344 2368 { … … 2349 2373 { 2350 2374 for (int i= 0; i < factors.length(); i++, j++) 2351 {2352 2375 A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]); 2353 }2354 2376 } 2355 2377 useOldQs= true; … … 2359 2381 { 2360 2382 int k= tmin (bounds [i] + 1, l/2); 2361 C FMatrix C= CFMatrix (l - k, factors.length());2383 C= CFMatrix (l - k, factors.length()); 2362 2384 for (int ii= 0; ii < factors.length(); ii++) 2363 2385 { 2364 CFArray buf;2365 2386 if (A[ii].size() - 1 >= i) 2366 2387 buf= getCoeffs (A[ii] [i], k); 2367 2388 writeInMatrix (C, buf, ii + 1, 0); 2368 2389 } 2369 mat_zz_pE*NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);2370 mat_zz_pENTLK= (*NTLC)*NTLN;2390 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); 2391 NTLK= (*NTLC)*NTLN; 2371 2392 transpose (NTLK, NTLK); 2372 2393 kernel (NTLK, NTLK); … … 2426 2447 return CFList(); 2427 2448 } 2428 2429 2449 2430 2450 CFList … … 2453 2473 bool useOldQs= false; 2454 2474 bool hitBound= false; 2475 CFListIterator j; 2476 CFMatrix C; 2477 mat_zz_p* NTLC, NTLK; 2478 CFArray buf; 2455 2479 while (l <= precision) 2456 2480 { 2457 CFListIteratorj= factors;2481 j= factors; 2458 2482 if (useOldQs) 2459 2483 { … … 2474 2498 { 2475 2499 int k= tmin (bounds [i] + 1, l/2); 2476 C FMatrix C= CFMatrix ((l - k)*extensionDeg, factors.length());2500 C= CFMatrix ((l - k)*extensionDeg, factors.length()); 2477 2501 for (int ii= 0; ii < factors.length(); ii++) 2478 2502 { 2479 CFArray buf;2480 2503 if (A[ii].size() - 1 >= i) 2481 2504 buf= getCoeffs (A[ii] [i], k, alpha); 2482 2505 writeInMatrix (C, buf, ii + 1, 0); 2483 2506 } 2484 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);2485 mat_zz_pNTLK= (*NTLC)*NTLN;2507 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 2508 NTLK= (*NTLC)*NTLN; 2486 2509 transpose (NTLK, NTLK); 2487 2510 kernel (NTLK, NTLK); … … 2567 2590 } 2568 2591 bool useOldQs= false; 2592 CFListIterator j; 2593 CFMatrix C; 2594 CFArray buf; 2595 mat_zz_p* NTLC, NTLK; 2596 CanonicalForm bufF; 2597 CFList bufUniFactors; 2569 2598 while (oldL <= l) 2570 2599 { 2571 CFListIteratorj= factors;2600 j= factors; 2572 2601 if (useOldQs) 2573 2602 { … … 2589 2618 { 2590 2619 int k= tmin (bounds [i] + 1, oldL/2); 2591 C FMatrix C= CFMatrix (oldL - k, factors.length());2620 C= CFMatrix (oldL - k, factors.length()); 2592 2621 for (int ii= 0; ii < factors.length(); ii++) 2593 2622 { 2594 CFArray buf;2595 2623 if (A[ii].size() - 1 >= i) 2596 2624 buf= getCoeffs (A[ii] [i], k); 2597 2625 writeInMatrix (C, buf, ii + 1, 0); 2598 2626 } 2599 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);2600 mat_zz_pNTLK= (*NTLC)*NTLN;2627 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 2628 NTLK= (*NTLC)*NTLN; 2601 2629 transpose (NTLK, NTLK); 2602 2630 kernel (NTLK, NTLK); … … 2619 2647 int * zeroOneVecs; 2620 2648 zeroOneVecs= extractZeroOneVecs (NTLN); 2621 CanonicalFormbufF= F;2622 CFListbufUniFactors= factors;2649 bufF= F; 2650 bufUniFactors= factors; 2623 2651 result= reconstruction (bufF, bufUniFactors, zeroOneVecs, oldL, NTLN); 2624 2652 delete [] zeroOneVecs; … … 2662 2690 if (NTLN.NumRows() != factors.length()) //refined factors 2663 2691 ident (NTLN, factors.length()); 2692 CFListIterator j; 2693 CFMatrix C; 2694 CFArray buf; 2695 mat_zz_pE* NTLC, NTLK; 2696 CanonicalForm bufF; 2697 CFList bufUniFactors; 2664 2698 while (oldL <= l) 2665 2699 { 2666 CFListIteratorj= factors;2700 j= factors; 2667 2701 if (useOldQs) 2668 2702 { … … 2684 2718 { 2685 2719 int k= tmin (bounds [i] + 1, oldL/2); 2686 C FMatrix C= CFMatrix (oldL - k, factors.length());2720 C= CFMatrix (oldL - k, factors.length()); 2687 2721 for (int ii= 0; ii < factors.length(); ii++) 2688 2722 { 2689 CFArray buf;2690 2723 if (A[ii].size() - 1 >= i) 2691 2724 buf= getCoeffs (A[ii] [i], k); 2692 2725 writeInMatrix (C, buf, ii + 1, 0); 2693 2726 } 2694 mat_zz_pE*NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);2695 mat_zz_pENTLK= (*NTLC)*NTLN;2727 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); 2728 NTLK= (*NTLC)*NTLN; 2696 2729 transpose (NTLK, NTLK); 2697 2730 kernel (NTLK, NTLK); … … 2715 2748 int * zeroOneVecs; 2716 2749 zeroOneVecs= extractZeroOneVecs (NTLN); 2717 CanonicalFormbufF= F;2718 CFListbufUniFactors= factors;2750 bufF= F; 2751 bufUniFactors= factors; 2719 2752 result= reconstruction (bufF, bufUniFactors, zeroOneVecs, oldL, NTLN); 2720 2753 delete [] zeroOneVecs; … … 2768 2801 if (NTLN.NumRows() != factors.length()) //refined factors 2769 2802 ident (NTLN, factors.length()); 2803 Variable y= F.mvar(); 2804 CFListIterator j; 2805 CanonicalForm powX, imBasis, bufF; 2806 CFMatrix Mat, C; 2807 CFIterator iter; 2808 mat_zz_p* NTLMat; 2809 CFArray buf; 2810 mat_zz_p* NTLC, NTLK; 2811 CFList bufUniFactors; 2770 2812 while (oldL <= l) 2771 2813 { 2772 CFListIteratorj= factors;2814 j= factors; 2773 2815 if (GF) 2774 2816 setCharacteristic (getCharacteristic()); 2775 Variable y= F.mvar(); 2776 CanonicalFormpowX= power (y-gamma, oldL);2777 CFMatrixMat= CFMatrix (oldL*degMipo, oldL*degMipo);2817 2818 powX= power (y-gamma, oldL); 2819 Mat= CFMatrix (oldL*degMipo, oldL*degMipo); 2778 2820 for (int i= 0; i < oldL*degMipo; i++) 2779 2821 { 2780 2781 CanonicalForm imBasis= mod (power (y, i), powX); 2822 imBasis= mod (power (y, i), powX); 2782 2823 imBasis= imBasis (power (y, degMipo), y); 2783 2824 imBasis= imBasis (y, gamma); 2784 CFIteratoriter= imBasis;2825 iter= imBasis; 2785 2826 for (; iter.hasTerms(); iter++) 2786 2827 Mat (iter.exp()+ 1, i+1)= iter.coeff(); 2787 2828 } 2788 2829 2789 mat_zz_p*NTLMat= convertFacCFMatrix2NTLmat_zz_p (Mat);2830 NTLMat= convertFacCFMatrix2NTLmat_zz_p (Mat); 2790 2831 *NTLMat= inv (*NTLMat); 2791 2832 if (GF) … … 2810 2851 { 2811 2852 int k= tmin (bounds [i] + 1, oldL/2); 2812 C FMatrix C= CFMatrix (oldL*degMipo - k, factors.length());2853 C= CFMatrix (oldL*degMipo - k, factors.length()); 2813 2854 for (int ii= 0; ii < factors.length(); ii++) 2814 2855 { 2815 CFArray buf;2816 2856 if (A[ii].size() - 1 >= i) 2817 2857 { … … 2845 2885 setCharacteristic(getCharacteristic()); 2846 2886 2847 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);2848 mat_zz_pNTLK= (*NTLC)*NTLN;2887 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 2888 NTLK= (*NTLC)*NTLN; 2849 2889 transpose (NTLK, NTLK); 2850 2890 kernel (NTLK, NTLK); … … 2880 2920 int * zeroOneVecs; 2881 2921 zeroOneVecs= extractZeroOneVecs (NTLN); 2882 CanonicalFormbufF= F;2883 CFListbufUniFactors= factors;2922 bufF= F; 2923 bufUniFactors= factors; 2884 2924 result= extReconstruction (bufF, bufUniFactors, zeroOneVecs, oldL, NTLN, 2885 2925 info, evaluation … … 2893 2933 } 2894 2934 2895 if (isReduced (NTLN))2896 {2897 int factorsFound= 0;2898 CanonicalForm bufF= F;2899 int* factorsFoundIndex= new int [NTLN.NumCols()];2900 for (long i= 0; i < NTLN.NumCols(); i++)2901 factorsFoundIndex[i]= 0;2902 extReconstructionTry (result, bufF, factors, l, factorsFound,2903 factorsFoundIndex, NTLN, false, info, evaluation2904 );2905 if (NTLN.NumCols() == result.length())2906 {2907 delete [] A;2908 delete [] factorsFoundIndex;2909 return result;2910 }2911 }2912 2935 result= CFList(); 2913 2936 oldL2= oldL; … … 2942 2965 bool useOldQs= false; 2943 2966 if (NTLN.NumRows() != factors.length()) //refined factors 2944 {2945 int minBound= bounds [0];2946 for (int i= 1; i < d; i++)2947 {2948 if (bounds [i] != 0)2949 minBound= tmin (minBound, bounds [i]);2950 }2951 oldL= 2*(minBound+1);2952 oldL2= minBound + 1;2953 2967 ident (NTLN, factors.length()); 2954 } 2968 CFListIterator j; 2969 CFMatrix C; 2970 CFArray buf; 2971 mat_zz_p* NTLC, NTLK; 2972 CanonicalForm bufF; 2973 CFList bufUniFactors; 2955 2974 while (oldL <= l) 2956 2975 { 2957 CFListIteratorj= factors;2976 j= factors; 2958 2977 if (useOldQs) 2959 2978 { … … 2975 2994 { 2976 2995 int k= tmin (bounds [i] + 1, oldL/2); 2977 C FMatrix C= CFMatrix ((oldL - k)*extensionDeg, factors.length());2996 C= CFMatrix ((oldL - k)*extensionDeg, factors.length()); 2978 2997 for (int ii= 0; ii < factors.length(); ii++) 2979 2998 { 2980 CFArray buf;2981 2999 if (A[ii].size() - 1 >= i) 2982 3000 buf= getCoeffs (A[ii] [i], k, alpha); 2983 3001 writeInMatrix (C, buf, ii + 1, 0); 2984 3002 } 2985 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);2986 mat_zz_pNTLK= (*NTLC)*NTLN;3003 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 3004 NTLK= (*NTLC)*NTLN; 2987 3005 transpose (NTLK, NTLK); 2988 3006 kernel (NTLK, NTLK); … … 3001 3019 zeroOneVecs= extractZeroOneVecs (NTLN); 3002 3020 3003 CanonicalFormbufF= F;3004 CFListbufUniFactors= factors;3021 bufF= F; 3022 bufUniFactors= factors; 3005 3023 result= reconstruction (bufF, bufUniFactors, zeroOneVecs, oldL, NTLN); 3006 3024 delete [] zeroOneVecs; … … 3050 3068 if (NTLN.NumRows() != factors.length()) //refined factors 3051 3069 ident (NTLN, factors.length()); 3070 CFListIterator j; 3071 CFMatrix C; 3072 CFArray buf; 3073 mat_zz_p* NTLC, NTLK; 3074 CanonicalForm bufF; 3052 3075 while (l <= liftBound) 3053 3076 { … … 3056 3079 bufFactors.insert (LCF); 3057 3080 bufFactors.removeFirst(); 3058 CFListIteratorj= bufFactors;3081 j= bufFactors; 3059 3082 if (useOldQs) 3060 3083 { … … 3072 3095 { 3073 3096 int k= tmin (bounds [i] + 1, l/2); 3074 C FMatrix C= CFMatrix (l - k, bufFactors.length());3097 C= CFMatrix (l - k, bufFactors.length()); 3075 3098 for (int ii= 0; ii < bufFactors.length(); ii++) 3076 3099 { 3077 CFArray buf;3078 3100 if (A[ii].size() - 1 >= i) 3079 3101 buf= getCoeffs (A[ii] [i], k); 3080 3102 writeInMatrix (C, buf, ii + 1, 0); 3081 3103 } 3082 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);3083 mat_zz_pNTLK= (*NTLC)*NTLN;3104 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 3105 NTLK= (*NTLC)*NTLN; 3084 3106 transpose (NTLK, NTLK); 3085 3107 kernel (NTLK, NTLK); … … 3101 3123 3102 3124 int * zeroOneVecs= extractZeroOneVecs (NTLN); 3103 CanonicalFormbufF= F;3125 bufF= F; 3104 3126 result= reconstruction (bufF, bufFactors, zeroOneVecs, l, NTLN); 3105 3127 delete [] zeroOneVecs; … … 3115 3137 { 3116 3138 int factorsFound= 0; 3117 CanonicalFormbufF= F;3139 bufF= F; 3118 3140 int* factorsFoundIndex= new int [NTLN.NumCols()]; 3119 3141 for (long i= 0; i < NTLN.NumCols(); i++) … … 3182 3204 if (NTLN.NumRows() != factors.length()) //refined factors 3183 3205 ident (NTLN, factors.length()); 3206 CFListIterator j; 3207 CFArray buf; 3208 mat_zz_pE* NTLC, NTLK; 3209 CanonicalForm bufF; 3184 3210 while (l <= liftBound) 3185 3211 { 3186 3212 bufFactors.insert (LCF); 3187 3213 henselLiftResume12 (F, bufFactors, oldL, l, Pi, diophant, M); 3188 CFListIteratorj= bufFactors;3214 j= bufFactors; 3189 3215 if (useOldQs) 3190 3216 { … … 3205 3231 for (int ii= 0; ii < bufFactors.length(); ii++) 3206 3232 { 3207 CFArray buf;3208 3233 if (A[ii].size() - 1 >= i) 3209 3234 buf= getCoeffs (A[ii] [i], k); 3210 3235 writeInMatrix (C, buf, ii + 1, 0); 3211 3236 } 3212 mat_zz_pE*NTLC= convertFacCFMatrix2NTLmat_zz_pE(C);3213 mat_zz_pENTLK= (*NTLC)*NTLN;3237 NTLC= convertFacCFMatrix2NTLmat_zz_pE(C); 3238 NTLK= (*NTLC)*NTLN; 3214 3239 transpose (NTLK, NTLK); 3215 3240 kernel (NTLK, NTLK); … … 3229 3254 } 3230 3255 3231 3232 CanonicalFormbufF= F;3233 3234 3235 3236 3237 3238 3239 3240 3241 3256 int * zeroOneVecs= extractZeroOneVecs (NTLN); 3257 bufF= F; 3258 result= reconstruction (bufF, bufFactors, zeroOneVecs, l, NTLN); 3259 delete [] zeroOneVecs; 3260 if (result.length() > 0 && degree (bufF) + 1 + degree (LC (bufF, 1)) <= l) 3261 { 3262 F= bufF; 3263 factors= bufFactors; 3264 delete [] A; 3265 return result; 3266 } 3242 3267 3243 3268 if (isReduced (NTLN)) 3244 3269 { 3245 3270 int factorsFound= 0; 3246 CanonicalFormbufF= F;3271 bufF= F; 3247 3272 int* factorsFoundIndex= new int [NTLN.NumCols()]; 3248 3273 for (long i= 0; i < NTLN.NumCols(); i++) … … 3319 3344 if (NTLN.NumRows() != factors.length()) //refined factors 3320 3345 ident (NTLN, factors.length()); 3346 Variable y= F.mvar(); 3347 CanonicalForm powX, imBasis, bufF; 3348 CFMatrix Mat, C; 3349 CFIterator iter; 3350 mat_zz_p* NTLMat,*NTLC, NTLK; 3351 CFListIterator j; 3352 CFArray buf; 3321 3353 while (l <= liftBound) 3322 3354 { … … 3327 3359 setCharacteristic (getCharacteristic()); 3328 3360 3329 Variable y= F.mvar(); 3330 CanonicalForm powX= power (y-gamma, l); 3331 CFMatrix Mat= CFMatrix (l*degMipo, l*degMipo); 3361 powX= power (y-gamma, l); 3362 Mat= CFMatrix (l*degMipo, l*degMipo); 3332 3363 for (int i= 0; i < l*degMipo; i++) 3333 3364 { 3334 3365 3335 CanonicalFormimBasis= mod (power (y, i), powX);3366 imBasis= mod (power (y, i), powX); 3336 3367 imBasis= imBasis (power (y, degMipo), y); 3337 3368 imBasis= imBasis (y, gamma); 3338 CFIteratoriter= imBasis;3369 iter= imBasis; 3339 3370 for (; iter.hasTerms(); iter++) 3340 3371 Mat (iter.exp()+ 1, i+1)= iter.coeff(); 3341 3372 } 3342 3373 3343 mat_zz_p*NTLMat= convertFacCFMatrix2NTLmat_zz_p (Mat);3374 NTLMat= convertFacCFMatrix2NTLmat_zz_p (Mat); 3344 3375 *NTLMat= inv (*NTLMat); 3345 3376 … … 3347 3378 setCharacteristic (getCharacteristic(), degMipo, info.getGFName()); 3348 3379 3349 CFListIteratorj= bufFactors;3380 j= bufFactors; 3350 3381 if (useOldQs) 3351 3382 { … … 3363 3394 { 3364 3395 int k= tmin (bounds [i] + 1, l/2); 3365 C FMatrix C= CFMatrix (l*degMipo - k, bufFactors.length());3396 C= CFMatrix (l*degMipo - k, bufFactors.length()); 3366 3397 for (int ii= 0; ii < bufFactors.length(); ii++) 3367 3398 { 3368 CFArray buf;3369 3399 if (A[ii].size() - 1 >= i) 3370 3400 { … … 3397 3427 if (GF) 3398 3428 setCharacteristic(getCharacteristic()); 3399 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);3400 mat_zz_pNTLK= (*NTLC)*NTLN;3429 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 3430 NTLK= (*NTLC)*NTLN; 3401 3431 transpose (NTLK, NTLK); 3402 3432 kernel (NTLK, NTLK); … … 3419 3449 } 3420 3450 3421 3422 CanonicalFormbufF= F;3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3451 int * zeroOneVecs= extractZeroOneVecs (NTLN); 3452 bufF= F; 3453 result= extReconstruction (bufF, bufFactors, zeroOneVecs, l, NTLN, info, 3454 evaluation 3455 ); 3456 delete [] zeroOneVecs; 3457 if (result.length() > 0 && degree (bufF) + 1 + degree (LC (bufF, 1)) <= l) 3458 { 3459 F= bufF; 3460 factors= bufFactors; 3461 delete [] A; 3462 return result; 3463 } 3434 3464 3435 3465 if (isReduced (NTLN)) 3436 3466 { 3437 3467 int factorsFound= 0; 3438 CanonicalFormbufF= F;3468 bufF= F; 3439 3469 int* factorsFoundIndex= new int [NTLN.NumCols()]; 3440 3470 for (long i= 0; i < NTLN.NumCols(); i++) … … 3507 3537 if (NTLN.NumRows() != factors.length()) //refined factors 3508 3538 ident (NTLN, factors.length()); 3539 CFListIterator j; 3540 CFMatrix C; 3541 mat_zz_p* NTLC, NTLK; 3542 CanonicalForm bufF; 3509 3543 while (l <= liftBound) 3510 3544 { 3511 3545 bufFactors.insert (LCF); 3512 3546 henselLiftResume12 (F, bufFactors, oldL, l, Pi, diophant, M); 3513 CFListIteratorj= bufFactors;3547 j= bufFactors; 3514 3548 if (useOldQs) 3515 3549 { … … 3527 3561 { 3528 3562 int k= tmin (bounds [i] + 1, l/2); 3529 C FMatrix C= CFMatrix ((l - k)*extensionDeg, bufFactors.length());3563 C= CFMatrix ((l - k)*extensionDeg, bufFactors.length()); 3530 3564 for (int ii= 0; ii < bufFactors.length(); ii++) 3531 3565 { … … 3535 3569 writeInMatrix (C, buf, ii + 1, 0); 3536 3570 } 3537 mat_zz_p*NTLC= convertFacCFMatrix2NTLmat_zz_p(C);3538 mat_zz_pNTLK= (*NTLC)*NTLN;3571 NTLC= convertFacCFMatrix2NTLmat_zz_p(C); 3572 NTLK= (*NTLC)*NTLN; 3539 3573 transpose (NTLK, NTLK); 3540 3574 kernel (NTLK, NTLK); … … 3554 3588 } 3555 3589 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3590 int * zeroOneVecs= extractZeroOneVecs (NTLN); 3591 CanonicalForm bufF= F; 3592 result= reconstruction (bufF, bufFactors, zeroOneVecs, l, NTLN); 3593 delete [] zeroOneVecs; 3594 if (result.length() > 0 && degree (bufF) + 1 + degree (LC (bufF, 1)) <= l) 3595 { 3596 F= bufF; 3597 factors= bufFactors; 3598 delete [] A; 3599 return result; 3600 } 3567 3601 3568 3602 if (isReduced (NTLN)) 3569 3603 { 3570 3604 int factorsFound= 0; 3571 CanonicalFormbufF= F;3605 bufF= F; 3572 3606 int* factorsFoundIndex= new int [NTLN.NumCols()]; 3573 3607 for (long i= 0; i < NTLN.NumCols(); i++) … … 3624 3658 Variable y= Variable (2); 3625 3659 CanonicalForm LCF= LC (F, 1); 3660 CFListIterator iter; 3661 CanonicalForm buf; 3626 3662 for (long i= 1; i <= NTLN.NumCols(); i++) 3627 3663 { 3628 CFListIteratoriter= factors;3629 CanonicalFormbuf= 1;3664 iter= factors; 3665 buf= 1; 3630 3666 for (long j= 1; j <= NTLN.NumRows(); j++, iter++) 3631 3667 { … … 3652 3688 Variable y= Variable (2); 3653 3689 CanonicalForm LCF= LC (F, 1); 3690 CFListIterator iter; 3691 CanonicalForm buf; 3654 3692 for (long i= 1; i <= NTLN.NumCols(); i++) 3655 3693 { 3656 CFListIteratoriter= factors;3657 CanonicalFormbuf= 1;3694 iter= factors; 3695 buf= 1; 3658 3696 for (long j= 1; j <= NTLN.NumRows(); j++, iter++) 3659 3697 { … … 4036 4074 4037 4075 int index; 4076 CanonicalForm tmp1, tmp2; 4038 4077 for (CFListIterator i= smallFactors; i.hasItem(); i++) 4039 4078 { 4040 4079 index= 1; 4041 CanonicalForm tmp1, tmp2;4042 4080 tmp1= mod (i.getItem(),y); 4043 4081 tmp1 /= Lc (tmp1); … … 4333 4371 if (beenInThres) 4334 4372 { 4335 int index; 4336 for (CFListIterator i= result; i.hasItem(); i++) 4337 { 4338 index= 1; 4339 CanonicalForm tmp1, tmp2; 4340 tmp1= mod (i.getItem(), y); 4341 tmp1 /= Lc (tmp1); 4342 for (CFListIterator j= bufUniFactors; j.hasItem(); j++, index++) 4343 { 4344 tmp2= mod (j.getItem(), y); 4345 tmp2 /= Lc (tmp2); 4346 if (tmp1 == tmp2) 4347 { 4348 index++; 4349 j.remove(index); 4350 break; 4351 } 4352 } 4353 } 4373 int index; 4374 for (CFListIterator i= result; i.hasItem(); i++) 4375 { 4376 index= 1; 4377 tmp1= mod (i.getItem(), y); 4378 tmp1 /= Lc (tmp1); 4379 for (CFListIterator j= bufUniFactors; j.hasItem(); j++, index++) 4380 { 4381 tmp2= mod (j.getItem(), y); 4382 tmp2 /= Lc (tmp2); 4383 if (tmp1 == tmp2) 4384 { 4385 index++; 4386 j.remove(index); 4387 break; 4388 } 4389 } 4390 } 4354 4391 } 4355 4392 else 4356 4393 { 4357 int * zeroOne= extractZeroOneVecs (NTLN); 4358 CFList bufBufUniFactors= bufUniFactors; 4359 for (int i= 0; i < NTLN.NumCols(); i++) 4360 { 4361 if (zeroOne [i] == 0) 4362 continue; 4363 CFListIterator iter= bufUniFactors; 4364 CanonicalForm buf= 1; 4394 int * zeroOne= extractZeroOneVecs (NTLN); 4395 CFList bufBufUniFactors= bufUniFactors; 4396 CFListIterator iter, iter2; 4397 CanonicalForm buf; 4365 4398 CFList factorsConsidered; 4366 for (int j= 0; j < NTLN.NumRows(); j++, iter++) 4367 { 4368 if (!IsZero (NTLN (j + 1,i + 1))) 4369 { 4370 factorsConsidered.append (iter.getItem()); 4371 buf *= mod (iter.getItem(), y); 4372 } 4373 } 4374 buf /= Lc (buf); 4375 for (CFListIterator iter2= result; iter2.hasItem(); iter2++) 4376 { 4377 CanonicalForm tmp= mod (iter2.getItem(), y); 4378 tmp /= Lc (tmp); 4379 if (tmp == buf) 4380 { 4381 bufBufUniFactors= Difference (bufBufUniFactors, factorsConsidered); 4382 break; 4383 } 4384 } 4385 } 4386 bufUniFactors= bufBufUniFactors; 4387 delete [] zeroOne; 4399 CanonicalForm tmp; 4400 for (int i= 0; i < NTLN.NumCols(); i++) 4401 { 4402 if (zeroOne [i] == 0) 4403 continue; 4404 iter= bufUniFactors; 4405 buf= 1; 4406 factorsConsidered= CFList(); 4407 for (int j= 0; j < NTLN.NumRows(); j++, iter++) 4408 { 4409 if (!IsZero (NTLN (j + 1,i + 1))) 4410 { 4411 factorsConsidered.append (iter.getItem()); 4412 buf *= mod (iter.getItem(), y); 4413 } 4414 } 4415 buf /= Lc (buf); 4416 for (iter2= result; iter2.hasItem(); iter2++) 4417 { 4418 tmp= mod (iter2.getItem(), y); 4419 tmp /= Lc (tmp); 4420 if (tmp == buf) 4421 { 4422 bufBufUniFactors= Difference (bufBufUniFactors, factorsConsidered); 4423 break; 4424 } 4425 } 4426 } 4427 bufUniFactors= bufBufUniFactors; 4428 delete [] zeroOne; 4388 4429 } 4389 4430 … … 4689 4730 4690 4731 int index; 4732 CanonicalForm tmp1, tmp2; 4691 4733 for (CFListIterator i= smallFactors; i.hasItem(); i++) 4692 4734 { 4693 4735 index= 1; 4694 CanonicalForm tmp1, tmp2;4695 4736 tmp1= mod (i.getItem(), y - evaluation); 4696 4737 tmp1 /= Lc (tmp1); … … 4828 4869 { 4829 4870 int * factorsFoundIndex; 4830 4831 4832 4871 factorsFoundIndex= new int [NTLN.NumCols()]; 4872 for (long i= 0; i < NTLN.NumCols(); i++) 4873 factorsFoundIndex[i]= 0; 4833 4874 CanonicalForm bufF= F; 4834 4875 int factorsFound= 0; … … 4882 4923 { 4883 4924 index= 1; 4884 CanonicalForm tmp1, tmp2;4885 4925 tmp1= mod (i.getItem(), y-evaluation); 4886 4926 tmp1 /= Lc (tmp1); … … 4902 4942 int * zeroOne= extractZeroOneVecs (NTLN); 4903 4943 CFList bufBufUniFactors= bufUniFactors; 4944 CFListIterator iter, iter2; 4945 CanonicalForm buf; 4946 CFList factorsConsidered; 4904 4947 for (int i= 0; i < NTLN.NumCols(); i++) 4905 4948 { 4906 4949 if (zeroOne [i] == 0) 4907 4950 continue; 4908 CFListIteratoriter= bufUniFactors;4909 CanonicalFormbuf= 1;4910 CFList factorsConsidered;4951 iter= bufUniFactors; 4952 buf= 1; 4953 factorsConsidered= CFList(); 4911 4954 for (int j= 0; j < NTLN.NumRows(); j++, iter++) 4912 4955 { … … 4918 4961 } 4919 4962 buf /= Lc (buf); 4920 for ( CFListIteratoriter2= result; iter2.hasItem(); iter2++)4963 for (iter2= result; iter2.hasItem(); iter2++) 4921 4964 { 4922 4965 CanonicalForm tmp= mod (iter2.getItem(), y - evaluation); -
factory/facFqFactorize.cc
r0349c20 r38ffb7 1171 1171 CFList result; 1172 1172 1173 CanonicalForm tmp; 1173 1174 for (CFListIterator i= factors; i.hasItem(); i++) 1174 1175 { 1175 CanonicalFormtmp= i.getItem();1176 tmp= i.getItem(); 1176 1177 tmp= mulMod (tmp, LCBuf, M); 1177 1178 tmp= tmp/content (tmp, 1); … … 1197 1198 int n= 1; 1198 1199 int m; 1199 for (CFFListIterator i= factors1; (i.hasItem() && n < k); i++, n++) 1200 CFFListIterator j; 1201 for (CFFListIterator i= factors1; (n < k && i.hasItem()); i++, n++) 1200 1202 { 1201 1203 m= 1; 1202 for ( CFFListIterator j= factors2; (j.hasItem() && m < l); j++, m++)1203 { 1204 CanonicalFormg= gcd (i.getItem().factor(), j.getItem().factor());1204 for (j= factors2; (m < l && j.hasItem()); j++, m++) 1205 { 1206 g= gcd (i.getItem().factor(), j.getItem().factor()); 1205 1207 if (degree (g) > 0) 1206 1208 { … … 1253 1255 } 1254 1256 1257 Variable v; 1258 CFListIterator iter1; 1259 CanonicalForm tmp, g; 1255 1260 for (int i= 0; i < length; i++) 1256 1261 { 1257 1262 if (differentSecondVarFactors[i].isEmpty()) 1258 1263 continue; 1259 CFListIteratoriter1= l;1264 iter1= l; 1260 1265 iter1++; 1261 1266 1262 Variablev= Variable (i + 3);1267 v= Variable (i + 3); 1263 1268 for (CFListIterator iter2= differentSecondVarFactors[i]; iter2.hasItem(); 1264 1269 iter2++, iter1++) … … 1266 1271 if (degree (iter2.getItem(),v) == degree (iter1.getItem(),v)) 1267 1272 continue; 1268 CanonicalFormtmp= iter1.getItem();1273 tmp= iter1.getItem(); 1269 1274 for (int j= tmp.level(); j > 1; j--) 1270 1275 { … … 1273 1278 tmp= tmp (0, j); 1274 1279 } 1275 CanonicalFormg= gcd (iter2.getItem(), content);1280 g= gcd (iter2.getItem(), content); 1276 1281 if (degree (g) > 0) 1277 1282 { … … 1306 1311 CFFList*& bufSqrfFactors, CFList& evalSqrfPartF) 1307 1312 { 1313 CanonicalForm tmp; 1314 CFListIterator j; 1308 1315 for (CFListIterator i= uniFactors; i.hasItem(); i++) 1309 1316 { 1310 CanonicalFormtmp= i.getItem();1317 tmp= i.getItem(); 1311 1318 if (i.hasItem()) 1312 1319 i++; 1313 1320 else 1314 1321 break; 1315 for ( CFListIteratorj= i; j.hasItem(); j++)1322 for (j= i; j.hasItem(); j++) 1316 1323 { 1317 1324 if (tmp == j.getItem()) … … 1338 1345 int k= 0; 1339 1346 factors= uniFactors; 1347 CFFListIterator iter; 1340 1348 for (CFListIterator i= factors; i.hasItem(); i++, k++) 1341 1349 { 1342 CanonicalFormtmp= 1;1350 tmp= 1; 1343 1351 sqrfFactors= squarefreeFactorization (i.getItem(), alpha); 1344 1352 1345 for ( CFFListIterator j= sqrfFactors; j.hasItem(); j++)1346 { 1347 tmp2.append ( j.getItem().factor());1348 tmp *= j.getItem().factor();1353 for (iter= sqrfFactors; iter.hasItem(); iter++) 1354 { 1355 tmp2.append (iter.getItem().factor()); 1356 tmp *= iter.getItem().factor(); 1349 1357 } 1350 1358 i.getItem()= tmp/Lc(tmp); … … 1354 1362 for (int i= 0; i < factors.length() - 1; i++) 1355 1363 { 1356 for ( intk= i + 1; k < factors.length(); k++)1364 for (k= i + 1; k < factors.length(); k++) 1357 1365 { 1358 1366 gcdFreeBasis (bufSqrfFactors [i], bufSqrfFactors[k]); … … 1365 1373 if (i == 0) 1366 1374 { 1367 for (CFFListIterator k= bufSqrfFactors [i]; k.hasItem(); k++) 1368 { 1369 k.getItem()= CFFactor (k.getItem().factor()/Lc (k.getItem().factor()), 1370 k.getItem().exp()); 1371 factors.append (k.getItem().factor()); 1375 for (iter= bufSqrfFactors [i]; iter.hasItem(); iter++) 1376 { 1377 iter.getItem()= CFFactor (iter.getItem().factor()/ 1378 Lc (iter.getItem().factor()), 1379 iter.getItem().exp()); 1380 factors.append (iter.getItem().factor()); 1372 1381 } 1373 1382 } 1374 1383 else 1375 1384 { 1376 for (CFFListIterator k= bufSqrfFactors [i]; k.hasItem(); k++) 1377 { 1378 k.getItem()= CFFactor (k.getItem().factor()/Lc (k.getItem().factor()), 1379 k.getItem().exp()); 1380 if (!find (factors, k.getItem().factor())) 1381 factors.append (k.getItem().factor()); 1385 for (iter= bufSqrfFactors [i]; iter.hasItem(); iter++) 1386 { 1387 iter.getItem()= CFFactor (iter.getItem().factor()/ 1388 Lc (iter.getItem().factor()), 1389 iter.getItem().exp()); 1390 if (!find (factors, iter.getItem().factor())) 1391 factors.append (iter.getItem().factor()); 1382 1392 } 1383 1393 } … … 1385 1395 1386 1396 test= prod (factors); 1387 CanonicalFormtmp= evalSqrfPartF.getFirst() (0,2);1397 tmp= evalSqrfPartF.getFirst() (0,2); 1388 1398 if (test/Lc (test) != tmp/Lc (tmp)) 1389 1399 return 0; … … 1430 1440 else 1431 1441 { 1442 CFListIterator j; 1432 1443 for (int i= 0; i < length; i++) 1433 1444 { 1434 for ( CFListIteratorj= differentSecondVarLCs[i]; j.hasItem(); j++)1445 for (j= differentSecondVarLCs[i]; j.hasItem(); j++) 1435 1446 { 1436 1447 if (j.getItem().level() == LCFLevel) … … 1468 1479 CFFList * bufSqrfFactors= new CFFList [factors.length()]; 1469 1480 CFList evalSqrfPartF; 1470 CanonicalForm bufContent;1471 1481 CFList bufFactors; 1472 1482 int pass= testFactors (F, factors, alpha, sqrfPartF, … … 1489 1499 } 1490 1500 } 1501 CFListIterator iter; 1502 CFList bufBufFactors; 1503 CanonicalForm bufF; 1491 1504 for (int i= 0; i < length; i++) 1492 1505 { … … 1494 1507 { 1495 1508 bool allConstant= true; 1496 for (CFListIterator iter= differentSecondVarLCs[i]; iter.hasItem(); 1497 iter++) 1509 for (iter= differentSecondVarLCs[i]; iter.hasItem(); iter++) 1498 1510 { 1499 1511 if (!iter.getItem().inCoeffDomain()) … … 1507 1519 1508 1520 bufFactors= differentSecondVarLCs [i]; 1509 for ( CFListIteratoriter= bufFactors; iter.hasItem(); iter++)1521 for (iter= bufFactors; iter.hasItem(); iter++) 1510 1522 iter.getItem()= swapvar (iter.getItem(), x, y); 1511 CanonicalFormbufF= F;1523 bufF= F; 1512 1524 z= Variable (y.level() - lev); 1513 1525 bufF= swapvar (bufF, x, z); 1514 CFListbufBufFactors= bufFactors;1526 bufBufFactors= bufFactors; 1515 1527 pass= testFactors (bufF, bufBufFactors, alpha, sqrfPartF, bufFactors, 1516 1528 bufSqrfFactors, evalSqrfPartF); … … 1520 1532 F= bufF; 1521 1533 CFList l= factors; 1522 for ( CFListIteratoriter= l; iter.hasItem(); iter++)1534 for (iter= l; iter.hasItem(); iter++) 1523 1535 iter.getItem()= swapvar (iter.getItem(), x, y); 1524 1536 differentSecondVarLCs [i]= l; … … 1573 1585 1574 1586 CFList result; 1587 CFFListIterator k; 1575 1588 for (int i= 0; i < LCFFactors.length(); i++) 1576 1589 { 1577 1590 CanonicalForm tmp= 1; 1578 for ( CFFListIteratork= bufSqrfFactors[i]; k.hasItem(); k++)1591 for (k= bufSqrfFactors[i]; k.hasItem(); k++) 1579 1592 { 1580 1593 int pos= findItem (bufFactors, k.getItem().factor()); … … 1634 1647 const CanonicalForm& A) 1635 1648 { 1649 CanonicalForm tmp; 1650 CFList tmp2; 1651 CFListIterator iter; 1636 1652 for (int i= A.level(); i > 2; i--) 1637 1653 { 1638 CanonicalFormtmp= A;1639 CFListtmp2= CFList();1640 CFListIteratoriter= evaluation;1654 tmp= A; 1655 tmp2= CFList(); 1656 iter= evaluation; 1641 1657 bool preserveDegree= true; 1642 1658 for (int j= A.level(); j > 1; j--, iter++) … … 1748 1764 minFactorsLength= 0; 1749 1765 irred= false; 1766 CFList factors; 1767 Variable v; 1750 1768 for (int j= 0; j < A.level() - 2; j++) 1751 1769 { 1752 1770 if (!Aeval[j].isEmpty()) 1753 1771 { 1754 Variable v= Variable (Aeval[j].getFirst().level()); 1755 1756 CFList factors; 1772 v= Variable (Aeval[j].getFirst().level()); 1757 1773 if (CFFactory::gettype() == GaloisFieldDomain) 1758 1774 factors= GFBiSqrfFactorize (Aeval[j].getFirst()); … … 1783 1799 ) 1784 1800 { 1801 CanonicalForm evalPoint; 1802 int i; 1803 CFListIterator iter, iter2; 1804 Variable v; 1805 CFList l, LCs; 1806 CanonicalForm buf; 1785 1807 for (int j= 0; j < A.level() - 2; j++) 1786 1808 { 1787 1809 if (!Aeval[j].isEmpty()) 1788 1810 { 1789 int i= A.level(); 1790 CanonicalForm evalPoint; 1791 for (CFListIterator iter= evaluation; iter.hasItem(); iter++, i--) 1811 i= A.level(); 1812 for (iter= evaluation; iter.hasItem(); iter++, i--) 1792 1813 { 1793 1814 if (i == Aeval[j].getFirst().level()) … … 1798 1819 } 1799 1820 1800 Variablev= Variable (i);1821 v= Variable (i); 1801 1822 if (Aeval[j].length() > uniFactors.length()) 1802 1823 Aeval[j]= recombination (Aeval[j], uniFactors, 1, … … 1804 1825 evalPoint, v); 1805 1826 1806 CFList l; 1807 CanonicalForm buf; 1808 for (CFListIterator iter1= uniFactors; iter1.hasItem(); iter1++) 1809 { 1810 for (CFListIterator iter2= Aeval[j]; iter2.hasItem(); iter2++) 1827 l= CFList(); 1828 for (iter= uniFactors; iter.hasItem(); iter++) 1829 { 1830 for (iter2= Aeval[j]; iter2.hasItem(); iter2++) 1811 1831 { 1812 1832 buf= mod (iter2.getItem(), v - evalPoint); 1813 1833 buf /= Lc (buf); 1814 if (iter 1.getItem() == buf)1834 if (iter.getItem() == buf) 1815 1835 { 1816 1836 l.append (iter2.getItem()); … … 1821 1841 Aeval [j]= l; 1822 1842 1823 CFList LCs;1824 for ( CFListIteratoriter= Aeval[j]; iter.hasItem(); iter++)1843 LCs= CFList(); 1844 for (iter= Aeval[j]; iter.hasItem(); iter++) 1825 1845 LCs.append (LC (iter.getItem() (v + evalPoint, v), 1)); 1826 1846 normalize (LCs); … … 1849 1869 int minFactorsLength) 1850 1870 { 1871 CFListIterator iter; 1872 CanonicalForm evalPoint; 1873 int i; 1874 Variable v; 1875 Variable y= Variable (2); 1876 CFList list; 1851 1877 for (int j= 0; j < A.level() - 2; j++) 1852 1878 { 1853 1879 if (Aeval[j].length() == minFactorsLength) 1854 1880 { 1855 i nt i= A.level();1856 CanonicalForm evalPoint; 1857 for ( CFListIteratoriter= evaluation; iter.hasItem(); iter++, i--)1881 i= A.level(); 1882 1883 for (iter= evaluation; iter.hasItem(); iter++, i--) 1858 1884 { 1859 1885 if (i == Aeval[j].getFirst().level()) … … 1864 1890 } 1865 1891 1866 Variable v= Variable (i); 1867 CFList list= buildUniFactors (Aeval[j], evalPoint, v); 1868 1869 Variable y= Variable (2); 1892 v= Variable (i); 1893 list= buildUniFactors (Aeval[j], evalPoint, v); 1894 1870 1895 biFactors= recombination (biFactors, list, 1, 1871 1896 biFactors.length() - list.length() + 1, … … 1881 1906 CFList l= leadingCoeffs; 1882 1907 LCs [n-3]= l; 1908 CFListIterator j; 1883 1909 for (int i= n - 1; i > 2; i--) 1884 1910 { 1885 for ( CFListIteratorj= l; j.hasItem(); j++)1911 for (j= l; j.hasItem(); j++) 1886 1912 j.getItem()= j.getItem() (0, i + 1); 1887 1913 LCs [i - 3]= l; … … 1897 1923 { 1898 1924 ii= normalizeFactor; 1899 for ( CFListIteratorj= LCs [i]; j.hasItem(); j++, ii++)1925 for (j= LCs [i]; j.hasItem(); j++, ii++) 1900 1926 j.getItem() *= ii.getItem(); 1901 1927 }
Note: See TracChangeset
for help on using the changeset viewer.