sage: K = random_cone(strictly_convex=False)
sage: nonlineal_part(K).is_strictly_convex()
+ True
sage: nonlineal_part(K, orthogonal=True).is_strictly_convex()
True
sage: V = K.lattice().vector_space()
Vector space of degree 4 and dimension 1 over Rational Field
Basis matrix:
[0 0 0 1]
- sage: P = nonlinear_part(J)
+ sage: P = nonlineal_part(J)
sage: list(P.rays()) == [g1,g2,g3,g4]
True
- sage: L.intersection(span(J.rays())).dimension()
+ sage: L.intersection(V.span(J.rays())).dimension()
1
"""
+ if len(K.lines()) == 0:
+ # K is pointed. We uses len(lines) instead of is_pointed()
+ # because lines() caches the line set that we may need later.
+ return K
+
+ from sage.geometry.cone import Cone
lat = K.lattice()
if not orthogonal:
# Open question: is this generating set guaranteed to be
# minimal?
- return Cone([r for r in K if not r in K.lines()], lattice=lat)
+ pm_lines = [c*l for c in [-1,1] for l in K.lines()]
+ return Cone([r for r in K if not r in pm_lines], lattice=lat)
# We need to compute inner products and doing it in the ambient
# vector space (rather than in a more picky lattice) is the
# The generating set should be minimal, but PPL may be able to
# rescale it: there's no guarantee we don't have a bunch of rays
# that can all be divided by two, for example.
- from sage.geometry.cone import Cone
return (Cone(P_rays, lattice=lat))