from sage.all import *
+def is_full_space(K):
+ r"""
+ Return whether or not this cone is equal to its ambient vector space.
+
+ OUTPUT:
+
+ ``True`` if this cone is the entire vector space and ``False``
+ otherwise.
+
+ EXAMPLES:
+
+ A ray in two dimensions is not equal to the entire space::
+
+ sage: K = Cone([(1,0)])
+ sage: is_full_space(K)
+ False
+
+ Neither is the nonnegative orthant::
+
+ sage: K = Cone([(1,0),(0,1)])
+ sage: is_full_space(K)
+ False
+
+ The right half-space contains a vector subspace, but it is still not
+ equal to the entire plane::
+
+ sage: K = Cone([(1,0),(-1,0),(0,1)])
+ sage: is_full_space(K)
+ False
+
+ But if we include nonnegative sums from both axes, then the resulting
+ cone is the entire two-dimensional space::
+
+ sage: K = Cone([(1,0),(-1,0),(0,1),(0,-1)])
+ sage: is_full_space(K)
+ True
+
+ """
+ return K.linear_subspace() == K.lattice().vector_space()
+
+
def random_cone(min_dim=0, max_dim=None, min_rays=0, max_rays=None):
r"""
Generate a random rational convex polyhedral cone.
# ZZ.random_element() docs.
return l + ZZ.random_element(u - l + 1)
- def is_full_space(K):
- r"""
- Is this cone equivalent to the full ambient vector space?
- """
- return K.lines().dim() == K.lattice_dim()
-
d = random_min_max(min_dim, max_dim)
r = random_min_max(min_rays, max_rays)