id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
9188,lattice_polytope.facet_normal bug with polytopes of less that full dimension,vbraun,novoselt,"In general, `lattice_polytope._embedding_matrix` is not orthogonal. But `facet_normal()` implicitly makes this assumption by embedding the normals (which live in the dual vector space) by the transpose of the `_embedding_matrix`.
Here is an example of the incorrect result:
{{{
sage: lp = LatticePolytope(matrix([[1,1,-1,0],[1,-1,-1,0],[1,1,1,0],[3,3,3,0]]))
sage: lp.vertices()
[ 1 1 -1 0]
[ 1 -1 -1 0]
[ 1 1 1 0]
[ 3 3 3 0]
sage: lp.facet_normal(0)
(-1, 0, 1, 3)
sage: lp.vertices() * lp.facet_normal(0)
(-2, -2, 0, 0)
sage: lp.facet_constant(0)
-9
}}}
If `lp.facet_normal(0)` would define a facet then its equation would be satisfied at 3 out of 4 vertices.
The attached patch fixes this issue. A scale factor for the dual embedding is introduced to keep the facet normal coordinates integral. Moreover, a suitable doctest is added.
NOTE: This bug impacts the toric variety code under development in #8986, #8987:
{{{
sage: c = Cone([(1,0,0,0),(0,1,0,0),(0,0,1,0)])
sage: c.faces()
((0-dimensional face of 3-dimensional cone,), (1-dimensional face of 3-dimensional cone, 1-dimensional face of 3-dimensional cone, 1-dimensional face of 3-dimensional cone), (2-dimensional face of 3-dimensional cone, 2-dimensional face of 3-dimensional cone, 2-dimensional face of 3-dimensional cone), (3-dimensional face of 3-dimensional cone,))
sage: c = Cone([(1,1,1,3),(1,-1,1,3),(-1,-1,1,3)])
sage: c.faces()
((0-dimensional face of 3-dimensional cone,), (2-dimensional face of 3-dimensional cone,), (3-dimensional face of 3-dimensional cone,))
}}}
",defect,closed,major,sage-4.5.2,geometry,fixed,,novoselt,sage-4.5.2.alpha0,Volker Braun,Andrey Novoseltsev,N/A,,,,,