Ticket #10021 (closed enhancement: fixed)
Empty LatticePolytope fails
| Reported by: | vbraun | Owned by: | mhampton |
|---|---|---|---|
| Priority: | major | Milestone: | sage-4.6 |
| Component: | geometry | Keywords: | |
| Cc: | novoselt | Work issues: | |
| Report Upstream: | N/A | Reviewers: | Andrey Novoseltsev |
| Authors: | Volker Braun | Merged in: | sage-4.6.alpha2 |
| Dependencies: | Stopgaps: |
Description
As return values for Polyhedron.lattice_polytope() we sometimes want to return empty lattice polytopes. Alas, this does not work:
Lsage: LatticePolytope( matrix(ZZ,3,0) )
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/home/vbraun/opt/sage-4.5.3/devel/sage-main/<ipython console> in <module>()
/home/vbraun/Sage/sage/local/lib/python2.6/site-packages/sage/geometry/lattice_polytope.pyc in LatticePolytope(data, desc, compute_vertices, copy_vertices, n)
264 return data
265 else:
--> 266 return LatticePolytopeClass(data, desc, compute_vertices, copy_vertices, n)
267
268 copy_reg.constructor(LatticePolytope) # "safe for unpickling"
/home/vbraun/Sage/sage/local/lib/python2.6/site-packages/sage/geometry/lattice_polytope.pyc in __init__(self, data, desc, compute_vertices, copy_vertices, n)
402 if compute_vertices:
403 self._vertices = data # Temporary assignment
--> 404 self._compute_dim(compute_vertices=True)
405 else:
406 if copy_vertices:
/home/vbraun/Sage/sage/local/lib/python2.6/site-packages/sage/geometry/lattice_polytope.pyc in _compute_dim(self, compute_vertices)
494 else:
495 points = self._vertices.columns(copy=False)
--> 496 p0 = points[0]
497 if p0 != 0:
498 points = [point - p0 for point in points]
IndexError: list index out of range
The attached patch fixes this and adds a suitable doctest.
Attachments
Change History
Changed 3 years ago by vbraun
-
attachment
trax_10021_empty_lattice_polytopes.patch
added
Changed 3 years ago by vbraun
-
attachment
trax_10021_empty_lattice_polytopes.2.patch
added
indentation fix in docstring
Note: See
TracTickets for help on using
tickets.

Initial patch