Changeset 542685e in git
- Timestamp:
- Oct 20, 2014, 2:55:51 PM (9 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- 06f38e104526d5f14601428e461a6877c1d43d66
- Parents:
- 1965800c56ab5ae85bbaa4c89cbae5719bd81515
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-10-20 14:55:51+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-10-22 13:55:04+02:00
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/schreyer.lib
r196580 r542685e 2188 2188 exportto(Schreyer, Syzextra::ComputeSyzygy); 2189 2189 2190 exportto(Schreyer, Syzextra::ComputeResolution); 2190 exportto(Schreyer, Syzextra::ComputeResolution); 2191 2192 // newstruct("SRESOLUTION","ring _r, resolution _res"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218 2193 // newstruct("SSYZYGY","ring _r, module _syz"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218 2194 // TODO: SSres - return SRESOLUTION? 2195 2196 // system("install","SRESOLUTION","string",SRESOLUTION_string, 1); 2197 // system("install","SRESOLUTION","print",SRESOLUTION_print, 1); 2198 // system("install","SRESOLUTION","list",SRESOLUTION_list, 1); 2199 2200 // system("install","SRESOLUTION","betti",SRESOLUTION_betti, 2); // http://www.singular.uni-kl.de/Manual/latest/sing_260.htm#SEC299 2201 // system("install","SRESOLUTION","minres",SRESOLUTION_minres, 1); // http://www.singular.uni-kl.de/Manual/latest/sing_344.htm#SEC383 2202 2203 // TODO: SSsyz? SSYZYGY? // TODO: C/C++ computation for Syzygy? 2204 // system("install","SSYZYGY","string",SSYZYGY_string, 1); 2205 // system("install","SSYZYGY","print",SSYZYGY_print, 1); 2206 // system("install","SSYZYGY","module",SSYZYGY_module, 1); 2191 2207 } 2192 2208 -
Singular/dyn_modules/syzextra/syzextra.cc
r196580 r542685e 526 526 for(TReducers::const_iterator vit = v.begin(); (vit != v.end()) && coprime; ++vit ) 527 527 { 528 assume( m_L->m[(*vit)->m_label] == (*vit)->m_lt);529 530 const poly p = (*vit)-> m_lt;528 assume( (*vit)->CheckLT( m_L ) ); 529 530 const poly p = (*vit)->lt(); 531 531 532 532 assume( p_GetComp(p, r) == comp ); … … 551 551 poly ss = p_LmInit(t, r); 552 552 p_SetCoeff0(ss, n_Init(1, r), r); // for delete & printout only!... 553 p_SetComp(ss, (*vit)-> m_label+ 1, r); // coeff?553 p_SetComp(ss, (*vit)->label() + 1, r); // coeff? 554 554 p_Setm(ss, r); 555 555 … … 567 567 } 568 568 569 assume( p == (*vit)->lt() ); 570 assume( (*vit)->CheckLT( m_L ) ); 569 571 } 570 572 … … 925 927 poly SchreyerSyzygyComputation::TraverseNF(const poly a, const poly a2) const 926 928 { 929 #ifndef SING_NDEBUG 930 if( __DEBUG__ ) 931 { 932 m_div.Verify(); 933 m_checker.Verify(); 934 } 935 #endif 936 927 937 const ideal& L = m_idLeads; 928 938 const ideal& T = m_idTails; … … 937 947 assume( a != NULL ); 938 948 949 #ifndef SING_NDEBUG 950 if( __DEBUG__ ) 951 { 952 PrintS("SchreyerSyzygyComputation::TraverseNF(syz_lead, poly syz_2), \n"); 953 PrintS("syz_lead: \n"); 954 dPrint(a, R, R, 1); 955 PrintS("syz_2: \n"); 956 dPrint(a2, R, R, 1); 957 PrintLn(); 958 } 959 #endif 960 939 961 if( __TREEOUTPUT__ ) 940 962 { … … 947 969 poly t = TraverseTail(aa, r); 948 970 971 #ifndef SING_NDEBUG 972 if( __DEBUG__ ) 973 { 974 m_div.Verify(); 975 m_checker.Verify(); 976 } 977 #endif 978 949 979 if( a2 != NULL ) 950 980 { … … 968 998 PrintS("]},"); 969 999 1000 #ifndef SING_NDEBUG 1001 if( __DEBUG__ ) 1002 { 1003 m_div.Verify(); 1004 m_checker.Verify(); 1005 } 1006 #endif 970 1007 } else 971 1008 t = p_Add_q(t, ReduceTerm(aa, L->m[r], a), R); … … 977 1014 if( __TREEOUTPUT__ ) 978 1015 { 979 PrintS("], \"noderesult\": \""); writeLatexTerm(t, R, true, false); PrintS("\" },"); 980 } 1016 poly tt = pp_Add_qq( a, t, R); // TODO: ADD a? 1017 PrintS("], \"noderesult\": \""); writeLatexTerm(tt, R, true, false); PrintS("\", \"proc\": \"TraverseNF\" },"); 1018 p_Delete(&tt, R); 1019 } 1020 #ifndef SING_NDEBUG 1021 if( __DEBUG__ ) 1022 { 1023 PrintS("SchreyerSyzygyComputation::TraverseNF(syz_lead, poly syz_2), ==>>> \n"); 1024 dPrint(t, R, R, 0); 1025 PrintLn(); 1026 } 1027 #endif 1028 1029 #ifndef SING_NDEBUG 1030 if( __DEBUG__ ) 1031 { 1032 m_div.Verify(); 1033 m_checker.Verify(); 1034 } 1035 #endif 1036 981 1037 return t; 982 1038 } 983 1039 984 985 1040 void SchreyerSyzygyComputation::ComputeSyzygy() 986 1041 { 1042 #ifndef SING_NDEBUG 1043 if( __DEBUG__ ) 1044 { 1045 m_div.Verify(); 1046 m_checker.Verify(); 1047 } 1048 #endif 1049 987 1050 assume( m_idLeads != NULL ); 988 1051 assume( m_idTails != NULL ); … … 1084 1147 #endif 1085 1148 1086 for( int k = size - 1; k >= 0; k-- ) 1149 #ifndef SING_NDEBUG 1150 if( __DEBUG__ ) 1151 { 1152 m_div.Verify(); 1153 m_checker.Verify(); 1154 } 1155 #endif 1156 1157 // for( int k = 0; k < size; ++k ) // TODO: reversed order =>> ALL wrong :(((( 1158 for( int k = size - 1; k >= 0; --k ) 1087 1159 { 1088 1160 const poly a = LL->m[k]; assume( a != NULL ); … … 1108 1180 // TT->m[k] = a2; 1109 1181 1182 #ifndef SING_NDEBUG 1183 if( __DEBUG__ ) 1184 { 1185 m_div.Verify(); 1186 m_checker.Verify(); 1187 } 1188 #endif 1189 1190 poly nf; 1191 1110 1192 if( method ) 1111 TT->m[k]= SchreyerSyzygyNF(a, a2);1193 nf = SchreyerSyzygyNF(a, a2); 1112 1194 else 1113 TT->m[k] = TraverseNF(a, a2); // TODO: WRONG 1195 nf = TraverseNF(a, a2); // TODO: WRONG 1196 1197 #ifndef SING_NDEBUG 1198 if( __DEBUG__ ) 1199 { 1200 m_div.Verify(); 1201 m_checker.Verify(); 1202 } 1203 #endif 1204 1205 TT->m[k] = nf; // ??? 1206 1207 #ifndef SING_NDEBUG 1208 if( __DEBUG__ ) 1209 { 1210 m_div.Verify(); 1211 m_checker.Verify(); 1212 } 1213 #endif 1114 1214 1115 1215 if( __SYZCHECK__ ) 1116 1216 { 1217 #ifndef SING_NDEBUG 1218 if( __DEBUG__ ) 1219 { 1220 m_div.Verify(); 1221 m_checker.Verify(); 1222 } 1223 #endif 1117 1224 // TODO: check the correctness (syzygy property): a + TT->m[k] should be a syzygy!!! 1118 1225 … … 1121 1228 poly vp = p_VectorProductLT(s, L, T, R); 1122 1229 1123 if( (__DEBUG__ | __TREEOUTPUT__) && (vp != NULL))1230 if( __DEBUG__ && (vp != NULL) && ! __TREEOUTPUT__ ) 1124 1231 { 1125 1232 Warn("SchreyerSyzygyComputation::ComputeSyzygy: failed syzygy property for syzygy [%d], non-zero image is as follows: ", k); … … 1137 1244 s = TraverseNF(a, a2); 1138 1245 1139 s = p_Add_q( a, s, R); // another syzygy1246 s = p_Add_q( p_Copy(a, R), s, R); // another syzygy // :(((( 1140 1247 PrintS("SchreyerSyzygyComputation::ComputeSyzygy: The other method gives the following syzygy: "); 1141 1248 dPrint(s, R, R, 0); … … 1151 1258 dPrint(vp, R, R, 0); 1152 1259 } 1260 1261 #ifndef SING_NDEBUG 1262 if( __DEBUG__ ) 1263 { 1264 m_div.Verify(); 1265 m_checker.Verify(); 1266 } 1267 #endif 1153 1268 1154 1269 } else … … 1158 1273 } 1159 1274 1275 #ifndef SING_NDEBUG 1276 if( __DEBUG__ ) 1277 { 1278 m_div.Verify(); 1279 m_checker.Verify(); 1280 } 1281 #endif 1160 1282 } 1161 1283 … … 1220 1342 } 1221 1343 1222 #define NOPRODUCT 11344 #define NOPRODUCT 0 1223 1345 1224 1346 poly SchreyerSyzygyComputation::SchreyerSyzygyNF(const poly syz_lead, poly syz_2) const 1225 1347 { 1226 1227 1348 assume( !__IGNORETAILS__ ); 1228 1349 … … 1233 1354 assume( syz_lead != NULL ); 1234 1355 1356 1357 #ifndef SING_NDEBUG 1358 if( __DEBUG__ ) 1359 { 1360 PrintS("SchreyerSyzygyComputation::SchreyerSyzygyNF(syz_lead, poly syz_2), \n"); 1361 PrintS("syz_lead: \n"); 1362 dPrint(syz_lead, r, r, 1); 1363 PrintS("syz_2: \n"); 1364 dPrint(syz_2, r, r, 1); 1365 PrintLn(); 1366 } 1367 #endif 1368 1235 1369 if( __TREEOUTPUT__ ) 1236 1370 { 1237 // PrintS("%%%% BEGIN LIFTHYBRID DIAGRAMM\n");1238 PrintS(" { \"nodelabel\": \""); writeLatexTerm(syz_lead, r); PrintS("\", \"children\": [");1371 PrintS("{ \"nodelabel\": \""); writeLatexTerm(syz_lead, r); 1372 PrintS("\", \"children\": ["); 1239 1373 } 1240 1374 … … 1259 1393 if( __TREEOUTPUT__ ) 1260 1394 { 1261 PrintS("{ \"nodelabel\": \""); writeLatexTerm(syz_2, r); PrintS("\", \"edgelab le\": \""); writeLatexTerm(aa, r, false); PrintS("\" },");1395 PrintS("{ \"nodelabel\": \""); writeLatexTerm(syz_2, r); PrintS("\", \"edgelabel\": \""); writeLatexTerm(aa, r, false); PrintS("\" },"); 1262 1396 } 1263 1397 … … 1329 1463 if( __TREEOUTPUT__ ) 1330 1464 { 1331 PrintS("{ \"nodelabel\": \""); writeLatexTerm(t, r); PrintS("\", \"edgelab le\": \""); writeLatexTerm(spoly, r, false); PrintS("\" },");1465 PrintS("{ \"nodelabel\": \""); writeLatexTerm(t, r); PrintS("\", \"edgelabel\": \""); writeLatexTerm(spoly, r, false); PrintS("\" },"); 1332 1466 } 1333 1467 … … 1355 1489 } 1356 1490 1491 #ifndef SING_NDEBUG 1492 if( __DEBUG__ ) 1493 { 1494 PrintS("SchreyerSyzygyComputation::SchreyerSyzygyNF(syz_lead, poly syz_2) =>>> \n"); 1495 dPrint(result, r, r, 0); 1496 PrintLn(); 1497 // TODO: Add SyzCheck!!!??? 1498 } 1499 #endif 1357 1500 1358 1501 return result; … … 1369 1512 poly SchreyerSyzygyComputation::TraverseTail(poly multiplier, const int tail) const 1370 1513 { 1514 #ifndef SING_NDEBUG 1515 if( __DEBUG__ ) 1516 { 1517 m_div.Verify(); 1518 m_checker.Verify(); 1519 } 1520 #endif 1521 1371 1522 const ring& r = m_rBaseRing; 1372 1523 … … 1399 1550 { 1400 1551 // PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); 1401 // Print(" \\\\cdot \\\\GEN{%d}\", \"children\": [ ", tail + 1); 1402 Print("{ \"lookedupnode\": \"1\", \"nodelabel\": \""); 1403 writeLatexTerm(p, r, true, false); 1552 // Print(" \\\\GEN{%d}\", \"children\": [ ", tail + 1); 1553 PrintS("{ \"proc\": \"TraverseTail-lookup\", \"nodelabel\": \""); 1554 writeLatexTerm(multiplier, r, false); Print(" \\\\GEN{%d}\", \"look-up-poly\": \"", tail + 1); 1555 writeLatexTerm(p, r, true, false); 1556 PrintS("\", "); 1404 1557 } 1405 1558 … … 1411 1564 1412 1565 if( __TREEOUTPUT__ ) 1413 Print ("\", \"RESCALEDRESULT\": \"1\" },");1566 PrintS("\"rescale\": \"1\", "); 1414 1567 } else 1415 1568 { 1416 1569 if( __TREEOUTPUT__ ) 1417 Print ("\", \"RESCALEDRESULT\": \"0\" },");1570 PrintS("\"rescale\": \"0\", "); 1418 1571 } 1419 1572 1573 if( __TREEOUTPUT__ ) 1574 { 1575 PrintS("\"noderesult\": \""); 1576 writeLatexTerm(p, r, true, false); 1577 PrintS("\" },"); 1578 } 1579 1580 #ifndef SING_NDEBUG 1581 if( __DEBUG__ ) 1582 { 1583 m_div.Verify(); 1584 m_checker.Verify(); 1585 } 1586 #endif 1587 1420 1588 return p; 1421 1589 } 1422 1590 1591 1423 1592 if( __TREEOUTPUT__ ) 1424 1593 { 1425 // PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\cdot\\\\GEN{%d}\", \"children\": [", tail + 1);1594 PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\GEN{%d}\", \"children\": [", tail + 1); 1426 1595 } 1427 1596 1428 1597 const poly p = ComputeImage(multiplier, tail); 1598 1429 1599 T.insert( TP2PCache::value_type(p_Copy(multiplier, r), p) ); // T[ multiplier ] = p; 1430 1600 … … 1434 1604 if( __TREEOUTPUT__ ) 1435 1605 { 1436 // PrintS("], \"storedResult\": \""); writeLatexTerm(p, r, true, false); PrintS("\" },");1606 PrintS("], \"noderesult\": \""); writeLatexTerm(p, r, true, false); PrintS("\", \"proc\": \"TraverseTail-compute-and-store1\" },"); 1437 1607 } 1438 1608 1609 #ifndef SING_NDEBUG 1610 if( __DEBUG__ ) 1611 { 1612 m_div.Verify(); 1613 m_checker.Verify(); 1614 } 1615 #endif 1616 1439 1617 return p_Copy(p, r); 1440 1618 } … … 1444 1622 if( __TREEOUTPUT__ ) 1445 1623 { 1446 // PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\cdot\\\\GEN{%d}\", \"children\": [", tail + 1);1624 PrintS("{ \"nodelabel\": \""); writeLatexTerm(multiplier, r, false); Print(" \\\\GEN{%d}\", \"children\": [", tail + 1); 1447 1625 } 1448 1626 … … 1459 1637 if( __TREEOUTPUT__ ) 1460 1638 { 1461 // PrintS("], \"storedResult\": \""); writeLatexTerm(p, r, true, false); PrintS("\" },"); 1462 } 1639 PrintS("], \"noderesult\": \""); writeLatexTerm(p, r, true, false); PrintS("\", \"proc\": \"TraverseTail-compute-and-store2\" },"); 1640 } 1641 1642 #ifndef SING_NDEBUG 1643 if( __DEBUG__ ) 1644 { 1645 m_div.Verify(); 1646 m_checker.Verify(); 1647 } 1648 #endif 1463 1649 1464 1650 return p_Copy(p, r); … … 1478 1664 poly SchreyerSyzygyComputation::TraverseTail(poly multiplier, poly tail) const 1479 1665 { 1666 #ifndef SING_NDEBUG 1667 if( __DEBUG__ ) 1668 { 1669 m_div.Verify(); 1670 m_checker.Verify(); 1671 } 1672 #endif 1673 1480 1674 assume( !__IGNORETAILS__ ); 1481 1675 … … 1518 1712 sBucketClearAdd(sum, &s, &len); 1519 1713 assume( pLength(s) == len ); 1714 #ifndef SING_NDEBUG 1715 if( __DEBUG__ ) 1716 { 1717 m_div.Verify(); 1718 m_checker.Verify(); 1719 } 1720 #endif 1721 1520 1722 return s; 1521 1723 } 1522 1724 1725 #ifndef SING_NDEBUG 1726 if( __DEBUG__ ) 1727 { 1728 m_div.Verify(); 1729 m_checker.Verify(); 1730 } 1731 #endif 1732 1523 1733 return NULL; 1524 1734 … … 1530 1740 poly SchreyerSyzygyComputation::ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck) const 1531 1741 { 1742 #ifndef SING_NDEBUG 1743 if( __DEBUG__ ) 1744 { 1745 m_div.Verify(); 1746 m_checker.Verify(); 1747 } 1748 #endif 1749 1532 1750 assume( !__IGNORETAILS__ ); 1533 1751 … … 1550 1768 #if NOPRODUCT 1551 1769 s = m_div.FindReducer(multiplier, term4reduction, syztermCheck, m_checker); 1552 1770 1553 1771 if( s == NULL ) // No Reducer? 1554 1772 return s; … … 1556 1774 if( __TREEOUTPUT__ ) 1557 1775 { 1558 PrintS("{ \"nodelabel\": \""); writeLatexTerm(s, r); 1776 poly product = pp_Mult_mm(multiplier, term4reduction, r); 1777 PrintS("{ \"proc\": \"ReduceTerm-NOPRODUCT\", \"nodelabel\": \""); writeLatexTerm(s, r); PrintS("\", \"edgelabel\": \""); writeLatexTerm(product, r, false); 1778 p_Delete(&product, r); 1559 1779 } 1560 1780 … … 1562 1782 // NOTE: only LT(term4reduction) should be used in the following: 1563 1783 poly product = pp_Mult_mm(multiplier, term4reduction, r); 1564 s = m_div.FindReducer(product, syztermCheck, m_checker); 1784 s = m_div.FindReducer(product, syztermCheck, m_checker); // ?? 1565 1785 1566 1786 if( s == NULL ) // No Reducer? … … 1569 1789 if( __TREEOUTPUT__ ) 1570 1790 { 1571 PrintS("{ \" nodelabel\": \""); writeLatexTerm(s, r); PrintS("\", \"edgelable\": \""); writeLatexTerm(product, r, false);1791 PrintS("{ \"proc\": \"ReduceTerm-PRODUCT\", \"nodelabel\": \""); writeLatexTerm(s, r); PrintS("\", \"edgelabel\": \""); writeLatexTerm(product, r, false); 1572 1792 } 1573 1793 … … 1576 1796 } 1577 1797 1798 #ifndef SING_NDEBUG 1799 if( __DEBUG__ ) 1800 { 1801 m_div.Verify(); 1802 m_checker.Verify(); 1803 } 1804 #endif 1805 1806 #ifndef SING_NDEBUG 1807 if( __DEBUG__ ) 1808 { 1809 m_div.Verify(); 1810 m_checker.Verify(); 1811 } 1812 #endif 1813 1578 1814 if( s == NULL ) // No Reducer? 1579 1815 return s; … … 1602 1838 } 1603 1839 1840 #ifndef SING_NDEBUG 1841 if( __DEBUG__ ) 1842 { 1843 m_div.Verify(); 1844 m_checker.Verify(); 1845 } 1846 #endif 1847 1848 1604 1849 return s; 1605 1850 } … … 1641 1886 CLeadingTerm::CLeadingTerm(unsigned int _label, const poly _lt, const ring R): 1642 1887 m_sev( p_GetShortExpVector(_lt, R) ), m_label( _label ), m_lt( _lt ) 1643 { } 1888 #ifndef SING_NDEBUG 1889 , _R(R), m_lt_copy( p_Copy(_lt, R) ) 1890 #endif 1891 1892 { 1893 assume( pNext(_lt) == NULL ); 1894 assume( sev() == p_GetShortExpVector(lt(), R) ); 1895 } 1896 1897 CLeadingTerm::~CLeadingTerm() 1898 { 1899 #ifndef SING_NDEBUG 1900 assume( p_EqualPolys(m_lt, m_lt_copy, _R) ); 1901 assume( m_sev == p_GetShortExpVector(m_lt, _R) ); 1902 1903 poly p = const_cast<poly>(m_lt_copy); 1904 p_Delete(&p, _R); 1905 #endif 1906 } 1907 1908 poly CLeadingTerm::lt() const 1909 { 1910 #ifndef SING_NDEBUG 1911 // assume( (long)(*m_lt) == (long)(*m_lt_copy) ); 1912 assume( p_EqualPolys(m_lt, m_lt_copy, _R) ); 1913 assume( m_sev == p_GetShortExpVector(m_lt, _R) ); 1914 #endif 1915 return m_lt; 1916 } 1917 unsigned long CLeadingTerm::sev() const 1918 { 1919 #ifndef SING_NDEBUG 1920 assume( p_EqualPolys(m_lt, m_lt_copy, _R) ); 1921 assume( m_sev == p_GetShortExpVector(m_lt, _R) ); 1922 #endif 1923 return m_sev; 1924 } 1925 1926 unsigned int CLeadingTerm::label() const 1927 { 1928 #ifndef SING_NDEBUG 1929 assume( p_EqualPolys(m_lt, m_lt_copy, _R) ); 1930 assume( m_sev == p_GetShortExpVector(m_lt, _R) ); 1931 #endif 1932 return m_label; 1933 } 1934 1644 1935 1645 1936 … … 1735 2026 } 1736 2027 2028 2029 bool CLeadingTerm::CheckLT( const ideal & L ) const 2030 { 2031 // for( int i = IDELEMS(L); i >= 0; --i) assume( pNext(L->m[i]) == NULL ); // ??? 2032 return ( L->m[label()] == lt() ); 2033 } 2034 1737 2035 bool CLeadingTerm::DivisibilityCheck(const poly product, const unsigned long not_sev, const ring r) const 1738 2036 { 1739 const poly p = m_lt; 1740 1741 assume( p_GetComp(p, r) == p_GetComp(product, r) ); 1742 1743 // const int k = m_label; 2037 // may have no coeff yet 2038 // assume ( !n_IsZero( p_GetCoeff(product, r), r ) ); 2039 2040 assume ( !n_IsZero( p_GetCoeff(lt(), r), r ) ); 2041 assume( sev() == p_GetShortExpVector(lt(), r) ); 2042 2043 assume( product != NULL ); 2044 assume( (p_GetComp(lt(), r) == p_GetComp(product, r)) || (p_GetComp(lt(), r) == 0) ); 2045 2046 #ifndef SING_NDEBUG 2047 assume( r == _R ); 2048 #endif 2049 2050 // const int k = label(); 1744 2051 // assume( m_L->m[k] == p ); 1745 2052 1746 const unsigned long p_sev = m_sev; 1747 1748 assume( p_sev == p_GetShortExpVector(p, r) ); 1749 1750 return p_LmShortDivisibleByNoComp(p, p_sev, product, not_sev, r); 2053 return p_LmShortDivisibleByNoComp(lt(), sev(), product, not_sev, r); 1751 2054 1752 2055 } … … 1756 2059 bool CLeadingTerm::DivisibilityCheck(const poly m, const poly t, const unsigned long not_sev, const ring r) const 1757 2060 { 1758 const poly p = m_lt; 1759 1760 assume( p_GetComp(p, r) == p_GetComp(t, r) ); 2061 assume ( !n_IsZero( p_GetCoeff(lt(), r), r ) ); 2062 assume( sev() == p_GetShortExpVector(lt(), r) ); 2063 2064 assume( m != NULL ); 2065 assume( t != NULL ); 2066 assume ( !n_IsZero( p_GetCoeff(m, r), r ) ); 2067 assume ( !n_IsZero( p_GetCoeff(t, r), r ) ); 2068 1761 2069 // assume( p_GetComp(m, r) == 0 ); 1762 1763 // const int k = m_label; 2070 assume( (p_GetComp(lt(), r) == p_GetComp(t, r)) || (p_GetComp(lt(), r) == 0) ); 2071 2072 // const int k = label(); 1764 2073 // assume( m_L->m[k] == p ); 1765 2074 1766 const unsigned long p_sev = m_sev; 1767 assume( p_sev == p_GetShortExpVector(p, r) ); 1768 1769 if (p_sev & not_sev) 2075 #ifndef SING_NDEBUG 2076 assume( r == _R ); 2077 #endif 2078 2079 if (sev() & not_sev) 1770 2080 return false; 1771 2081 1772 return _p_LmDivisibleByNoComp(p, m, t, r); 1773 2082 return _p_LmDivisibleByNoComp(lt(), m, t, r); 1774 2083 // return p_LmShortDivisibleByNoComp(p, p_sev, product, not_sev, r); 1775 1776 2084 } 1777 2085 … … 1803 2111 { 1804 2112 assume( m_comp >= 0 ); 1805 assume( m_reds.m_L != NULL ); 2113 assume( m_reds.m_L != NULL ); /// TODO: m_L should stay the same!!! 2114 2115 assume( product != NULL ); // may have no coeff yet :( 2116 // assume ( !n_IsZero( p_GetCoeff(product, m_rBaseRing), m_rBaseRing ) ); 2117 #ifndef SING_NDEBUG 2118 if( __DEBUG__ ) 2119 m_reds.Verify(); 2120 #endif 1806 2121 } 1807 2122 … … 1847 2162 for( ; m_current != m_finish; ++m_current ) 1848 2163 { 1849 assume( m_reds.m_L->m[Current().m_label] == Current().m_lt);2164 assume( Current().CheckLT( m_reds.m_L ) ); 1850 2165 1851 2166 if( Current().DivisibilityCheck(m_product, m_not_sev, m_rBaseRing) ) … … 1854 2169 if( __DEBUG__ ) 1855 2170 { 1856 Print("CDivisorEnumerator::MoveNext::est LS: q is divisible by LS[%d] !:((, diviser is: ", 1 + Current(). m_label);1857 dPrint(Current(). m_lt, m_rBaseRing, m_rBaseRing, 1);2171 Print("CDivisorEnumerator::MoveNext::est LS: q is divisible by LS[%d] !:((, diviser is: ", 1 + Current().label()); 2172 dPrint(Current().lt(), m_rBaseRing, m_rBaseRing, 1); 1858 2173 } 1859 2174 #endif 1860 2175 // m_active = true; 2176 assume( Current().CheckLT( m_reds.m_L ) ); 1861 2177 return true; 1862 2178 } 2179 assume( Current().CheckLT( m_reds.m_L ) ); 1863 2180 } 1864 2181 … … 1875 2192 bool CReducerFinder::IsDivisible(const poly product) const 1876 2193 { 2194 #ifndef SING_NDEBUG 2195 if( __DEBUG__ ) 2196 DebugPrint(); 2197 #endif 2198 2199 assume( product != NULL ); 2200 2201 // NOTE: q may have no coeff!!! 2202 1877 2203 CDivisorEnumerator itr(*this, product); 1878 2204 if( !itr.Reset() ) … … 1901 2227 for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ ) 1902 2228 { 1903 assume( m_L->m[(*vit)->m_label] == (*vit)->m_lt);2229 assume( (*vit)->CheckLT( m_L ) ); 1904 2230 1905 2231 if( (*vit)->DivisibilityCheck(product, not_sev, r) ) … … 1907 2233 if( __DEBUG__ ) 1908 2234 { 1909 Print("_FindReducer::Test LS: q is divisible by LS[%d] !:((, diviser is: ", 1 + (*vit)-> m_label);1910 dPrint((*vit)-> m_lt, r, r, 1);2235 Print("_FindReducer::Test LS: q is divisible by LS[%d] !:((, diviser is: ", 1 + (*vit)->label()); 2236 dPrint((*vit)->lt(), r, r, 1); 1911 2237 } 1912 2238 … … 1921 2247 1922 2248 #ifndef SING_NDEBUG 2249 void CReducerFinder::Verify() const 2250 { 2251 const ring& r = m_rBaseRing; 2252 2253 for( CReducersHash::const_iterator it = m_hash.begin(); it != m_hash.end(); it++) 2254 { 2255 const TReducers& reducers = it->second; 2256 2257 for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ ) 2258 { 2259 assume( (*vit)->CheckLT( m_L ) ); 2260 2261 const poly p = (*vit)->lt(); 2262 2263 const unsigned long p_sev = (*vit)->sev(); 2264 assume( p_sev == p_GetShortExpVector(p, r) ); 2265 2266 assume( p_GetComp(p, r) == it->first ); 2267 2268 const int k = (*vit)->label(); 2269 assume( m_L->m[k] == p ); 2270 2271 pp_Test(p, r, r); 2272 } 2273 } 2274 } 2275 2276 2277 1923 2278 void CReducerFinder::DebugPrint() const 1924 2279 { … … 1932 2287 for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ ) 1933 2288 { 1934 const poly p = (*vit)->m_lt; 1935 2289 assume( (*vit)->CheckLT( m_L ) ); 2290 2291 const int k = (*vit)->label(); 2292 const poly p = (*vit)->lt(); 2293 2294 pp_Test(p, r, r); 2295 2296 assume( m_L->m[k] == p ); 2297 2298 const unsigned long p_sev = (*vit)->sev(); 2299 assume( p_sev == p_GetShortExpVector(p, r) ); 2300 1936 2301 assume( p_GetComp(p, r) == it->first ); 1937 2302 1938 const int k = (*vit)->m_label;1939 2303 Print("L[%d]: ", k); dPrint(p, r, r, 0); Print("SEV: %ld\n", p_sev); 2304 1940 2305 assume( m_L->m[k] == p ); 1941 1942 const unsigned long p_sev = (*vit)->m_sev;1943 1944 assume( p_sev == p_GetShortExpVector(p, r) );1945 1946 Print("L[%d]: ", k); dPrint(p, r, r, 0); Print("SEV: %ld\n", p_sev);1947 2306 } 1948 2307 } … … 1978 2337 assume( m_multiplier != NULL ); 1979 2338 assume( m_term != NULL ); 2339 2340 assume( m != NULL ); 2341 assume( t != NULL ); 2342 assume ( !n_IsZero( p_GetCoeff(m, m_rBaseRing), m_rBaseRing ) ); 2343 assume ( !n_IsZero( p_GetCoeff(t, m_rBaseRing), m_rBaseRing ) ); 2344 1980 2345 // assume( p_GetComp(m_multiplier, m_rBaseRing) == 0 ); 2346 #ifndef SING_NDEBUG 2347 if( __DEBUG__ ) 2348 m_reds.Verify(); 2349 #endif 1981 2350 } 1982 2351 … … 2022 2391 for( ; m_current != m_finish; ++m_current ) 2023 2392 { 2024 assume( m_reds.m_L->m[Current().m_label] == Current().m_lt);2393 assume( Current().CheckLT( m_reds.m_L ) ); 2025 2394 2026 2395 if( Current().DivisibilityCheck(m_multiplier, m_term, m_not_sev, m_rBaseRing) ) … … 2029 2398 if( __DEBUG__ ) 2030 2399 { 2031 Print("CDivisorEnumerator::MoveNext::est LS: q is divisible by LS[%d] !:((, diviser is: ", 1 + Current(). m_label);2032 dPrint(Current(). m_lt, m_rBaseRing, m_rBaseRing, 1);2400 Print("CDivisorEnumerator::MoveNext::est LS: q is divisible by LS[%d] !:((, diviser is: ", 1 + Current().label()); 2401 dPrint(Current().lt(), m_rBaseRing, m_rBaseRing, 1); 2033 2402 } 2034 2403 #endif 2035 2404 // m_active = true; 2405 assume( Current().CheckLT( m_reds.m_L ) ); 2036 2406 return true; 2037 2407 2038 2408 } 2409 assume( Current().CheckLT( m_reds.m_L ) ); 2039 2410 } 2040 2411 … … 2051 2422 const CReducerFinder& syz_checker) const 2052 2423 { 2424 #ifndef SING_NDEBUG 2425 if( __DEBUG__ ) 2426 { 2427 DebugPrint(); 2428 syz_checker.Verify(); 2429 } 2430 #endif 2431 2053 2432 CDivisorEnumerator2 itr(*this, multiplier, t); 2054 2433 if( !itr.Reset() ) … … 2072 2451 if (__DEBUG__ && (syzterm != NULL)) 2073 2452 { 2074 const poly m = L->m[c]; 2075 2076 assume( m != NULL ); assume( pNext(m) == NULL ); 2077 2078 poly lm = p_Mult_mm(leadmonom(syzterm, r), m, r); 2079 2080 poly pr = p_Mult_q( leadmonom(multiplier, r, false), leadmonom(t, r, false), r); 2081 2082 assume( p_EqualPolys(lm, pr, r) ); 2453 const poly m = L->m[c]; assume( m != NULL ); assume( pNext(m) == NULL ); 2083 2454 2084 2455 // def @@c = leadcomp(syzterm); int @@r = int(@@c); 2085 2456 // def @@product = leadmonomial(syzterm) * L[@@r]; 2457 poly lm = p_Mult_mm( leadmonom(syzterm, r, true), m, r); // !NC :( 2458 poly pr = p_Mult_q( leadmonom(multiplier, r, true), leadmonom(t, r, false), r); // !NC :( 2459 2460 assume( p_EqualPolys(lm, pr, r) ); 2086 2461 2087 2462 p_Delete(&lm, r); … … 2089 2464 } 2090 2465 2466 #ifndef SING_NDEBUG 2467 if( __DEBUG__ ) 2468 { 2469 DebugPrint(); 2470 syz_checker.Verify(); 2471 } 2472 #endif 2473 2091 2474 const BOOLEAN to_check = (syz_checker.IsNonempty()); // __TAILREDSYZ__ && 2092 2475 … … 2098 2481 while( itr.MoveNext() ) 2099 2482 { 2100 const poly p = itr.Current().m_lt; 2101 const int k = itr.Current().m_label; 2483 assume( itr.Current().CheckLT( L ) ); // ??? 2484 2485 const poly p = itr.Current().lt(); // ??? 2486 const int k = itr.Current().label(); 2102 2487 2103 2488 p_ExpVectorSum(q, multiplier, t, r); // q == product == multiplier * t // TODO: do it once? … … 2118 2503 } 2119 2504 #endif 2505 assume( itr.Current().CheckLT( L ) ); // ??? 2120 2506 continue; 2121 2507 } … … 2130 2516 } 2131 2517 #endif 2518 assume( itr.Current().CheckLT( L ) ); // ??? 2132 2519 continue; 2133 2520 } … … 2137 2524 n_Delete(&n, r); 2138 2525 2526 #ifndef SING_NDEBUG 2527 if( __DEBUG__ ) 2528 { 2529 DebugPrint(); 2530 syz_checker.Verify(); 2531 } 2532 #endif 2533 2534 assume( itr.Current().CheckLT( L ) ); // ??? 2139 2535 return q; 2140 2536 } … … 2168 2564 { 2169 2565 2170 const poly p = (*vit)-> m_lt;2171 const int k = (*vit)-> m_label;2172 2173 assume( L->m[k] == p ); 2174 2175 // const unsigned long p_sev = (*vit)-> m_sev;2566 const poly p = (*vit)->lt(); // ?? 2567 const int k = (*vit)->label(); 2568 2569 assume( L->m[k] == p ); // CheckLT 2570 2571 // const unsigned long p_sev = (*vit)->sev(); 2176 2572 // assume( p_sev == p_GetShortExpVector(p, r) ); 2177 2573 … … 2226 2622 2227 2623 p_LmFree(q, r); 2624 2625 #ifndef SING_NDEBUG 2626 if( __DEBUG__ ) 2627 { 2628 DebugPrint(); 2629 syz_checker.Verify(); 2630 } 2631 #endif 2228 2632 2229 2633 return NULL; … … 2234 2638 poly CReducerFinder::FindReducer(const poly product, const poly syzterm, const CReducerFinder& syz_checker) const 2235 2639 { 2640 2641 #ifndef SING_NDEBUG 2642 if( __DEBUG__ ) 2643 { 2644 DebugPrint(); 2645 syz_checker.Verify(); 2646 } 2647 #endif 2648 2236 2649 CDivisorEnumerator itr(*this, product); 2237 2650 if( !itr.Reset() ) … … 2239 2652 2240 2653 2654 2241 2655 const ring& r = m_rBaseRing; 2242 2656 … … 2267 2681 } 2268 2682 2683 #ifndef SING_NDEBUG 2684 if( __DEBUG__ ) 2685 { 2686 DebugPrint(); 2687 syz_checker.Verify(); 2688 } 2689 #endif 2269 2690 2270 2691 const BOOLEAN to_check = (syz_checker.IsNonempty()); // __TAILREDSYZ__ && … … 2273 2694 2274 2695 if( __DEBUG__ ) 2275 p_SetCoeff0(q, 0, r); // for printing q2696 p_SetCoeff0(q, 0, r); // ONLY for printing q 2276 2697 2277 2698 while( itr.MoveNext() ) 2278 2699 { 2279 const poly p = itr.Current().m_lt; 2280 const int k = itr.Current().m_label; 2700 assume( itr.Current().CheckLT( L ) ); // ??? 2701 2702 const poly p = itr.Current().lt(); // ?? 2703 const int k = itr.Current().label(); 2281 2704 2282 2705 p_ExpVectorDiff(q, product, p, r); // (LM(product) / LM(L[k])) … … 2295 2718 } 2296 2719 #endif 2720 assume( itr.Current().CheckLT( L ) ); // ??? 2297 2721 continue; 2298 2722 } 2299 2723 2300 2724 // while the complement (the fraction) is not reducible by leading syzygies 2301 if( to_check && syz_checker.IsDivisible(q) ) 2725 if( to_check && syz_checker.IsDivisible(q) ) // ????? 2302 2726 { 2303 2727 #ifndef SING_NDEBUG … … 2307 2731 } 2308 2732 #endif 2733 assume( itr.Current().CheckLT( L ) ); // ??? 2309 2734 continue; 2310 2735 } … … 2312 2737 p_SetCoeff0(q, n_InpNeg( n_Div( p_GetCoeff(product, r), p_GetCoeff(p, r), r), r), r); 2313 2738 2739 assume( itr.Current().CheckLT( L ) ); // ??? 2740 2741 #ifndef SING_NDEBUG 2742 if( __DEBUG__ ) 2743 { 2744 DebugPrint(); 2745 syz_checker.Verify(); 2746 } 2747 #endif 2748 2314 2749 return q; 2315 2750 } … … 2351 2786 for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ ) 2352 2787 { 2353 const poly p = (*vit)-> m_lt;2788 const poly p = (*vit)->lt(); // ??? 2354 2789 2355 2790 assume( p_GetComp(p, r) == comp ); 2356 2791 2357 const int k = (*vit)-> m_label;2358 2359 assume( L->m[k] == p ); 2360 2361 const unsigned long p_sev = (*vit)-> m_sev;2792 const int k = (*vit)->label(); 2793 2794 assume( L->m[k] == p ); // CheckLT 2795 2796 const unsigned long p_sev = (*vit)->sev(); 2362 2797 2363 2798 assume( p_sev == p_GetShortExpVector(p, r) ); … … 2405 2840 p_LmFree(q, r); 2406 2841 2842 #ifndef SING_NDEBUG 2843 if( __DEBUG__ ) 2844 { 2845 DebugPrint(); 2846 syz_checker.Verify(); 2847 } 2848 #endif 2849 2407 2850 return NULL; 2408 2851 } -
Singular/dyn_modules/syzextra/syzextra.h
r196580 r542685e 125 125 public: 126 126 CLeadingTerm(unsigned int label, const poly lt, const ring); 127 128 public: 127 ~CLeadingTerm(); 128 129 private: 129 130 130 131 const unsigned long m_sev; ///< not short exp. vector 131 // NOTE/TODO: either of the following should be enough: 132 133 // NOTE/TODO: either of the following should be enough: 132 134 const unsigned int m_label; ///< index in the main L[] + 1 135 133 136 const poly m_lt; ///< the leading term itself L[label-1] 134 137 135 public: 138 #ifndef SING_NDEBUG 139 const ring _R; const poly m_lt_copy; ///< original copy of lt (only for debug!!!) 140 #endif 141 142 143 public: 144 136 145 bool DivisibilityCheck(const poly product, const unsigned long not_sev, const ring r) const; 137 146 bool DivisibilityCheck(const poly multiplier, const poly t, const unsigned long not_sev, const ring r) const; 138 147 139 private: 148 bool CheckLT( const ideal & L ) const; 149 150 poly lt() const; 151 unsigned long sev() const; 152 unsigned int label() const; 153 154 private: 155 140 156 // disable the following: 141 157 CLeadingTerm(); … … 181 197 #ifndef SING_NDEBUG 182 198 void DebugPrint() const; 199 void Verify() const; 183 200 #endif 184 201
Note: See TracChangeset
for help on using the changeset viewer.