Changeset 90cf60e in git
- Timestamp:
- Oct 14, 2016, 2:30:14 PM (8 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- a85c1546f3be117e077ebe1215bb680cf6023e70
- Parents:
- 81fb5aeadbd51ed0150e244d060d98a3a6637449
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/alexpoly.lib
r81fb5ae r90cf60e 361 361 int n_i,n_j; 362 362 int bad_contact; 363 list newpos; // when reordering the branches, here we save the new order of the old branches 363 list newpos; // when reordering the branches, here we save the new order of the old branches 364 364 for (ii=1;ii<=r;ii++) 365 365 { … … 421 421 newpos=insert(newpos,newpos[j],i-1); 422 422 newpos=delete(newpos,j+1); 423 // BE AWARE: after this reordering the graphs do not have the correct weight for the 424 // strict transform any more; this will be adjusted further down 423 // BE AWARE: after this reordering the graphs do not have the correct weight for the 424 // strict transform any more; this will be adjusted further down 425 425 graphs=insert(graphs,graphs[j],i-1); 426 426 graphs=delete(graphs,j+1); … … 440 440 i=i+1; 441 441 } 442 } 443 // Here we adjust the weights of the strict transforms in the graphs!!! 442 } 443 // Here we adjust the weights of the strict transforms in the graphs!!! 444 444 for (i=1;i<=size(graphs);i++) 445 445 { … … 578 578 { 579 579 list result=rgraph,rtm,rmt; 580 return(result); 580 return(result); 581 581 } 582 582 else // reorder the branches according to the ordering of the input 583 583 { 584 // reordered total multiplicities, multiplicities and resolution graph 584 // reordered total multiplicities, multiplicities and resolution graph 585 585 intmat rtmro[nrows(rtm)][ncols(rtm)]; 586 586 intmat rmtro[nrows(rmt)][ncols(rmt)]; -
Singular/LIB/ncHilb.lib
r81fb5ae r90cf60e 22 22 proc nchilb(list L_wp, int d, list #) 23 23 "USAGE: nchilb(list of relations, an integer, optional); 24 L is a list of modules (each module represents a free-polynomial), 25 d is an integer for the degree bound, 24 L is a list of modules (each module represents a free-polynomial), 25 d is an integer for the degree bound, 26 26 # != NULL for non-finitely generated ideals; 27 27 NOTE : The input ideal needs to be given in special form. It is a list … … 31 31 every next entry is a variable. 32 32 Ex. module p1=[1,y,z],[-1,z,y] represents the poly y*z-z*y; 33 module p2=[1,x,z,x],[-1,z,x,z] represents the poly x*z*x-z*x*z 33 module p2=[1,x,z,x],[-1,z,x,z] represents the poly x*z*x-z*x*z 34 34 for more details about the input, see examples. 35 35 EXAMPLE: example nchilb; shows an example " 36 36 { 37 37 38 if (d<1) 38 if (d<1) 39 39 { 40 40 ERROR("bad degree bound"); 41 41 } 42 42 43 43 def save = basering; 44 44 int sz=size(#); 45 45 int lV=nvars(save); 46 46 47 47 def R =makeLetterplaceRing(d); 48 48 setring R; … … 50 50 poly p; 51 51 poly q=0; 52 // convert list L_wp of free-poly to letterPlace-poly format 52 // convert list L_wp of free-poly to letterPlace-poly format 53 53 setring save; 54 54 module M; … … 56 56 vector w; 57 57 poly pc=0; 58 intvec v; 58 intvec v; 59 59 slm = size(L_wp); // number of polys in the given ideal 60 60 61 61 for (i=1; i<=slm; i++) 62 { 62 { 63 63 M = L_wp[i]; 64 64 sm = ncols(M); // number of words in the free-poly M … … 66 66 { 67 67 w = M[j]; 68 sw = size(w); 68 sw = size(w); 69 69 for (k=2; k<=sw; k++) 70 70 { … … 83 83 setring R; 84 84 I = I,q; //lp-polynomial added to I 85 q=0; //ready for the next polynomial 85 q=0; //ready for the next polynomial 86 86 setring save; 87 87 } … … 89 89 90 90 ideal J = system("freegb",I,d,lV); 91 91 92 92 //Groebner Basis is computed for the given ideal. 93 93 //now compute the leading monomials of the Groebner Basis 94 94 95 95 ideal J_lm; 96 96 for(i=1;i<=size(J);i++) … … 98 98 J_lm[i]=leadmonom(J[i]); 99 99 } 100 100 101 101 setring save; 102 102 def A =makeLetterplaceRing(2*d); 103 103 setring A; 104 104 ideal I=imap(R, J_lm); 105 105 106 106 //compute the Hilbert series 107 107 108 108 if(sz==1) // non-finitely generated case 109 109 { … … 116 116 } 117 117 example 118 { 118 { 119 119 "EXAMPLE:"; echo = 2; 120 120 ring r=0,(x,y,z),dp; … … 123 123 list l1=list(p1,p2); 124 124 nchilb(l1,6,1); //third argument is for non-finitely generated case 125 125 126 126 ring r=0,(x,y,z,w),dp; 127 127 module p1=[1,y,x],[-1,x,y]; //represents the poly y*x-x*y … … 133 133 list l2=list(p1,p2,p3,p4,p5,p6); 134 134 nchilb(l2,5); 135 135 136 136 ring r=0,(X,Y,Z),dp; 137 137 module p1 =[1,Y,Z]; //represents the poly Y*Z … … 145 145 list l3=list(p1,p2,p3,p4,p5,p6,p7,p8); 146 146 nchilb(l3,10); 147 147 148 148 ring r=0,U(1..3),dp; 149 149 module p1=[1,U(2),U(3),U(3)]; … … 171 171 p14,p15,p16,p17,p18,p19,p20,p21); 172 172 nchilb(ll,7,1); 173 173 174 174 ring r=0,(x,y,z),dp; 175 175 module p1=[1,x,z,y,z,x,z]; … … 178 178 module p4=[1,y,z]; 179 179 module p5=[1,x,z,z,x,z]; 180 180 181 181 list l1=list(p1,p2,p3,p4,p5); 182 182 nchilb(l1,7); -
kernel/combinatorics/hilb.cc
r81fb5ae r90cf60e 1402 1402 1403 1403 static void idInsertMonomials(ideal I, poly p) 1404 { 1404 { 1405 1405 /* 1406 1406 * adds monomial in I and if required, … … 1408 1408 * does not make copy of p 1409 1409 */ 1410 1410 1411 1411 if(I == NULL) 1412 1412 { … … 1446 1446 /* 1447 1447 * polynomials of J and Ob are assumed to 1448 * be already sorted. J and Ob are 1448 * be already sorted. J and Ob are 1449 1449 * represented by the minimal generating set 1450 1450 */ … … 1453 1453 int JCount = IDELEMS(J); 1454 1454 int ObCount = IDELEMS(Ob); 1455 1455 1456 1456 if(idIs0(J)) 1457 1457 { 1458 1458 return(1); 1459 1459 } 1460 if(JCount != ObCount) 1460 if(JCount != ObCount) 1461 1461 { 1462 1462 return(0); … … 1469 1469 return(0); 1470 1470 } 1471 } 1471 } 1472 1472 return(s); 1473 1473 } … … 1480 1480 * degree less or equal to tr 1481 1481 */ 1482 1482 1483 1483 //case when I=1; 1484 1484 if(p_Totaldegree(I->m[0], currRing) == 0) … … 1486 1486 return(1); 1487 1487 } 1488 1488 1489 1489 int count = 0; 1490 1490 for(int i = 0; i < IDELEMS(I); i++) … … 1496 1496 count = count + 1; 1497 1497 } 1498 1498 1499 1499 return(count); 1500 1500 } … … 1503 1503 { 1504 1504 /* 1505 * polynomials of J and obc are assumed to 1506 * be already sorted. J and Ob are 1505 * polynomials of J and obc are assumed to 1506 * be already sorted. J and Ob are 1507 1507 * represented by the minimal generating set. 1508 1508 * checks if J and Ob are same in polys upto deg <=tr … … 1516 1516 return(1); 1517 1517 } 1518 1519 if(JCount != ObCount) 1518 1519 if(JCount != ObCount) 1520 1520 { 1521 1521 return(0); … … 1529 1529 } 1530 1530 } 1531 1531 1532 1532 return(s); 1533 1533 } … … 1537 1537 /* 1538 1538 * compares the ideal I with ideals in the Orbit 'idorb' 1539 * upto degree trInd - max(deg of w, deg of word in polist) polynomials; 1539 * upto degree trInd - max(deg of w, deg of word in polist) polynomials; 1540 1540 * I and ideals in the Orbit are sorted, 1541 1541 * Orbit is ordered, 1542 1542 * 1543 * returns 0 if I is not equal to any of the ideals 1543 * returns 0 if I is not equal to any of the ideals 1544 1544 * in the Orbit else returns position of the matched ideal 1545 1545 */ 1546 1546 1547 1547 int ps = 0; 1548 1548 int i, j, s = 0; 1549 1549 int orbCount = idorb.size(); 1550 1550 1551 1551 if(idIs0(I)) 1552 1552 { 1553 1553 return(1); 1554 1554 } 1555 1555 1556 1556 int degw = p_Totaldegree(w, currRing); 1557 1557 int degp; 1558 1558 int dtr; 1559 int dtrp; 1560 1561 dtr = trInd - degw; 1559 int dtrp; 1560 1561 dtr = trInd - degw; 1562 1562 int IwCount; 1563 1563 1564 1564 IwCount = CountOnIdUptoTruncationIndex(I, dtr); 1565 1565 … … 1568 1568 return(1); 1569 1569 } 1570 1570 1571 1571 int ObCount; 1572 1572 1573 1573 bool flag2 = FALSE; 1574 1574 1575 1575 for(i = 1;i < orbCount; i++) 1576 1576 { … … 1579 1579 { 1580 1580 dtr = trInd - degw; 1581 1581 1582 1582 ObCount = 0; 1583 1583 ObCount = CountOnIdUptoTruncationIndex(idorb[i], dtr); … … 1591 1591 } 1592 1592 } 1593 else 1593 else 1594 1594 { 1595 1595 flag2 = TRUE; … … 1602 1602 1603 1603 s = isMonoIdBasesSame_IG_Case(I, IwCount, idorb[i], ObCount); 1604 1604 1605 1605 if(s) 1606 1606 { … … 1615 1615 { 1616 1616 /* 1617 * compares the ideal I with ideals in the Orbit 'idorb' 1617 * compares the ideal I with ideals in the Orbit 'idorb' 1618 1618 * I and ideals in the Orbit are sorted, 1619 1619 * Orbit is ordered, 1620 1620 * 1621 * returns 0 if I is not equal to any of the ideals 1621 * returns 0 if I is not equal to any of the ideals 1622 1622 * in the Orbit else returns position of the matched ideal 1623 1623 */ … … 1640 1640 } 1641 1641 } 1642 1642 1643 1643 return(ps); 1644 1644 } … … 1667 1667 { 1668 1668 /* 1669 * eliminates monomials which 1669 * eliminates monomials which 1670 1670 * can be generated by others in I 1671 1671 */ 1672 1672 //first sort monomials of the ideal 1673 1673 1674 1674 idSkipZeroes(I); 1675 1675 1676 1676 sortMonoIdeal_totalDegOrder(I); 1677 1677 1678 1678 ideal J = idInit(1, 1); 1679 1679 int i, k; … … 1685 1685 for(i = 0; i < k; i++) 1686 1686 { 1687 1687 1688 1688 if(p_LmDivisibleBy(I->m[i], I->m[k], currRing)) 1689 { 1689 { 1690 1690 pDelete(&(I->m[k]));//this is not req. 1691 1691 break; … … 1693 1693 } 1694 1694 } 1695 1695 1696 1696 idSkipZeroes(I); 1697 1697 return(I); … … 1700 1700 static poly shiftInMon(poly p, int i, int lV, const ring r) 1701 1701 { 1702 /* 1702 /* 1703 1703 * shifts the varibles of monomial p in the i^th layer, 1704 1704 * p remains unchanged, … … 1717 1717 if(e[j] == 1) 1718 1718 { 1719 s[j+sh] = e[j]; 1720 } 1721 } 1722 1719 s[j+sh] = e[j]; 1720 } 1721 } 1722 1723 1723 p_SetExpV(smon, s, currRing); 1724 1724 omFree(e); 1725 1725 omFree(s); 1726 1726 1727 1727 p_SetComp(smon, p_GetComp(p, currRing), currRing); 1728 1728 p_Setm(smon, currRing); 1729 1729 1730 1730 return(smon); 1731 1731 } … … 1733 1733 static poly deleteInMon(poly w, int i, int lV, const ring r) 1734 1734 { 1735 /* 1735 /* 1736 1736 * deletes the variables upto i^th layer of monomial w 1737 1737 * w remains unchanged 1738 1738 * creates new poly and returns it for the colon ideal 1739 1739 */ 1740 1740 1741 1741 poly dw = p_One(currRing); 1742 1742 int *e = (int *)omAlloc((r->N+1)*sizeof(int)); … … 1748 1748 for(j=1;j<=cnt;j++) 1749 1749 { 1750 e[j]=0; 1750 e[j]=0; 1751 1751 }*/ 1752 1752 for(j = (cnt+1); j < (r->N+1); j++) … … 1754 1754 s[j] = e[j]; 1755 1755 } 1756 1756 1757 1757 p_SetExpV(dw, s, currRing);//new exponents 1758 1758 omFree(e); 1759 1759 omFree(s); 1760 1760 1761 1761 p_SetComp(dw, p_GetComp(w, currRing), currRing); 1762 1762 p_Setm(dw, currRing); 1763 1763 1764 1764 return(dw); 1765 1765 } … … 1780 1780 poly qmonp = NULL; 1781 1781 bool del; 1782 1782 1783 1783 for(i = 0;i <= d - 1; i++) 1784 1784 { … … 1786 1786 smon = shiftInMon(p, i, lV, currRing); 1787 1787 del = TRUE; 1788 1788 1789 1789 if(pLmDivisibleBy(smon, w)) 1790 1790 { 1791 1791 flag = TRUE; 1792 del = FALSE; 1793 1792 del = FALSE; 1793 1794 1794 pDelete(&dw); 1795 1795 pDelete(&smon); 1796 1796 1797 1797 //delete all monomials of Jwi 1798 1798 //and make Jwi =1 1799 1799 1800 1800 for(int j = 0;j < IDELEMS(Jwi); j++) 1801 1801 { … … 1803 1803 } 1804 1804 1805 idInsertMonomials(Jwi, p_One(currRing)); 1805 idInsertMonomials(Jwi, p_One(currRing)); 1806 1806 break; 1807 1807 } 1808 1808 1809 1809 if(pLmDivisibleBy(dw, smon)) 1810 { 1811 del = FALSE; 1810 { 1811 del = FALSE; 1812 1812 qmonp = p_Divide(smon, dw, currRing); 1813 1813 idInsertMonomials(Jwi, shiftInMon(qmonp, -d, lV, currRing)); 1814 1814 1815 1815 //shiftInMon(qmonp, -d, lV, currRing):returns a new poly, 1816 1816 //qmonp remains unchanged, delete it … … 1826 1826 } 1827 1827 } 1828 1829 } 1828 1829 } 1830 1830 1831 1831 static ideal colonIdeal(ideal S, poly w, int lV, ideal Jwi) … … 1836 1836 * keeps S and w unchanged 1837 1837 */ 1838 1838 1839 1839 if(idIs0(S)) 1840 1840 { … … 1843 1843 1844 1844 int i, j, d; 1845 d = p_Totaldegree(w, currRing); 1846 bool flag = FALSE; 1845 d = p_Totaldegree(w, currRing); 1846 bool flag = FALSE; 1847 1847 int SCount = IDELEMS(S); 1848 1848 int cnt = 0; … … 1855 1855 } 1856 1856 } 1857 1857 1858 1858 Jwi = minimalMonomialsGenSet(Jwi); 1859 1859 return(Jwi); … … 1862 1862 1863 1863 void HilbertSeries_OrbitData(ideal S, int lV, bool IG_CASE ) 1864 { 1864 { 1865 1865 /* 1866 1866 * It is based on iterative right colon operation to the … … 1870 1870 * that is, all the monomials of ideal can be obtained from 1871 1871 * finite subsets by applying the finite number 1872 * of elementary operations. 1872 * of elementary operations. 1873 1873 */ 1874 1874 1875 1875 int trInd; 1876 1876 S = minimalMonomialsGenSet(S); 1877 1877 1878 1878 int (*POS)(ideal, poly, std::vector<ideal>, std::vector<poly>, int); 1879 1879 if(IG_CASE) … … 1886 1886 POS = &positionInOrbit_FG_Case; 1887 1887 } 1888 1888 1889 1889 std::vector<ideal > idorb; 1890 1890 std::vector< poly > polist; 1891 1891 1892 1892 ideal orb_init = idInit(1, 1); 1893 1893 idorb.push_back(orb_init); 1894 1894 1895 1895 polist.push_back( p_One(currRing)); 1896 1896 … … 1903 1903 int ds, is, ps, sz; 1904 1904 int lpcnt = 0; 1905 1905 1906 1906 poly w, wi; 1907 1907 ideal Jwi; … … 1914 1914 if(lpcnt >= 1) 1915 1915 { 1916 if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0) 1916 if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0) 1917 1917 { 1918 1918 C.push_back(1); … … 1947 1947 Jwi = colonIdeal(S, wi, lV, Jwi); 1948 1948 ps = (*POS)(Jwi, wi, idorb, polist, trInd); 1949 1949 1950 1950 if(ps == 0) // found new colon ideal 1951 1951 { 1952 1952 1953 1953 idorb.push_back(Jwi); 1954 1954 polist.push_back(wi); … … 1969 1969 1970 1970 for(is = idorb.size()-1; is >= 0; is--) 1971 { 1971 { 1972 1972 idDelete(&idorb[is]); 1973 1973 } … … 1976 1976 pDelete(&polist[is]); 1977 1977 } 1978 1979 idorb.resize(0); 1978 1979 idorb.resize(0); 1980 1980 polist.resize(0); 1981 1981 1982 1982 row.resize(0); 1983 1983 1984 int rowCount, colCount; 1984 int rowCount, colCount; 1985 1985 #if 0 1986 1986 for(rowCount = 0; rowCount < mat.size(); rowCount++) … … 2002 2002 TransExtInfo p; 2003 2003 p.r = rDefault(0, 1, tt); 2004 coeffs cf = nInitChar(n_transExt,&p); 2005 2004 coeffs cf = nInitChar(n_transExt,&p); 2005 2006 2006 char** xx = (char**)omalloc(sizeof(char*)); 2007 2007 xx[0] = omStrDup("x"); 2008 ring R = rDefault(cf, 1, xx); 2009 rChangeCurrRing(R); 2008 ring R = rDefault(cf, 1, xx); 2009 rChangeCurrRing(R); 2010 2010 /* 2011 2011 * matrix corresponding to the orbit of the ideal … … 2043 2043 matrix Hnot; 2044 2044 luSolveViaLUDecomp(pMat, lMat, uMat, cMat, H_serVec, Hnot); 2045 2045 2046 2046 mp_Delete(&mR,R); 2047 2047 mp_Delete(&u,R);
Note: See TracChangeset
for help on using the changeset viewer.