+ 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::
+
+ sage: set_random_seed()
+ sage: K = random_cone(max_ambient_dim=8)
+ sage: (P,S) = pointed_decomposition(K)
+ sage: x = random_element(K)
+ sage: P.contains(x) or S.contains(x)
+ True
+ sage: x.is_zero() or (P.contains(x) != S.contains(x))
+ True
+ """
+ linspace_gens = [ copy(b) for b in K.linear_subspace().basis() ]
+ linspace_gens += [ -b for b in linspace_gens ]
+
+ S = Cone(linspace_gens, K.lattice())
+
+ # Since ``S`` is a subspace, its dual is its orthogonal complement
+ # (albeit in the wrong lattice).
+ S_perp = Cone(S.dual(), K.lattice())
+ P = K.intersection(S_perp)
+
+ return (P,S)