Changeset a73fae in git
 Timestamp:
 Oct 26, 2013, 5:54:56 PM (9 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
 Children:
 d770e6a687e6451b6e42d8b59cf74426e947eaf0
 Parents:
 97351e66f70a4390d6f911ee38436e695b8ec551
 gitauthor:
 Yue Ren <ren@mathematik.unikl.de>20131026 17:54:56+02:00
 gitcommitter:
 Yue Ren <ren@mathematik.unikl.de>20150206 13:47:01+01:00
 Location:
 Singular/dyn_modules/gfanlib
 Files:

 2 added
 2 edited
Legend:
 Unmodified
 Added
 Removed

Singular/dyn_modules/gfanlib/bbcone.cc
r97351e6 ra73fae 9 9 #include <coeffs/longrat.h> 10 10 11 #include <Singular/ipid.h>12 11 #include <Singular/ipid.h> 13 12 #include <Singular/ipshell.h> 14 13 #include <Singular/blackbox.h> 15 14 16 // #include <omalloc/omalloc.h> 17 // #include <kernel/intvec.h> 18 // #include <kernel/longrat.h> 19 // #include <Singular/lists.h> 20 // #include <Singular/subexpr.h> 15 #include <sstream> 21 16 22 17 #include <gfanlib/gfanlib.h> … … 109 104 delete gi; 110 105 } 106 return zv; 107 } 108 109 gfan::ZVector intStar2ZVector(const int d, const int* i) 110 { 111 gfan::ZVector zv(d); 112 for(int j=0; j<d; j++) 113 zv[j]=i[j+1]; 111 114 return zv; 112 115 } … … 1593 1596 } 1594 1597 1595 gfan::ZVector intStar2ZVector(const int d, const int* i)1596 {1597 gfan::ZVector zv(d);1598 for(int j=0; j<d; j++)1599 zv[j]=i[j+1];1600 return zv;1601 }1602 1603 BOOLEAN maximalGroebnerCone(leftv res, leftv args)1604 {1605 leftv u = args;1606 if ((u != NULL) && (u>Typ() == IDEAL_CMD))1607 {1608 leftv v = u>next;1609 if (v == NULL)1610 {1611 int n = currRing>N;1612 ideal I = (ideal) u>Data();1613 poly g = NULL;1614 int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));1615 int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));1616 gfan::ZVector leadexpw = gfan::ZVector(n);1617 gfan::ZVector tailexpw = gfan::ZVector(n);1618 gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);1619 for (int i=0; i<IDELEMS(I); i++)1620 {1621 g = (poly) I>m[i]; pGetExpV(g,leadexpv);1622 leadexpw = intStar2ZVector(n, leadexpv);1623 pIter(g);1624 while (g != NULL)1625 {1626 pGetExpV(g,tailexpv);1627 tailexpw = intStar2ZVector(n, tailexpv);1628 inequalities.appendRow(leadexpwtailexpw);1629 pIter(g);1630 }1631 }1632 gfan::ZCone* gCone = new gfan::ZCone(inequalities,gfan::ZMatrix(0, inequalities.getWidth()));1633 omFreeSize(leadexpv,(n+1)*sizeof(int));1634 omFreeSize(tailexpv,(n+1)*sizeof(int));1635 1636 res>rtyp = coneID;1637 res>data = (void*) gCone;1638 return FALSE;1639 }1640 }1641 WerrorS("maximalGroebnerCone: unexpected parameters");1642 return TRUE;1643 }1644 1645 1598 1646 1599 lists listOfFacets(const gfan::ZCone &zc) … … 1696 1649 1697 1650 1698 poly initial(poly p)1699 {1700 poly g = p;1701 poly h = p_Head(g,currRing);1702 poly f = h;1703 long d = p_Deg(g,currRing);1704 pIter(g);1705 while ((g != NULL) && (p_Deg(g,currRing) == d))1706 {1707 pNext(h) = p_Head(g,currRing);1708 pIter(h);1709 pIter(g);1710 }1711 return(f);1712 }1713 1714 1715 BOOLEAN initial(leftv res, leftv args)1716 {1717 leftv u = args;1718 if ((u != NULL) && (u>Typ() == POLY_CMD))1719 {1720 leftv v = u>next;1721 if (v == NULL)1722 {1723 poly p = (poly) u>Data();1724 res>rtyp = POLY_CMD;1725 res>data = (void*) initial(p);1726 return FALSE;1727 }1728 }1729 if ((u != NULL) && (u>Typ() == IDEAL_CMD))1730 {1731 leftv v = u>next;1732 if (v == NULL)1733 {1734 ideal I = (ideal) u>Data();1735 ideal inI = idInit(IDELEMS(I));1736 poly g;1737 for (int i=0; i<IDELEMS(I); i++)1738 {1739 g = (poly) I>m[i];1740 inI>m[i]=initial(g);1741 }1742 res>rtyp = IDEAL_CMD;1743 res>data = (void*) inI;1744 return FALSE;1745 }1746 }1747 WerrorS("initial: unexpected parameters");1748 return TRUE;1749 }1750 1751 1752 BOOLEAN homogeneitySpace(leftv res, leftv args)1753 {1754 leftv u = args;1755 if ((u != NULL) && (u>Typ() == IDEAL_CMD))1756 {1757 leftv v = u>next;1758 if (v == NULL)1759 {1760 int n = currRing>N;1761 ideal I = (ideal) u>Data();1762 poly g;1763 int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));1764 int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));1765 gfan::ZVector leadexpw = gfan::ZVector(n);1766 gfan::ZVector tailexpw = gfan::ZVector(n);1767 gfan::ZMatrix equations = gfan::ZMatrix(0,n);1768 for (int i=0; i<IDELEMS(I); i++)1769 {1770 g = (poly) I>m[i]; pGetExpV(g,leadexpv);1771 leadexpw = intStar2ZVector(n, leadexpv);1772 pIter(g);1773 while (g != NULL)1774 {1775 pGetExpV(g,tailexpv);1776 tailexpw = intStar2ZVector(n, tailexpv);1777 equations.appendRow(leadexpwtailexpw);1778 pIter(g);1779 }1780 }1781 gfan::ZCone* gCone = new gfan::ZCone(gfan::ZMatrix(0, equations.getWidth()),equations);1782 omFreeSize(leadexpv,(n+1)*sizeof(int));1783 omFreeSize(tailexpv,(n+1)*sizeof(int));1784 1785 res>rtyp = coneID;1786 res>data = (void*) gCone;1787 return FALSE;1788 }1789 }1790 WerrorS("homogeneitySpace: unexpected parameters");1791 return TRUE;1792 }1793 1794 1795 BOOLEAN groebnerCone(leftv res, leftv args)1796 {1797 leftv u = args;1798 if ((u != NULL) && (u>Typ() == IDEAL_CMD))1799 {1800 leftv v = u>next;1801 if (v == NULL)1802 {1803 int n = currRing>N;1804 ideal I = (ideal) u>Data();1805 poly g = NULL;1806 int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));1807 int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));1808 gfan::ZVector leadexpw = gfan::ZVector(n);1809 gfan::ZVector tailexpw = gfan::ZVector(n);1810 gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);1811 gfan::ZMatrix equations = gfan::ZMatrix(0,n);1812 long d;1813 for (int i=0; i<IDELEMS(I); i++)1814 {1815 g = (poly) I>m[i]; pGetExpV(g,leadexpv);1816 leadexpw = intStar2ZVector(n, leadexpv);1817 pIter(g);1818 d = p_Deg(g,currRing);1819 while ((g != NULL) && (p_Deg(g,currRing) == d))1820 {1821 pGetExpV(g,tailexpv);1822 tailexpw = intStar2ZVector(n, tailexpv);1823 equations.appendRow(leadexpwtailexpw);1824 pIter(g);1825 }1826 1827 if (g != NULL)1828 {1829 while (g != NULL)1830 {1831 pGetExpV(g,tailexpv);1832 tailexpw = intStar2ZVector(n, tailexpv);1833 inequalities.appendRow(leadexpwtailexpw);1834 pIter(g);1835 }1836 }1837 }1838 gfan::ZCone* gCone = new gfan::ZCone(inequalities,equations);1839 omFreeSize(leadexpv,(n+1)*sizeof(int));1840 omFreeSize(tailexpv,(n+1)*sizeof(int));1841 1842 res>rtyp = coneID;1843 res>data = (void*) gCone;1844 return FALSE;1845 }1846 }1847 WerrorS("groebnerCone: unexpected parameters");1848 return TRUE;1849 }1850 1851 1651 /*** 1852 1652 * Given a cone and a point in its boundary, 1853 1653 * returns the inner normal vector of a facet 1854 1654 * containing the point. 1655 * Unless the point is in the relative interior of the facet 1656 * the facet is not unique. 1855 1657 * In case no facet contains the point, 1856 1658 * then 0 is returned. … … 1959 1761 p>iiAddCproc("","listContainsCone",FALSE,containsCone); 1960 1762 p>iiAddCproc("","listOfFacets",FALSE,listOfFacets); 1961 p>iiAddCproc("","maximalGroebnerCone",FALSE,maximalGroebnerCone);1962 p>iiAddCproc("","groebnerCone",FALSE,groebnerCone);1963 p>iiAddCproc("","initial",FALSE,initial);1964 p>iiAddCproc("","homogeneitySpace",FALSE,homogeneitySpace);1965 1763 p>iiAddCproc("","facetContaining",FALSE,facetContaining); 1966 1764 coneID=setBlackboxStuff(b,"cone"); 
Singular/dyn_modules/gfanlib/gfanlib.cc
r97351e6 ra73fae 7 7 #include <bbpolytope.h> 8 8 #include <gitfan.h> 9 #include <tropical.h> 9 10 10 11 #include <Singular/ipid.h> … … 23 24 bbpolytope_setup(p); 24 25 gitfan_setup(p); 26 tropical_setup(p); 25 27 return MAX_TOK; 26 28 }
Note: See TracChangeset
for help on using the changeset viewer.