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

Trivial bug in computing faces of non-full-dimensional lattice polytopes #8934

Closed
novoselt opened this issue May 8, 2010 · 8 comments
Closed

Comments

@novoselt
Copy link
Member

novoselt commented May 8, 2010

Currently computing faces of a non-full-dimensional lattice polytopes causes and exception, because when I was implementing support for such polytopes I missed a parameter in one place. The attached little patch fixes it and adds a doctest for the future.

CC: @vbraun

Component: geometry

Author: Andrey Novoseltsev

Reviewer: Volker Braun

Merged: sage-4.4.4.alpha0

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

@novoselt
Copy link
Member Author

novoselt commented May 8, 2010

Author: Andrey Novoseltsev

@vbraun
Copy link
Member

vbraun commented May 10, 2010

comment:2

I'm pretty sure you need the double colon in

line 545:"     Check that Trac 8934 is fixed::"

or the example will not be typeset correctly.

A special case of non-full-dimensional polytopes is the zero-dimensional case. This one is also broken, but in a slightly different way:

sage: p = LatticePolytope(matrix([[0]]))
sage: p.poly_x("i", reduce_dimension=True)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/vbraun/Sage/ToricVariety/<ipython console> in <module>()

/home/vbraun/Sage/sage/local/lib/python2.6/site-packages/sage/geometry/lattice_polytope.pyc in poly_x(self, keys, reduce_dimension)
   2223                1  -1     2
   2224         """
-> 2225         return self._palp("poly.x -f" + keys, reduce_dimension)
   2226 
   2227     def skeleton(self):

/home/vbraun/Sage/sage/local/lib/python2.6/site-packages/sage/geometry/lattice_polytope.pyc in _palp(self, command, reduce_dimension)
    772         if self.dim() == 0:
    773             raise ValueError, ("Cannot run \"%s\" for the zero-dimensional "
--> 774                 + "polytope!\nPolytope: %s") % (command, self)
    775         if self.dim() < self.ambient_dim() and not reduce_dimension:
    776             raise ValueError(("Cannot run PALP for a %d-dimensional polytope " +

ValueError: Cannot run "poly.x -fi" for the zero-dimensional polytope!
Polytope: A lattice polytope: 0-dimensional, 1 vertices.

Also, p.points() fails for the same reason. It would be great if you could fix this case as well.

@novoselt
Copy link
Member Author

@novoselt
Copy link
Member Author

comment:3

I added ":" into the docstring and tried to address some of the issues with 0-dimensional polytopes, namely, it is now possible to ask for points and faces of them. The list of faces in this case is empty, since only proper faces are returned in the other dimensions. In particular, asking for any faces of the given dimension will cause an error, but that seems to be consistent and I have documented it. I also added a synonym "all_facet_equations" for "all_polars", since calling the second one does not make a lot of sense for non-reflexive polytopes (although it will do the job). Thanks a lot for quick reviews!

@vbraun
Copy link
Member

vbraun commented May 10, 2010

comment:4

The new patch looks good! I've tried it and it works as expected. Should be committed to Sage asap.

@mwhansen
Copy link
Contributor

mwhansen commented Jun 6, 2010

Merged: sage-4.4.4.alpha0

@mwhansen
Copy link
Contributor

mwhansen commented Jun 6, 2010

Reviewer: Voker Braun

@mwhansen
Copy link
Contributor

mwhansen commented Jun 7, 2010

Changed reviewer from Voker Braun to Volker Braun

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

3 participants