Changeset 782895 in git
 Timestamp:
 Jan 31, 2013, 12:53:57 PM (10 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
 Children:
 04638b5adf8add17417937d338746c4d9e3ef1ea
 Parents:
 f2341ef871432b85e06790e4045edc08d541f689
 gitauthor:
 Martin Lee <martinlee84@web.de>20130131 12:53:57+01:00
 gitcommitter:
 Martin Lee <martinlee84@web.de>20130218 14:56:49+01:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/facFqFactorize.cc
rf2341ef r782895 49 49 TIMING_DEFINE_PRINT(fac_fq_check_mainvar) 50 50 TIMING_DEFINE_PRINT(fac_fq_compress) 51 52 53 void out_cf(const char *s1,const CanonicalForm &f,const char *s2); 54 void out_cff(CFFList &L); 51 55 52 56 static inline … … 1324 1328 const CFArray& evalPoint) 1325 1329 { 1330 for (int i= 0; i < evalPoint.size(); i++) 1331 out_cf ("evalPoint= ", evalPoint[i], "\n"); 1326 1332 1327 1333 CanonicalForm F= G; … … 1340 1346 CanonicalForm test= evalSqrfPartF.getFirst() (evalPoint[0], 2); 1341 1347 1348 out_cf ("test= ", test, "\n"); 1349 out_cf ("sqrfPartF= ", sqrfPartF, "\n"); 1342 1350 if (degree (test) != degree (sqrfPartF, 1)  test.inCoeffDomain()) 1343 1351 return 0; … … 1381 1389 for (iter= bufSqrfFactors [i]; iter.hasItem(); iter++) 1382 1390 { 1391 out_cf ("bufSqrfFactors[0]= ", iter.getItem().factor(), "\n"); 1383 1392 if (iter.getItem().factor().inCoeffDomain()) 1384 1393 continue; … … 1391 1400 else 1392 1401 { 1402 printf ("i= %d\n", i); 1393 1403 for (iter= bufSqrfFactors [i]; iter.hasItem(); iter++) 1394 1404 { … … 1398 1408 Lc (iter.getItem().factor()), 1399 1409 iter.getItem().exp()); 1410 out_cf ("bufSqrfFactors[i]= ", iter.getItem().factor(), "\n"); 1400 1411 if (!find (factors, iter.getItem().factor())) 1401 1412 factors.append (iter.getItem().factor()); … … 1405 1416 1406 1417 test= prod (factors); 1418 out_cf ("test= ", test, "\n"); 1407 1419 tmp= evalSqrfPartF.getFirst() (evalPoint[0],2); 1420 out_cf ("tmp= ", tmp, "\n"); 1408 1421 if (test/Lc (test) != tmp/Lc (tmp)) 1409 1422 return 0; … … 1419 1432 ) 1420 1433 { 1434 out_cf ("LCF= ", LCF, "\n"); 1435 printf ("LCFFactors.length()= %d\n", LCFFactors.length()); 1436 for (CFListIterator iter= evaluation; iter.hasItem(); iter++) 1437 out_cf ("evaluation= ", iter.getItem(), "\n"); 1438 for (CFListIterator iter= LCFFactors; iter.hasItem(); iter++) 1439 out_cf ("LCFFactors= ", iter.getItem(), "\n"); 1440 1441 for (int j= 0; j < lSecondVarLCs; j++) 1442 { 1443 printf ("differentSecondVar= "); 1444 for (CFListIterator iter= differentSecondVarLCs[j]; iter.hasItem(); iter++) 1445 out_cf ("", iter.getItem(), " "); 1446 printf ("\n"); 1447 } 1421 1448 y= Variable (1); 1422 1449 if (LCF.inCoeffDomain()) … … 1425 1452 for (int i= 1; i <= LCFFactors.length() + 1; i++) 1426 1453 result.append (1); 1454 printf ("exit00\n"); 1427 1455 return result; 1428 1456 } … … 1471 1499 else 1472 1500 { 1473 for (CFListIterator i= result; i.hasItem(); i++)1474 i.getItem() *= LCF;1501 //for (CFListIterator i= result; i.hasItem(); i++) 1502 //result.append (1); 1475 1503 result.insert (LCF); 1476 1504 } 1505 printf ("exit0\n"); 1477 1506 return result; 1478 1507 } … … 1499 1528 buf= swap; 1500 1529 for (int i= 0; i < evaluation.length()  1; i++) 1530 { 1531 out_cf ("buf[i]= ", buf[i], "\n"); 1501 1532 evalPoint[i]= buf[i+1]; 1502 1533 } 1534 out_cf ("buf[i]= ", buf[evaluation.length()1], "\n"); 1503 1535 int pass= testFactors (F, factors, alpha, sqrfPartF, 1504 1536 bufFactors, bufSqrfFactors, evalSqrfPartF, evalPoint); … … 1538 1570 bufBufFactors= bufFactors; 1539 1571 evalPoint= CFArray (evaluation.length()  1); 1540 for (int k= 0; k < evaluation.length()1; k++) 1572 out_cf ("x= ", x, "\n"); 1573 out_cf ("z= ", z, "\n"); 1574 for (int k= 1; k < evaluation.length(); k++) 1541 1575 { 1542 1576 if (N (Variable (k+1)).level() != y.level()) 1543 evalPoint[k ]= buf[k+1];1577 evalPoint[k1]= buf[k]; 1544 1578 else 1545 evalPoint[k]= buf[0]; 1546 } 1579 evalPoint[k1]= buf[0]; 1580 } 1581 printf ("swap war nÃ¶tig\n"); 1582 for (int jj= 0; jj < evalPoint.size(); jj++) 1583 out_cf ("evalPoint= ", evalPoint[jj], "\n"); 1547 1584 pass= testFactors (bufF, bufBufFactors, alpha, sqrfPartF, bufFactors, 1548 1585 bufSqrfFactors, evalSqrfPartF, evalPoint); 1586 //pass= false; 1549 1587 if (pass) 1550 1588 { … … 1565 1603 result.append (1); 1566 1604 result= distributeContent (result, differentSecondVarLCs, lSecondVarLCs); 1567 if (!result.getFirst().inCoeffDomain()) 1605 printf ("this exit\n"); 1606 y= Variable (1); 1607 /*if (!result.getFirst().inCoeffDomain()) 1568 1608 { 1569 1609 CFListIterator iter= result; … … 1573 1613 iter.getItem() *= tmp; 1574 1614 } 1575 y= Variable (1); 1615 y= Variable (1);*/ 1576 1616 delete [] bufSqrfFactors; 1577 1617 return result; … … 1587 1627 result.append (1); 1588 1628 result= distributeContent (result, differentSecondVarLCs, lSecondVarLCs); 1589 if (!result.getFirst().inCoeffDomain()) 1629 printf ("no that exit\n"); 1630 /*if (!result.getFirst().inCoeffDomain()) 1590 1631 { 1591 1632 CFListIterator iter= result; … … 1594 1635 for (; iter.hasItem(); iter++) 1595 1636 iter.getItem() *= tmp; 1596 } 1637 }*/ 1597 1638 y= Variable (1); 1598 1639 delete [] bufSqrfFactors; … … 1746 1787 result.insert (N (F)); 1747 1788 1789 out_cf ("result.getFirst()= ", result.getFirst(), "\n"); 1790 out_cf ("content (result.getFirst())= ", content (result.getFirst()), "\n"); 1791 printf ("foundDifferent= %d\n", foundDifferent); 1792 for (int i= 0; i < lSecondVarLCs; i++) 1793 { 1794 printf ("differentSecondVarLCs "); 1795 for (CFListIterator pp= differentSecondVarLCs[i]; pp.hasItem(); pp++) 1796 out_cf ("", pp.getItem(), " "); 1797 printf ("\n"); 1798 } 1799 for (CFListIterator pp= LCFFactors; pp.hasItem(); pp++) 1800 out_cf ("LCFactors", pp.getItem(), "\n"); 1801 printf ("y.level()= %d\n", y.level()); 1802 printf ("x.level()= %d\n", x.level()); 1803 printf ("z.level()= %d\n", z.level()); 1804 1748 1805 result= distributeContent (result, differentSecondVarLCs, lSecondVarLCs); 1749 1806 1807 for (CFListIterator iter= result; iter.hasItem(); iter++) 1808 out_cf ("result bis kurz vor schluÃ= ", iter.getItem(), "\n"); 1809 1750 1810 if (!result.getFirst().inCoeffDomain()) 1751 1811 { 1752 CFListIterator i= result; 1812 if (foundDifferent) 1813 { 1814 for (CFListIterator i= result; i.hasItem(); i++) 1815 i.getItem()= swapvar (i.getItem(), Variable (2), y); 1816 CFList l= differentSecondVarLCs [j]; //nasty 1817 for (CFListIterator i= l; i.hasItem(); i++) 1818 i.getItem()= swapvar (i.getItem(), y, z); 1819 differentSecondVarLCs [j]= l; 1820 } 1821 printf ("not the whole leading coeff\n"); 1822 out_cf ("result.getFirst()= ", result.getFirst(), "\n"); 1823 out_cf ("y= ", y, "\n"); 1824 out_cf ("LCF= ", LCF, "\n"); 1825 for (int i= 0; i < lSecondVarLCs; i++) 1826 { 1827 printf ("differentSecondVarLCs "); 1828 for (CFListIterator pp= differentSecondVarLCs[i]; pp.hasItem(); pp++) 1829 out_cf ("", pp.getItem(), " "); 1830 printf ("\n"); 1831 } 1832 CFListIterator i; //= result; 1753 1833 CanonicalForm tmp; 1754 if (foundDifferent)1834 /*if (foundDifferent) 1755 1835 i.getItem()= swapvar (i.getItem(), Variable (2), y); 1756 1836 … … 1760 1840 for (; i.hasItem(); i++) 1761 1841 { 1842 out_cf ("lc= ", i.getItem(), "\n"); 1762 1843 if (foundDifferent) 1763 i.getItem()= swapvar (i.getItem(), Variable (2), y)*tmp; 1844 i.getItem()= swapvar (i.getItem(), Variable (2), y); //*tmp; 1845 }*/ 1846 for (i=evaluation; i.hasItem(); i++) 1847 out_cf ("eval= ", i.getItem(), "\n"); 1848 for (int jj= 0; jj < evalPoint.size(); jj++) 1849 out_cf ("evalPoint= ", evalPoint[jj], "\n"); 1850 1851 F= result.getFirst(); 1852 int level= 0; 1853 if (foundDifferent) 1854 level= y.level()  2; 1855 printf ("y.level()= %d\n", y.level()); 1856 printf ("lSecondVarLCs= %d\n", lSecondVarLCs); 1857 backonmygrind: 1858 if (lSecondVarLCs  level > 0) 1859 { 1860 CFList evaluation2= evaluation; 1861 int j= lSecondVarLCs+2; 1862 CanonicalForm swap; 1863 for (i= evaluation2; i.hasItem(); i++, j) 1864 { 1865 if (j==y.level()) 1866 { 1867 swap= i.getItem(); 1868 i.getItem()= evaluation2.getLast(); 1869 evaluation2.removeLast(); 1870 evaluation2.append (swap); 1871 } 1872 } 1873 1874 CFList newLCs= differentSecondVarLCs[level]; 1875 if (newLCs.isEmpty()) 1876 { 1877 level=level+1; 1878 goto backonmygrind; 1879 } 1880 i= newLCs; //kann leer sein!? 1881 CFListIterator iter= result; 1882 iter++; 1883 for (;iter.hasItem(); iter++, i++) 1884 { 1885 swap= iter.getItem(); 1886 if (degree (swap, level+3) > 0) 1887 { 1888 int count= evaluation.length()+1; 1889 for (CFListIterator iter2= evaluation2; iter2.hasItem(); iter2++, count) 1890 { 1891 if (count != level+3) 1892 swap= swap (iter2.getItem(), count); 1893 } 1894 i.getItem() /= swap; 1895 } 1896 } 1897 CFList * differentSecondVarLCs2= new CFList [lSecondVarLCs  level  1]; 1898 for (int j= level+1; j < lSecondVarLCs; j++) 1899 { 1900 if (degree (F, j+3) > 0) 1901 { 1902 differentSecondVarLCs2[j  level  1]= differentSecondVarLCs[j]; 1903 i= differentSecondVarLCs2[jlevel  1]; 1904 iter=result; 1905 iter++; 1906 for (;iter.hasItem(); iter++, i++) 1907 { 1908 swap= iter.getItem(); 1909 if (degree (swap, j+3) > 0) 1910 { 1911 int count= evaluation.length()+1; 1912 for (CFListIterator iter2= evaluation2; iter2.hasItem(); iter2++, count) 1913 { 1914 if (count != j+3) 1915 swap= swap (iter2.getItem(), count); 1916 } 1917 i.getItem() /= swap; 1918 } 1919 } 1920 } 1921 } 1922 1923 for (int j= 0; j < level+1; j++) 1924 evaluation2.removeLast(); 1925 Variable dummyvar= Variable (1); 1926 for (i= evaluation2; i.hasItem(); i++) 1927 out_cf ("evaluation2= ", i.getItem(), "\n"); 1928 for (i= newLCs; i.hasItem(); i++) 1929 out_cf ("newLCs= ", i.getItem(), "\n"); 1930 1931 //// test 1932 CanonicalForm newLCF= result.getFirst(); 1933 newLCF=swapvar (newLCF, Variable (2), Variable (level+3)); 1934 for (i=newLCs; i.hasItem(); i++) 1935 i.getItem()= swapvar (i.getItem(), Variable (2), Variable (level+3)); 1936 for (int j= 0; j < lSecondVarLCslevel1;j++) 1937 { 1938 for (i= differentSecondVarLCs2[j]; i.hasItem(); i++) 1939 i.getItem()= swapvar (i.getItem(), Variable (2+j+1), Variable (level+3+j+1)); 1940 newLCF= swapvar (newLCF, Variable (2+j+1), Variable (level+3+j+1)); 1941 } 1942 //// 1943 for (int j= 0; j < lSecondVarLCslevel1; j++) 1944 { 1945 printf ("differentSecondVarLCs2\n"); 1946 for (i= differentSecondVarLCs2[j]; i.hasItem(); i++) 1947 out_cf ("", i.getItem(), " "); 1948 printf ("\n"); 1949 } 1950 for (i= newLCs; i.hasItem(); i++) 1951 out_cf ("newLCs= ", i.getItem(), "\n"); 1952 out_cf ("newLCF= ", newLCF, "\n"); 1953 printf ("before recursion\n"); 1954 CFList recursiveResult= precomputeLeadingCoeff(newLCF, newLCs, alpha, evaluation2, differentSecondVarLCs2, lSecondVarLCs  level  1, dummyvar); 1955 1956 if (dummyvar.level() != 1) 1957 { 1958 for (i= recursiveResult; i.hasItem(); i++) 1959 i.getItem()= swapvar (i.getItem(), Variable (2), dummyvar); 1960 } 1961 for (i= recursiveResult; i.hasItem(); i++) 1962 { 1963 for (int j= lSecondVarLCslevel1; j > 0; j) 1964 i.getItem()=swapvar (i.getItem(), Variable (2+j), Variable (level+3+j)); 1965 i.getItem()= swapvar (i.getItem(), Variable (2), Variable (level+3)); 1966 } 1967 1968 out_cf ("recursiveResult.getFirst()= ", recursiveResult.getFirst(), "\n"); 1969 if (recursiveResult.getFirst() == result.getFirst()) 1970 { 1971 /*i= result; 1972 i++; 1973 for (; i.hasItem(); i++) 1974 i.getItem() *= tmp;*/ 1975 delete [] bufSqrfFactors; 1976 delete [] differentSecondVarLCs2; 1977 return result; 1978 } 1764 1979 else 1765 i.getItem() *= tmp; 1980 { 1981 CFListIterator iter=recursiveResult; 1982 i= result; 1983 i.getItem()= iter.getItem(); 1984 i++; 1985 iter++; 1986 for (; i.hasItem(); i++, iter++) 1987 { 1988 i.getItem() *= iter.getItem(); 1989 } 1990 for (CFListIterator iter= result; iter.hasItem(); iter++) 1991 out_cf ("result am Ende= ", iter.getItem(), "\n"); 1992 } 1766 1993 } 1767 1994 } … … 2256 2483 CanonicalForm lcmCont= lcmContent (A, contentAi); 2257 2484 A /= lcmCont; 2485 out_cf ("lcmCont= ", lcmCont, "\n"); 2486 for (int i= 1; i <= A.level(); i++) 2487 out_cf ("LC= ", LC (A,i), "\n"); 2258 2488 TIMING_END_AND_PRINT (fac_fq_content, "time to extract content over Fq: "); 2259 2489 … … 2627 2857 A *= tmp; 2628 2858 tmp= leadingCoeffs.getFirst(); 2859 iter= leadingCoeffs; 2860 iter++; 2861 for (;iter.hasItem(); iter++) 2862 iter.getItem() *= tmp; 2629 2863 iter= evaluation; 2630 2864 for (int i= A.level(); i > 2; i, iter++) … … 2641 2875 2642 2876 CanonicalForm LCmultiplier= leadingCoeffs.getFirst(); 2877 out_cf ("LCmultiplier= ", LCmultiplier, "\n"); 2643 2878 bool LCmultiplierIsConst= LCmultiplier.inCoeffDomain(); 2644 2879 leadingCoeffs.removeFirst(); … … 2899 3134 Variable xx; 2900 3135 CFList vars1; 2901 CFFList sqrfMultiplier= sqrFree (LCmultiplier);3136 CFFList sqrfMultiplier= factorize (LCmultiplier); //sqrFree (LCmultiplier); 2902 3137 if (sqrfMultiplier.getFirst().factor().inCoeffDomain()) 2903 3138 sqrfMultiplier.removeFirst(); … … 3069 3304 Variable xx; 3070 3305 CFList vars1; 3071 CFFList sqrfMultiplier= sqrFree (LCmultiplier);3306 CFFList sqrfMultiplier= factorize (LCmultiplier); //sqrFree (LCmultiplier); 3072 3307 if (sqrfMultiplier.getFirst().factor().inCoeffDomain()) 3073 3308 sqrfMultiplier.removeFirst(); … … 3215 3450 tryAgainWithoutHeu: 3216 3451 TIMING_START (fac_fq_shift_to_zero); 3452 out_cf ("LC (A,1)= ", LC (A,1), "\n"); 3453 out_cf ("LC (oldA,1)= ", LC (oldA,1), "\n"); 3217 3454 A= shift2Zero (A, Aeval, evaluation); 3218 3455 … … 3269 3506 if (noOneToOne) 3270 3507 { 3271 3508 printf ("noOneToOne\n"); 3272 3509 if (!LCmultiplierIsConst && LCheuristic) 3273 3510 {
Note: See TracChangeset
for help on using the changeset viewer.