Opened 6 years ago

Closed 6 years ago

#17937 closed defect (fixed)

Cannot compute integral points of 0-dimensional Polyhedron

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-6.6
Component: geometry Keywords:
Cc: ncohen Merged in:
Authors: Jeroen Demeyer Reviewers: Nathann Cohen
Report Upstream: N/A Work issues:
Branch: eb6ba85 (Commits, GitHub, GitLab) Commit: eb6ba858894c3c3f77b2278115198bfe9076adf0
Dependencies: Stopgaps:

Status badges


A trivial case, but it should work anyway:

sage: P = Polyhedron([[]])
sage: P
A 0-dimensional polyhedron in ZZ^0 defined as the convex hull of 1 vertex
sage: P.integral_points()
IndexError                                Traceback (most recent call last)
<ipython-input-13-2abbf2adff15> in <module>()
----> 1 P.integral_points()

/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/geometry/polyhedron/base.pyc in integral_points(self, threshold)
   3826                 box_points<threshold:
   3827             from sage.geometry.integral_points import rectangular_box_points
-> 3828             return rectangular_box_points(box_min, box_max, self)
   3830         # for more complicate polytopes, triangulate & use smith normal form

/usr/local/src/sage-git/src/sage/geometry/integral_points.pyx in sage.geometry.integral_points.rectangular_box_points (build/cythonized/sage/geometry/integral_points.c:4761)()
    531     v = vector(ZZ, d)
    532     if not return_saturated:
--> 533         for p in loop_over_rectangular_box_points(box_min, box_max, inequalities, d, count_only):
    534             #  v = vector(ZZ, orig_perm.action(p))   # too slow
    535             for i in range(0,d):

/usr/local/src/sage-git/src/sage/geometry/integral_points.pyx in sage.geometry.integral_points.loop_over_rectangular_box_points (build/cythonized/sage/geometry/integral_points.c:5605)()
    580     while True:
    581         inequalities.prepare_inner_loop(p)
--> 582         i_min = box_min[0]
    583         i_max = box_max[0]
    584         # Find the lower bound for the allowed region

IndexError: list index out of range

Change History (6)

comment:1 Changed 6 years ago by ncohen

  • Cc ncohen added

comment:2 Changed 6 years ago by jdemeyer

  • Branch set to u/jdemeyer/cannot_compute_integral_points_of_0_dimensional_polyhedron

comment:3 Changed 6 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Commit set to eb6ba858894c3c3f77b2278115198bfe9076adf0
  • Status changed from new to needs_review

New commits:

eb6ba85Fix integral_points() for polyhedra in 0 dimensions

comment:4 follow-up: Changed 6 years ago by ncohen

  • Reviewers set to Nathann Cohen
  • Status changed from needs_review to positive_review

Looks good. I pondered a bit over the "single point in zero dimension", but well. Sounds like a valid convention.



comment:5 in reply to: ↑ 4 Changed 6 years ago by jdemeyer

Replying to ncohen:

Looks good. I pondered a bit over the "single point in zero dimension", but well. Sounds like a valid convention.

The zero dimensional vector space consists of one element: the zero element. There are two polytopes in this space: the empty polytope and the polytope with one vertex, namely the zero element.

comment:6 Changed 6 years ago by vbraun

  • Branch changed from u/jdemeyer/cannot_compute_integral_points_of_0_dimensional_polyhedron to eb6ba858894c3c3f77b2278115198bfe9076adf0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.