Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compute integral points of 0-dimensional Polyhedron #17937

Closed
jdemeyer opened this issue Mar 11, 2015 · 8 comments
Closed

Cannot compute integral points of 0-dimensional Polyhedron #17937

jdemeyer opened this issue Mar 11, 2015 · 8 comments

Comments

@jdemeyer
Copy link

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)
   3829 
   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

CC: @nathanncohen

Component: geometry

Author: Jeroen Demeyer

Branch/Commit: eb6ba85

Reviewer: Nathann Cohen

Issue created by migration from https://trac.sagemath.org/ticket/17937

@jdemeyer jdemeyer added this to the sage-6.6 milestone Mar 11, 2015
@jdemeyer
Copy link
Author

@jdemeyer
Copy link
Author

New commits:

eb6ba85Fix integral_points() for polyhedra in 0 dimensions

@jdemeyer
Copy link
Author

Author: Jeroen Demeyer

@jdemeyer
Copy link
Author

Commit: eb6ba85

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Mar 12, 2015

Reviewer: Nathann Cohen

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Mar 12, 2015

comment:4

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

Thanks,

Nathann

@jdemeyer
Copy link
Author

comment:5

Replying to @nathanncohen:

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.

@vbraun
Copy link
Member

vbraun commented Mar 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants