- """
- # The lines() method only returns one generator per line. For a true
- # line, we also need a generator pointing in the opposite direction.
- S_gens = [ direction*gen for direction in [1,-1] for gen in K.lines() ]
- S = Cone(S_gens, K.lattice())
-
- # Since ``S`` is a subspace, the rays of its dual generate its
- # orthogonal complement.
- S_perp = Cone(S.dual(), K.lattice())
- P = K.intersection(S_perp)
-
- return (P,S)
-
-
-def positive_operator_gens(K):
- r"""
- Compute generators of the cone of positive operators on this cone.
-
- OUTPUT:
-
- A list of `n`-by-``n`` matrices where ``n == K.lattice_dim()``.
- Each matrix ``P`` in the list should have the property that ``P*x``
- is an element of ``K`` whenever ``x`` is an element of
- ``K``. Moreover, any nonnegative linear combination of these
- matrices shares the same property.
-
- EXAMPLES:
-
- Positive operators on the nonnegative orthant are nonnegative matrices::
-
- sage: K = Cone([(1,)])
- sage: positive_operator_gens(K)
- [[1]]
-
- sage: K = Cone([(1,0),(0,1)])
- sage: positive_operator_gens(K)
- [
- [1 0] [0 1] [0 0] [0 0]
- [0 0], [0 0], [1 0], [0 1]
- ]
-
- The trivial cone in a trivial space has no positive operators::