- """
- V = K.lattice().vector_space()
- scaled_gens = [ V.base_field().random_element().abs()*V(r) for r in K ]
-
- # Make sure we return a vector. Without the coercion, we might
- # return ``0`` when ``K`` has no rays.
- return V(sum(scaled_gens))
-
-
-def pointed_decomposition(K):
- """
- Every convex cone is the direct sum of a pointed cone and a linear
- subspace. Return a pair ``(P,S)`` of cones such that ``P`` is
- pointed, ``S`` is a subspace, and ``K`` is the direct sum of ``P``
- and ``S``.
-
- OUTPUT:
-
- An ordered pair ``(P,S)`` of closed convex polyhedral cones where
- ``P`` is pointed, ``S`` is a subspace, and ``K`` is the direct sum
- of ``P`` and ``S``.
-
- TESTS:
-
- A random point in the cone should belong to either the pointed
- subcone ``P`` or the subspace ``S``. If the point is nonzero, it
- should lie in one but not both of them::
+ The generators of the components are obtained from orthogonal
+ projections of the original generators [Stoer-Witzgall]_::