posHull computes the positive hull of the input. In the first two cases it considers the columns of M as a set of rays and the columns of N (if given) as generators of the lineality space and computes the cone that is the positive hull of the rays plus the lineality space. The two matrices must have the same number of rows, i.e. the columns must lie in the same ambient space. If N is not given or equal to 0 then the resulting cone is pointed. The rays need not be a minimal generating set of the cone. If two cones are inserted it computes their positive hull if they lie in the same ambient space. In the case of a polyhedron it computes the cone given by all positive multiples of points of the polyhedron. If applied to a list, it may contain a combination of the following in any order.
Then posHull computes the positive hull of all inserted objects, if they are in the same ambient space, i.e. all matrices must have the same number of rows, which must equal the ambient dimension of all cones and polyhedra.
As a first example consider the following 2 dimensional cone in 3 space:
i1 : R = matrix {{1,2},{2,1},{0,0}} o1 = | 1 2 | | 2 1 | | 0 0 | 3 2 o1 : Matrix ZZ <--- ZZ |
i2 : C = posHull R o2 = {ambient dimension => 3 } dimension of lineality space => 0 dimension of the cone => 2 number of facets => 2 number of rays => 2 o2 : Cone |
We can construct a full dimensional cone out of this one by adding a lineality space for example:
i3 : LS = matrix {{0},{0},{1}} o3 = | 0 | | 0 | | 1 | 3 1 o3 : Matrix ZZ <--- ZZ |
i4 : C1 = posHull (R,LS) o4 = {ambient dimension => 3 } dimension of lineality space => 1 dimension of the cone => 3 number of facets => 2 number of rays => 2 o4 : Cone |
The resulting cone is not pointed anymore, because it contains the subspace spanned by (0,0,1). To get a full dimensional pointed cone we have to add another ray to C. For this we can apply posHull to a list containing C and the new ray:
i5 : r = matrix {{0},{1},{2}} o5 = | 0 | | 1 | | 2 | 3 1 o5 : Matrix ZZ <--- ZZ |
i6 : C2 = posHull {C,r} o6 = {ambient dimension => 3 } dimension of lineality space => 0 dimension of the cone => 3 number of facets => 3 number of rays => 3 o6 : Cone |
Another way would be, if we would have r not as a ray but already as a cone:
i7 : r = posHull r o7 = {ambient dimension => 3 } dimension of lineality space => 0 dimension of the cone => 1 number of facets => 1 number of rays => 1 o7 : Cone |
In this case we can just take the positive hull of the two cones:
i8 : C3 = posHull(C,r) o8 = {ambient dimension => 3 } dimension of lineality space => 0 dimension of the cone => 3 number of facets => 3 number of rays => 3 o8 : Cone |
i9 : C3 == C2 o9 = true |
The object posHull is a method function.