Changeset 8a30b1 in git for factory/facFqFactorize.cc
 Timestamp:
 Jul 19, 2012, 12:14:06 PM (11 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '1d362c315e551a5b527ab0759f8839cf0e94f3a5')
 Children:
 4fee0ed1233fdc5967b5508da747cc77fe30de63
 Parents:
 e0af3ef0dd8793dabc30eac5d848f0b020acd362
 gitauthor:
 Martin Lee <martinlee84@web.de>20120719 12:14:06+02:00
 gitcommitter:
 Martin Lee <martinlee84@web.de>20120904 17:25:37+02:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/facFqFactorize.cc
re0af3ef r8a30b1 1220 1220 { 1221 1221 CFListIterator iter1= result; 1222 for (CFListIterator iter2= differentSecondVarFactors[i]; 1222 for (CFListIterator iter2= differentSecondVarFactors[i];iter2.hasItem(); 1223 1223 iter2++, iter1++) 1224 1224 { … … 1233 1233 1234 1234 Variable v; 1235 CFListIterator iter1 ;1235 CFListIterator iter1, iter2; 1236 1236 CanonicalForm tmp, g; 1237 CFList multiplier; 1237 1238 for (int i= 0; i < length; i++) 1238 1239 { … … 1243 1244 1244 1245 v= Variable (i + 3); 1245 for (CFListIterator iter2= differentSecondVarFactors[i]; iter2.hasItem(); 1246 tmp= 1; 1247 for (iter2= differentSecondVarFactors[i]; iter2.hasItem(); 1246 1248 iter2++, iter1++) 1247 1249 { 1248 1250 if (degree (iter2.getItem(),v) == degree (iter1.getItem(),v)) 1251 { 1252 multiplier.append (1); 1249 1253 continue; 1250 tmp= iter1.getItem();1251 for (int j= tmp.level(); j > 1; j)1252 {1253 if (j == i + 3)1254 continue;1255 tmp= tmp (0, j);1256 1254 } 1257 1255 g= gcd (iter2.getItem(), content); 1258 if (degree (g) > 0) 1259 { 1260 if (!tmp.isZero()) 1261 iter2.getItem() /= tmp; 1262 content /= g; 1263 iter1.getItem() *= g; 1264 } 1265 } 1256 if (!g.inCoeffDomain()) 1257 { 1258 tmp *= g; 1259 multiplier.append (g); 1260 } 1261 else 1262 multiplier.append (1); 1263 } 1264 if (!tmp.isOne() && fdivides (tmp, content)) 1265 { 1266 iter1= l; 1267 iter1++; 1268 content /= tmp; 1269 for (iter2= multiplier; iter2.hasItem(); iter1++, iter2++) 1270 iter1.getItem() *= iter2.getItem(); 1271 } 1272 multiplier= CFList(); 1266 1273 } 1267 1274 … … 1433 1440 1434 1441 CFMap N, M; 1435 CFArray dummy= CFArray ( 1);1442 CFArray dummy= CFArray (2); 1436 1443 dummy [0]= LCF; 1444 dummy [1]= Variable (2); 1437 1445 compress (dummy, M, N); 1438 1446 CanonicalForm F= M (LCF); … … 1486 1494 CFList evalSqrfPartF, bufFactors; 1487 1495 CFArray evalPoint= CFArray (evaluation.length()  1); 1496 CFArray buf= CFArray (evaluation.length()); 1497 CFArray swap= CFArray (evaluation.length()); 1488 1498 CFListIterator iter= evaluation; 1489 for (int i= evaluation.length()  2; i > 1; i, iter++) 1490 evalPoint[i]= iter.getItem(); 1499 CanonicalForm vars=getVars (LCF); 1500 for (int i= evaluation.length() +1; i > 1; i, iter++) 1501 { 1502 buf[i2]=iter.getItem(); 1503 if (degree (vars, i) > 0) 1504 swap[M(Variable (i)).level()1]=buf[i2]; 1505 } 1506 buf= swap; 1507 for (int i= 0; i < evaluation.length()  1; i++) 1508 evalPoint[i]= buf[i+1]; 1491 1509 1492 1510 int pass= testFactors (F, factors, alpha, sqrfPartF, … … 1501 1519 // LCF is nonconstant here 1502 1520 CFList bufBufFactors; 1503 CanonicalForm bufF, swap; 1504 CFArray buf; 1521 CanonicalForm bufF; 1505 1522 for (int i= 0; i < lSecondVarLCs; i++) 1506 1523 { … … 1528 1545 bufBufFactors= bufFactors; 1529 1546 evalPoint= CFArray (evaluation.length()  1); 1530 buf= CFArray (evaluation.length()); 1531 iter= evaluation; 1532 int k= evaluation.length()  1; 1533 for (; iter.hasItem(); iter++, k) 1534 buf[k]= iter.getItem(); 1535 swap= buf[z.level()  1]; 1536 buf[z.level()  1]= buf[0]; 1537 buf[0]= 0; 1538 int l= 0; 1539 for (k= 0; k < evaluation.length(); k++) 1540 { 1541 if (buf[k].isZero()) 1542 continue; 1543 evalPoint[l]= buf[k]; 1544 l++; 1547 for (int k= 0; k < evaluation.length()1; k++) 1548 { 1549 if (k+1 != lev) 1550 evalPoint[k]= buf[k+1]; 1551 else 1552 evalPoint[k]= buf[0]; 1545 1553 } 1546 1554 pass= testFactors (bufF, bufBufFactors, alpha, sqrfPartF, bufFactors, … … 1585 1593 bufFactors= factors; 1586 1594 CFList evaluation2; 1587 if (y == x) 1588 evaluation2= evaluation; 1589 else 1590 { 1591 CanonicalForm tmp; 1592 evaluation2= evaluation; 1593 int i= evaluation.length() + 1; 1594 for (CFListIterator iter= evaluation2; iter.hasItem(); iter++, i) 1595 { 1596 if (i == y.level()) 1597 { 1598 tmp= iter.getItem(); 1599 iter.getItem()= evaluation2.getLast(); 1600 evaluation2.removeLast(); 1601 evaluation2.append (tmp); 1602 break; 1603 } 1604 } 1605 } 1595 for (int i= 0; i < F.level()1; i++) 1596 evaluation2.insert (evalPoint[i]); 1606 1597 1607 1598 CFList interMedResult; 1608 1599 CanonicalForm oldSqrfPartF= sqrfPartF; 1609 sqrfPartF= shift2Zero (sqrfPartF, evalSqrfPartF, evaluation2 , 1);1600 sqrfPartF= shift2Zero (sqrfPartF, evalSqrfPartF, evaluation2); 1610 1601 if (factors.length() > 1) 1611 1602 { … … 1615 1606 leadingCoeffs.append (LC1); 1616 1607 1617 CFList LC1eval= evaluateAtEval (LC1, evaluation2, 1);1608 CFList LC1eval= evaluateAtEval (LC1, evaluation2, 2); 1618 1609 CFList oldFactors= factors; 1619 1610 for (CFListIterator i= oldFactors; i.hasItem(); i++) … … 1624 1615 if (size (oldSqrfPartFPowLC)/getNumVars (oldSqrfPartFPowLC) < 500 && 1625 1616 LucksWangSparseHeuristic (oldSqrfPartFPowLC, 1626 oldFactors, 1, leadingCoeffs, factors))1617 oldFactors, 2, leadingCoeffs, factors)) 1627 1618 { 1628 1619 interMedResult= recoverFactors (oldSqrfPartF, factors); … … 1639 1630 1640 1631 for (CFListIterator i= factors; i.hasItem(); i++) 1641 {1642 i.getItem()= i.getItem() (x + evaluation2.getLast(), x);1643 1632 i.getItem() *= LC1 (0,2)/Lc (i.getItem()); 1644 }1645 1633 factors.insert (1); 1646 1634 … … 1686 1674 } 1687 1675 for (CFListIterator iter= factors; iter.hasItem(); iter++) 1688 iter.getItem()= reverseShift (iter.getItem(), evaluation2 , 1);1676 iter.getItem()= reverseShift (iter.getItem(), evaluation2); 1689 1677 1690 1678 interMedResult= 1691 recoverFactors (reverseShift(evalSqrfPartF.getLast(),evaluation2 ,1),1679 recoverFactors (reverseShift(evalSqrfPartF.getLast(),evaluation2), 1692 1680 factors); 1693 1681 } … … 1916 1904 } 1917 1905 1906 CFList conv (const CFArray & A) 1907 { 1908 CFList result; 1909 for (int i= A.max(); i >= A.min(); i) 1910 result.insert (A[i]); 1911 return result; 1912 } 1913 1918 1914 void getLeadingCoeffs (const CanonicalForm& A, CFList*& Aeval, 1919 1915 const CFList& uniFactors, const CFList& evaluation … … 1924 1920 CFListIterator iter, iter2; 1925 1921 Variable v; 1926 CFList l, LCs, buf; 1927 int pos; 1922 CFList LCs, buf; 1923 CFArray l; 1924 int pos, index; 1928 1925 for (int j= 0; j < A.level()  2; j++) 1929 1926 { … … 1946 1943 evalPoint, v); 1947 1944 1948 l= CFList();1949 1945 buf= buildUniFactors (Aeval[j], evalPoint, v); 1950 for (iter= uniFactors; iter.hasItem(); iter++) 1951 { 1952 pos= findItem (buf, iter.getItem()); 1946 l= CFArray (uniFactors.length()); 1947 index= 1; 1948 for (iter= buf; iter.hasItem(); iter++, index++) 1949 { 1950 pos= findItem (uniFactors, iter.getItem()); 1953 1951 if (pos) 1954 l.append (getItem (Aeval[j], pos)); 1955 } 1956 Aeval [j]= l; 1957 1952 l[pos1]= getItem (Aeval[j], index); 1953 } 1954 buf= conv (l); 1955 Aeval [j]= buf; 1956 1957 buf= buildUniFactors (Aeval[j], evalPoint, v); 1958 1958 LCs= CFList(); 1959 1959 for (iter= Aeval[j]; iter.hasItem(); iter++) 1960 1960 LCs.append (LC (iter.getItem(), 1)); 1961 normalize (LCs);1961 //normalize (LCs); 1962 1962 Aeval[j]= LCs; 1963 1963 }
Note: See TracChangeset
for help on using the changeset viewer.