#10021: Empty LatticePolytope fails
------------------------+---------------------------------------------------
   Reporter:  vbraun    |       Owner:  mhampton  
       Type:  defect    |      Status:  new       
   Priority:  major     |   Milestone:  sage-4.6.1
  Component:  geometry  |    Keywords:            
     Author:            |    Upstream:  N/A       
   Reviewer:            |      Merged:            
Work_issues:            |  
------------------------+---------------------------------------------------
 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.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10021>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to