add method "is_cayley" to lattice polytopes#41224
Conversation
|
you may need to consider all directions given by vertex differences |
|
The algorithm should be fine as currently written. @orlitzky : would you please have a look if you can ? |
|
Is this the algorithm from Macaulay2? If so it would be polite to add an I am not sure this works in corner cases though. Should the trivial polytope be Cayley? How about (say) a 3d polytope in a 4d space, where all of the vertices are contained in the same 3d subspace? I would also add at least one example that is not Cayley for good measure. You should just need to append another vertex to the cube. |
|
Documentation preview for this PR (built with commit 69a6069; changes) is ready! 🎉 |
|
I have made some changes, as suggested. |
|
Yes, sorry, I got busy. I don't know the origin of this definition (Cayley polytope), but if there is no important reason to require them to be full dimensional, I guess it would be easy to handle both cases with if not self.is_full_dimensional():
# all vertices are contained in a strict subspace; trivially true
return Trueat the beginning? Otherwise I think we should raise an error to avoid confidently returning sage: P = LatticePolytope([(0,0,0),(1,0,0),(0,1,0),(2,2,0)])
sage: P.is_full_dimensional()
False
sage: [ len(set(n.dot_product(v) for v in P.vertices()))
....: for n in P.facet_normals() ]
[3, 3, 3, 3] |
|
merci, voilà ! |
|
LGTM, thanks! |
sagemathgh-41224: add method "is_cayley" to lattice polytopes as this could be useful ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. URL: sagemath#41224 Reported by: Frédéric Chapoton Reviewer(s):
as this could be useful
📝 Checklist