From 0636b813d70fec7ee7ab169f6b2f60c484539b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 11 Oct 2021 20:37:42 +0200 Subject: [PATCH 01/28] some more links in catalog of posets --- src/sage/combinat/posets/poset_examples.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/sage/combinat/posets/poset_examples.py b/src/sage/combinat/posets/poset_examples.py index 38d5fc64c25..d23efbe51e9 100644 --- a/src/sage/combinat/posets/poset_examples.py +++ b/src/sage/combinat/posets/poset_examples.py @@ -65,10 +65,20 @@ :meth:`~Posets.YoungsLatticePrincipalOrderIdeal` | Return the principal order ideal of the partition `lam` in Young's Lattice. :meth:`~Posets.YoungFibonacci` | Return the Young-Fibonacci lattice up to rank `n`. +**Other available posets:** + +.. csv-table:: + :class: contentstable + :widths: 30, 70 + :delim: | + + :meth:`~sage.geometry.polyhedron.base.Polyhedron_base.face_lattice` | Return the face lattice of a polyhedron. + :meth:`~sage.geometry.polyhedron.combinatorial_polyhedron.base.CombinatorialPolyhedron.face_lattice` | Return the face lattice of a combinatorial polyhedron. + Constructions ------------- """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008 Peter Jipsen , # Franco Saliola # @@ -81,8 +91,8 @@ # # The full text of the GPL is available at: # -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.misc.classcall_metaclass import ClasscallMetaclass import sage.categories.posets @@ -130,7 +140,7 @@ class Posets(metaclass=ClasscallMetaclass): sage: TestSuite(P).run() """ @staticmethod - def __classcall__(cls, n = None): + def __classcall__(cls, n=None): r""" Return either the category of all posets, or the finite enumerated set of all finite posets on ``n`` elements up to an From 1a1efcf0a9bb212d39ff656b3f2fae4e7ae382ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 11 Oct 2021 20:37:42 +0200 Subject: [PATCH 02/28] some more links in catalog of posets --- src/sage/combinat/posets/poset_examples.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/sage/combinat/posets/poset_examples.py b/src/sage/combinat/posets/poset_examples.py index 38d5fc64c25..d23efbe51e9 100644 --- a/src/sage/combinat/posets/poset_examples.py +++ b/src/sage/combinat/posets/poset_examples.py @@ -65,10 +65,20 @@ :meth:`~Posets.YoungsLatticePrincipalOrderIdeal` | Return the principal order ideal of the partition `lam` in Young's Lattice. :meth:`~Posets.YoungFibonacci` | Return the Young-Fibonacci lattice up to rank `n`. +**Other available posets:** + +.. csv-table:: + :class: contentstable + :widths: 30, 70 + :delim: | + + :meth:`~sage.geometry.polyhedron.base.Polyhedron_base.face_lattice` | Return the face lattice of a polyhedron. + :meth:`~sage.geometry.polyhedron.combinatorial_polyhedron.base.CombinatorialPolyhedron.face_lattice` | Return the face lattice of a combinatorial polyhedron. + Constructions ------------- """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2008 Peter Jipsen , # Franco Saliola # @@ -81,8 +91,8 @@ # # The full text of the GPL is available at: # -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.misc.classcall_metaclass import ClasscallMetaclass import sage.categories.posets @@ -130,7 +140,7 @@ class Posets(metaclass=ClasscallMetaclass): sage: TestSuite(P).run() """ @staticmethod - def __classcall__(cls, n = None): + def __classcall__(cls, n=None): r""" Return either the category of all posets, or the finite enumerated set of all finite posets on ``n`` elements up to an From 69dd9f2569f512e658612a5d04a59461d4a059fa Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 15:11:11 -0700 Subject: [PATCH 03/28] src/doc/en/reference/discrete_geometry/index.rst: Add base0 to base7 --- src/doc/en/reference/discrete_geometry/index.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/doc/en/reference/discrete_geometry/index.rst b/src/doc/en/reference/discrete_geometry/index.rst index a5d9663c5d7..d84e72b4816 100644 --- a/src/doc/en/reference/discrete_geometry/index.rst +++ b/src/doc/en/reference/discrete_geometry/index.rst @@ -76,6 +76,14 @@ Base classes for polyhedra .. toctree:: :maxdepth: 1 + sage/geometry/polyhedron/base0 + sage/geometry/polyhedron/base1 + sage/geometry/polyhedron/base2 + sage/geometry/polyhedron/base3 + sage/geometry/polyhedron/base4 + sage/geometry/polyhedron/base5 + sage/geometry/polyhedron/base6 + sage/geometry/polyhedron/base7 sage/geometry/polyhedron/base sage/geometry/polyhedron/base_QQ sage/geometry/polyhedron/base_ZZ From bf4c354d7e0a1d567dc454b1a40a55cc592a56c0 Mon Sep 17 00:00:00 2001 From: "John H. Palmieri" Date: Sat, 16 Jul 2022 15:46:31 -0700 Subject: [PATCH 04/28] trac 25675: correct link to base4 for face_lattice, and add geometry/polyhedron/combinatorial_polyhedron/* to the reference manual --- src/doc/en/reference/discrete_geometry/index.rst | 14 ++++++++++++++ src/sage/combinat/posets/poset_examples.py | 2 +- .../combinatorial_polyhedron/face_iterator.pyx | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/doc/en/reference/discrete_geometry/index.rst b/src/doc/en/reference/discrete_geometry/index.rst index d84e72b4816..fcc197a7462 100644 --- a/src/doc/en/reference/discrete_geometry/index.rst +++ b/src/doc/en/reference/discrete_geometry/index.rst @@ -89,6 +89,20 @@ Base classes for polyhedra sage/geometry/polyhedron/base_ZZ sage/geometry/polyhedron/base_RDF +Combinatorial polyhedra +~~~~~~~~~~~~~~~~~~~~~~~ + +.. toctree:: + :maxdepth: 1 + + sage/geometry/polyhedron/combinatorial_polyhedron/base + sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face + sage/geometry/polyhedron/combinatorial_polyhedron/conversions + sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator + sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure + sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces + sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice + Backends for Polyhedra ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/sage/combinat/posets/poset_examples.py b/src/sage/combinat/posets/poset_examples.py index d23efbe51e9..e415dc300f2 100644 --- a/src/sage/combinat/posets/poset_examples.py +++ b/src/sage/combinat/posets/poset_examples.py @@ -72,7 +72,7 @@ :widths: 30, 70 :delim: | - :meth:`~sage.geometry.polyhedron.base.Polyhedron_base.face_lattice` | Return the face lattice of a polyhedron. + :meth:`~sage.geometry.polyhedron.base4.Polyhedron_base4.face_lattice` | Return the face lattice of a polyhedron. :meth:`~sage.geometry.polyhedron.combinatorial_polyhedron.base.CombinatorialPolyhedron.face_lattice` | Return the face lattice of a combinatorial polyhedron. Constructions diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index 7e854219418..07ba7647feb 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -1119,7 +1119,7 @@ cdef class FaceIterator_base(SageObject): ... ValueError: only possible when not in dual mode - Cannot run ``only_subfaces`` after ``ignore_subfaces:: + Cannot run ``only_subfaces`` after ``ignore_subfaces``:: sage: it = C.face_generator() sage: _ = next(it) From e2c738cb85b6ab1db0d8a3eb5494ef19d0d035f3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 16:00:57 -0700 Subject: [PATCH 05/28] src/sage/geometry/polyhedron/base*.py: Include topic in title for better TOC --- src/sage/geometry/polyhedron/base.py | 5 ++--- src/sage/geometry/polyhedron/base0.py | 4 +--- src/sage/geometry/polyhedron/base1.py | 2 +- src/sage/geometry/polyhedron/base2.py | 4 +--- src/sage/geometry/polyhedron/base3.py | 5 ++--- src/sage/geometry/polyhedron/base4.py | 2 +- src/sage/geometry/polyhedron/base5.py | 5 ++--- src/sage/geometry/polyhedron/base6.py | 4 +--- src/sage/geometry/polyhedron/base7.py | 4 +--- 9 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py index 576e073a825..fc0e2dcb197 100644 --- a/src/sage/geometry/polyhedron/base.py +++ b/src/sage/geometry/polyhedron/base.py @@ -1,12 +1,11 @@ r""" -Base class for polyhedra +Base class for polyhedra: Miscellaneous methods This is split into several modules, organized as follows: - :mod:`~sage.geometry.polyhedron.base0` -- basic initialization etc. -- :mod:`~sage.geometry.polyhedron.base1` -- methods defined by the - :class:`~sage.geometry.convex_set.ConvexSet_base` API +- :mod:`~sage.geometry.polyhedron.base1` -- methods defined by the :class:`~sage.geometry.convex_set.ConvexSet_base` API - :mod:`~sage.geometry.polyhedron.base2` -- lattice points diff --git a/src/sage/geometry/polyhedron/base0.py b/src/sage/geometry/polyhedron/base0.py index 2e0f6a716cf..5cd32a01ac5 100644 --- a/src/sage/geometry/polyhedron/base0.py +++ b/src/sage/geometry/polyhedron/base0.py @@ -1,7 +1,5 @@ r""" -Base class for polyhedra, part 0 - -Initialization and access to Vrepresentation and Hrepresentation. +Base class for polyhedra: Initialization and access to Vrepresentation and Hrepresentation """ # **************************************************************************** diff --git a/src/sage/geometry/polyhedron/base1.py b/src/sage/geometry/polyhedron/base1.py index e36867647f5..747dab1f8f4 100644 --- a/src/sage/geometry/polyhedron/base1.py +++ b/src/sage/geometry/polyhedron/base1.py @@ -1,5 +1,5 @@ r""" -Base class for polyhedra, part 1 +Base class for polyhedra: Implementation of the :class:`ConvexSet_base` API Define methods that exist for convex sets, but not constructions such as dilation or product. diff --git a/src/sage/geometry/polyhedron/base2.py b/src/sage/geometry/polyhedron/base2.py index 44654a024b2..cec3fd2ccd0 100644 --- a/src/sage/geometry/polyhedron/base2.py +++ b/src/sage/geometry/polyhedron/base2.py @@ -1,7 +1,5 @@ r""" -Base class for polyhedra, part 2 - -Define methods related to lattice points. +Base class for polyhedra: Methods related to lattice points """ # **************************************************************************** diff --git a/src/sage/geometry/polyhedron/base3.py b/src/sage/geometry/polyhedron/base3.py index 3a70cf79afc..fe4a285e90f 100644 --- a/src/sage/geometry/polyhedron/base3.py +++ b/src/sage/geometry/polyhedron/base3.py @@ -1,8 +1,7 @@ r""" -Base class for polyhedra, part 3 +Base class for polyhedra: Methods regarding the combinatorics of a polyhedron -Define methods related to the combinatorics of a polyhedron -excluding methods relying on :mod:`sage.graphs`. +Excluding methods relying on :mod:`sage.graphs`. """ # **************************************************************************** diff --git a/src/sage/geometry/polyhedron/base4.py b/src/sage/geometry/polyhedron/base4.py index 8c7dd0c2836..3cd297a2663 100644 --- a/src/sage/geometry/polyhedron/base4.py +++ b/src/sage/geometry/polyhedron/base4.py @@ -1,6 +1,6 @@ # sage.doctest: optional - sage.graphs r""" -Base class for polyhedra, part 4 +Base class for polyhedra: Graph-theoretic methods Define methods relying on :mod:`sage.graphs`. """ diff --git a/src/sage/geometry/polyhedron/base5.py b/src/sage/geometry/polyhedron/base5.py index b94da62a4b8..149d7eb7164 100644 --- a/src/sage/geometry/polyhedron/base5.py +++ b/src/sage/geometry/polyhedron/base5.py @@ -1,8 +1,7 @@ r""" -Base class for polyhedra, part 5 +Base class for polyhedra: Methods for constructing new polyhedra -Define methods constructing new polyhedra -except for affine hull and affine hull projection. +Except for affine hull and affine hull projection. """ # **************************************************************************** diff --git a/src/sage/geometry/polyhedron/base6.py b/src/sage/geometry/polyhedron/base6.py index b569f40613d..5637e56d890 100644 --- a/src/sage/geometry/polyhedron/base6.py +++ b/src/sage/geometry/polyhedron/base6.py @@ -1,7 +1,5 @@ r""" -Base class for polyhedra, part 6 - -Define methods related to plotting including affine hull projection. +Base class for polyhedra: Methods for plotting and affine hull projection """ # **************************************************************************** diff --git a/src/sage/geometry/polyhedron/base7.py b/src/sage/geometry/polyhedron/base7.py index 93138e3dc4f..898c97fb5c8 100644 --- a/src/sage/geometry/polyhedron/base7.py +++ b/src/sage/geometry/polyhedron/base7.py @@ -1,7 +1,5 @@ r""" -Base class for polyhedra, part 7 - -Define methods related to triangulation and volume. +Base class for polyhedra: Methods for triangulation and volume computation """ # **************************************************************************** From 7c1cf3c9e9b3945c1d7e205b64df17e577191354 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 16:28:48 -0700 Subject: [PATCH 06/28] src/doc/en/reference/discrete_geometry/index.rst: Add sage/geometry/polyhedron/combinatorial_polyhedron/* --- src/doc/en/reference/discrete_geometry/index.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/doc/en/reference/discrete_geometry/index.rst b/src/doc/en/reference/discrete_geometry/index.rst index d84e72b4816..89fa315c3d9 100644 --- a/src/doc/en/reference/discrete_geometry/index.rst +++ b/src/doc/en/reference/discrete_geometry/index.rst @@ -47,6 +47,19 @@ Lattice polyhedra sage/geometry/polyhedron/ppl_lattice_polygon sage/geometry/polyhedron/ppl_lattice_polytope +Combinatorial Polyhedra +~~~~~~~~~~~~~~~~~~~~~~~ + +.. toctree:: + :maxdepth: 1 + + sage/geometry/polyhedron/combinatorial_polyhedron/base + sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face + sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice + sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator + sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure + sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces + Polyhedral complexes ~~~~~~~~~~~~~~~~~~~~ From 8985d875b79a0a0719a0ed7e170011356856bb7f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 16:41:58 -0700 Subject: [PATCH 07/28] src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx: Fix some docstring markup --- .../polyhedron/combinatorial_polyhedron/base.pyx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx index 9811970ed29..90b5f5ea3d1 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx @@ -16,13 +16,12 @@ Terminology used in this module: - Facets -- facets of the polyhedron. - Vrepresentation -- represents a face by the list of Vrep it contains. - Hrepresentation -- represents a face by a list of Hrep it is contained in. -- bit representation -- represents incidences as bitset, where - each bit represents one incidence. There might - be trailing zeros, to fit alignment requirements. - In most instances, faces are represented by the - bit representation, where each bit corresponds to - a Vrep or facet. Thus a bit representation can either be - a Vrep or facet representation depending on context. +- bit representation -- represents incidences as bitset, where each bit + represents one incidence. There might be trailing zeros, to fit alignment + requirements. In most instances, faces are represented by the bit + representation, where each bit corresponds to a Vrep or facet. Thus a bit + representation can either be a Vrep or facet representation depending on + context. EXAMPLES: @@ -1552,6 +1551,7 @@ cdef class CombinatorialPolyhedron(SageObject): - ``algorithm`` -- string (optional); specify whether the face generator starts with facets or vertices: + * ``'primal'`` -- start with the facets * ``'dual'`` -- start with the vertices * ``None`` -- choose automatically @@ -1722,6 +1722,7 @@ cdef class CombinatorialPolyhedron(SageObject): - ``algorithm`` -- string (optional); specify whether the face generator starts with facets or vertices: + * ``'primal'`` -- start with the facets * ``'dual'`` -- start with the vertices * ``None`` -- choose automatically @@ -2678,6 +2679,7 @@ cdef class CombinatorialPolyhedron(SageObject): - ``algorithm`` -- string (optional); specify whether the face generator starts with facets or vertices: + * ``'primal'`` -- start with the facets * ``'dual'`` -- start with the vertices * ``None`` -- choose automatically From b0fe3fd0922e46ee25ccff0fdb8a9dde3e007ed0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 16:45:03 -0700 Subject: [PATCH 08/28] src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx: Fix some docstring markup --- .../combinatorial_polyhedron/combinatorial_face.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx index 5b40ee42cf2..c1a0b996a8a 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx @@ -18,7 +18,7 @@ Obtain a face from a face iterator:: sage: face = next(it); face A 2-dimensional face of a 3-dimensional combinatorial polyhedron -Obtain a face from a face lattice index: +Obtain a face from a face lattice index:: sage: P = polytopes.simplex(2) sage: C = CombinatorialPolyhedron(P) @@ -859,7 +859,7 @@ cdef class CombinatorialFace(SageObject): Let ``G`` be the face corresponding to ``self`` in the dual/polar polytope. The ``quotient`` is the dual/polar of ``G``. - Let `[\hat{0], \hat{1}]` be the face lattice of the ambient polyhedron + Let `[\hat{0}, \hat{1}]` be the face lattice of the ambient polyhedron and `F` be ``self`` as element of the face lattice. The face lattice of ``self`` as polyhedron corresponds to `[\hat{0}, F]` and the face lattice of the quotient by ``self`` From 05059f8bdfa002007fc8ee0b2e9cca2e7b943f1a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 16:50:52 -0700 Subject: [PATCH 09/28] src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx: Fix docstring markup --- .../polyhedron_face_lattice.pyx | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx index 9fd5e1a2f14..4e9ba7e0e99 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx @@ -8,28 +8,29 @@ the face lattice of a polyhedron. Terminology in this module: -- Vrep -- ``[vertices, rays, lines]`` of the polyhedron. -- Hrep -- inequalities and equations of the polyhedron. -- Facets -- facets of the polyhedron. -- Coatoms -- the faces from which all others are constructed in - the face iterator. This will be facets or Vrep. - In non-dual mode, faces are constructed as - intersections of the facets. In dual mode, the are - constructed theoretically as joins of vertices. - The coatoms are repsented as incidences with the - atoms they contain. -- Atoms -- facets or Vrep depending on application of algorithm. - Atoms are repsented as incidences of coatoms they - are contained in. - -- Vrepresentation -- represents a face by a list of Vrep it contains. -- Hrepresentation -- represents a face by a list of Hrep it is contained in. -- bit representation -- represents incidences as ``uint64_t``-array, where - each Bit represents one incidences. There might - be trailing zeros, to fit alignment-requirements. - In most instances, faces are represented by the - Bit-representation, where each bit corresponds to - an atom. +- Vrep -- ``[vertices, rays, lines]`` of the polyhedron. + +- Hrep -- inequalities and equations of the polyhedron. + +- Facets -- facets of the polyhedron. + +- Coatoms -- the faces from which all others are constructed in the face + iterator. This will be facets or Vrep. In non-dual mode, faces are + constructed as intersections of the facets. In dual mode, the are constructed + theoretically as joins of vertices. The coatoms are repsented as incidences + with the atoms they contain. + +- Atoms -- facets or Vrep depending on application of algorithm. Atoms are + repsented as incidences of coatoms they are contained in. + +- Vrepresentation -- represents a face by a list of Vrep it contains. + +- Hrepresentation -- represents a face by a list of Hrep it is contained in. + +- bit representation -- represents incidences as ``uint64_t``-array, where each + bit represents one incidence. There might be trailing zeros, to fit alignment + requirements. In most instances, faces are represented by the bit + representation, where each bit corresponds to an atom. EXAMPLES:: From 5ee31cf8920170a9ed83da9d1d89b0d6143ab4b0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 16:58:04 -0700 Subject: [PATCH 10/28] src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx: Fix docstring markup --- .../face_iterator.pyx | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index 7e854219418..cc36509a47e 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -12,16 +12,14 @@ A (slightly generalized) description of the algorithm can be found in [KS2019]_. Terminology in this module: -- Coatoms -- the faces from which all others are constructed in - the face iterator. This will be facets or Vrep. - In non-dual mode, faces are constructed as - intersections of the facets. In dual mode, the are - constructed theoretically as joins of vertices. - The coatoms are repsented as incidences with the - atoms they contain. -- Atoms -- facets or Vrep depending on application of algorithm. - Atoms are repsented as incidences of coatoms they - are contained in. +- Coatoms -- the faces from which all others are constructed in the + face iterator. This will be facets or Vrep. In non-dual mode, faces + are constructed as intersections of the facets. In dual mode, they + are constructed theoretically as joins of vertices. The coatoms are + repsented as incidences with the atoms they contain. + +- Atoms -- facets or Vrep depending on application of algorithm. Atoms are + represented as incidences of coatoms they are contained in. .. SEEALSO:: @@ -1119,7 +1117,7 @@ cdef class FaceIterator_base(SageObject): ... ValueError: only possible when not in dual mode - Cannot run ``only_subfaces`` after ``ignore_subfaces:: + Cannot run ``only_subfaces`` after ``ignore_subfaces``:: sage: it = C.face_generator() sage: _ = next(it) From 63beed6fe225fb68fb946d129e5660118e20f0d2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 17:00:42 -0700 Subject: [PATCH 11/28] src/doc/en/reference/discrete_geometry/index.rst: fix up --- src/doc/en/reference/discrete_geometry/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/en/reference/discrete_geometry/index.rst b/src/doc/en/reference/discrete_geometry/index.rst index 89fa315c3d9..7e959902fe3 100644 --- a/src/doc/en/reference/discrete_geometry/index.rst +++ b/src/doc/en/reference/discrete_geometry/index.rst @@ -57,8 +57,9 @@ Combinatorial Polyhedra sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator - sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces + sage/geometry/polyhedron/combinatorial_polyhedron/conversions + Polyhedral complexes ~~~~~~~~~~~~~~~~~~~~ From 0ca30fb0a421da68d5a4b08f5488b257a37dffe0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 18:04:39 -0700 Subject: [PATCH 12/28] src/sage/geometry/polyhedron/base.py: Fix markup --- src/sage/geometry/polyhedron/base.py | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py index fc0e2dcb197..55d51f8d715 100644 --- a/src/sage/geometry/polyhedron/base.py +++ b/src/sage/geometry/polyhedron/base.py @@ -1,23 +1,5 @@ r""" Base class for polyhedra: Miscellaneous methods - -This is split into several modules, organized as follows: - -- :mod:`~sage.geometry.polyhedron.base0` -- basic initialization etc. - -- :mod:`~sage.geometry.polyhedron.base1` -- methods defined by the :class:`~sage.geometry.convex_set.ConvexSet_base` API - -- :mod:`~sage.geometry.polyhedron.base2` -- lattice points - -- :mod:`~sage.geometry.polyhedron.base3` -- combinatorial methods - -- :mod:`~sage.geometry.polyhedron.base4` -- methods relying on graphs - -- :mod:`~sage.geometry.polyhedron.base5` -- constructions of new polyhedra - -- :mod:`~sage.geometry.polyhedron.base6` -- plotting and affine projection - -- :mod:`~sage.geometry.polyhedron.base7` -- triangulation and volume """ # **************************************************************************** @@ -122,8 +104,8 @@ class Polyhedron_base(Polyhedron_base7): - ``Hrep_minimal`` (optional) -- see below - ``pref_rep`` -- string (default: ``None``); - one of``Vrep`` or ``Hrep`` to pick this in case the backend - cannot initialize from complete double description + one of ``Vrep`` or ``Hrep`` to pick this in case the backend + cannot initialize from complete double description - ``mutable`` -- ignored @@ -840,6 +822,7 @@ def barycentric_subdivision(self, subdivision_frac=None): REFERENCE: See :wikipedia:`Barycentric_subdivision` + Section 6.6, Handbook of Convex Geometry, Volume A, edited by P.M. Gruber and J.M. Wills. 1993, North-Holland Publishing Co.. From 1c26f44899001185b43cd83a38eb9d8544467ac5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 19:52:43 -0700 Subject: [PATCH 13/28] src/doc/en/reference/discrete_geometry/index.rst: Add sage/geometry/polyhedron/backend_cdd_rdf --- src/doc/en/reference/discrete_geometry/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/en/reference/discrete_geometry/index.rst b/src/doc/en/reference/discrete_geometry/index.rst index 7e959902fe3..202c54a912e 100644 --- a/src/doc/en/reference/discrete_geometry/index.rst +++ b/src/doc/en/reference/discrete_geometry/index.rst @@ -110,6 +110,7 @@ Backends for Polyhedra :maxdepth: 1 sage/geometry/polyhedron/backend_cdd + sage/geometry/polyhedron/backend_cdd_rdf sage/geometry/polyhedron/backend_field sage/geometry/polyhedron/backend_normaliz sage/geometry/polyhedron/backend_polymake From b39fed2857a69dfc1524b62c88f914324e5826b3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 19:55:09 -0700 Subject: [PATCH 14/28] src/doc/en/reference/discrete_geometry/index.rst: Add sage/geometry/abc --- src/doc/en/reference/discrete_geometry/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/en/reference/discrete_geometry/index.rst b/src/doc/en/reference/discrete_geometry/index.rst index 202c54a912e..0289ea570d9 100644 --- a/src/doc/en/reference/discrete_geometry/index.rst +++ b/src/doc/en/reference/discrete_geometry/index.rst @@ -136,6 +136,7 @@ Miscellaneous .. toctree:: :maxdepth: 1 + sage/geometry/abc sage/geometry/convex_set sage/geometry/linear_expression sage/geometry/newton_polygon From e32adee27e12dd933d7d049b04665e84557a3af7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 20:20:19 -0700 Subject: [PATCH 15/28] src/sage/geometry/polyhedron/base0.py: Fix method/class references --- src/sage/geometry/polyhedron/base0.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/geometry/polyhedron/base0.py b/src/sage/geometry/polyhedron/base0.py index 5cd32a01ac5..a47ee59a9ab 100644 --- a/src/sage/geometry/polyhedron/base0.py +++ b/src/sage/geometry/polyhedron/base0.py @@ -907,7 +907,7 @@ def inequalities_list(self): It is recommended to use :meth:`inequalities` or :meth:`inequality_generator` instead to iterate over the - list of :class:`Inequality` objects. + list of :class:`~sage.geometry.polyhedron.representation.Inequality` objects. EXAMPLES:: @@ -989,7 +989,7 @@ def vertices_list(self): .. NOTE:: It is recommended to use :meth:`vertex_generator` instead to - iterate over the list of :class:`Vertex` objects. + iterate over the list of :class:`~sage.geometry.polyhedron.representation.Vertex` objects. .. WARNING:: @@ -1200,7 +1200,7 @@ def rays_list(self): It is recommended to use :meth:`rays` or :meth:`ray_generator` instead to iterate over the list of - :class:`Ray` objects. + :class:`~sage.geometry.polyhedron.representation.Ray` objects. OUTPUT: @@ -1255,7 +1255,7 @@ def lines_list(self): .. NOTE:: It is recommended to use :meth:`line_generator` instead to - iterate over the list of :class:`Line` objects. + iterate over the list of :class:`~sage.geometry.polyhedron.representation.Line` objects. EXAMPLES:: From 5de3eeccfd4bf916545bf65157a065cd6318becd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 20:20:30 -0700 Subject: [PATCH 16/28] src/sage/geometry/polyhedron/base.py: Fix method/class references --- src/sage/geometry/polyhedron/base.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py index 55d51f8d715..459cf0b378c 100644 --- a/src/sage/geometry/polyhedron/base.py +++ b/src/sage/geometry/polyhedron/base.py @@ -397,7 +397,8 @@ def radius_square(self): OUTPUT: - The square of the radius, which is in :meth:`base_ring`. + The square of the radius, which is in + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.base_ring`. EXAMPLES:: @@ -615,7 +616,7 @@ def hyperplane_arrangement(self): A :class:`hyperplane arrangement ` consisting of the hyperplanes defined by the - :meth:`Hrepresentation`. + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Hrepresentation`. If the polytope is full-dimensional, this is the hyperplane arrangement spanned by the facets of the polyhedron. @@ -780,7 +781,7 @@ def is_minkowski_summand(self, Y): r""" Test whether ``Y`` is a Minkowski summand. - See :meth:`minkowski_sum`. + See :meth:`~sage.geometry.polyhedron.base5.Polyhedron_base5.minkowski_sum`. OUTPUT: @@ -936,7 +937,8 @@ def permutations_to_matrices(self, conj_class_reps, acting_group=None, additiona The dictionary has entries for the generators of the ``acting_group`` and the representatives of conjugacy classes in ``conj_class_reps``. By - default, the ``acting_group`` is the ``restricted_automorphism_group`` + default, the ``acting_group`` is the + :meth:`~sage.geometry.polyhedron.base4.Polyhedron_base4.restricted_automorphism_group` of the polytope. Each element in ``additional_elts`` also becomes a key. INPUT: @@ -945,16 +947,16 @@ def permutations_to_matrices(self, conj_class_reps, acting_group=None, additiona conjugacy classes of the ``acting_group``. - ``acting_group`` -- a subgroup of polytope's - ``restricted_automorphism_group``. + :meth:`~sage.geometry.polyhedron.base4.Polyhedron_base4.restricted_automorphism_group`. - - ``additional_elts`` -- list (default=None). a subset of the - ``restricted_automorphism_group`` of the polytope expressed as - permutations. + - ``additional_elts`` -- list (default=None). A subset of the + :meth:`~sage.geometry.polyhedron.base4.Polyhedron_base4.restricted_automorphism_group` + of the polytope expressed as permutations. OUTPUT: - A dictionary between elements of ``the restricted_automorphism_group`` - or ``acting_group`` expressed as permutations (keys) and matrices (values). + A dictionary between elements of the ``acting_group`` expressed as permutations + (keys) and matrices (values). EXAMPLES: From 8953f059dee9d6b779ed8545d2216c3564b11579 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 20:22:24 -0700 Subject: [PATCH 17/28] src/sage/geometry/polyhedron/base1.py: Fix method/class references --- src/sage/geometry/polyhedron/base1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/geometry/polyhedron/base1.py b/src/sage/geometry/polyhedron/base1.py index 747dab1f8f4..e29983e44f9 100644 --- a/src/sage/geometry/polyhedron/base1.py +++ b/src/sage/geometry/polyhedron/base1.py @@ -428,7 +428,7 @@ def an_affine_basis(self): """ Return points in ``self`` that are a basis for the affine span of the polytope. - This implementation of the method :meth:`ConvexSet_base.an_affine_basis` + This implementation of the method :meth:`~sage.geometry.convex_set.ConvexSet_base.an_affine_basis` for polytopes guarantees the following: - All points are vertices. From bb56fc8488459d0e041d84e3a7e5da8f627f3ff5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 20:30:14 -0700 Subject: [PATCH 18/28] src/sage/geometry/polyhedron/base2.py: Fix method/class references --- src/sage/geometry/polyhedron/base2.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/geometry/polyhedron/base2.py b/src/sage/geometry/polyhedron/base2.py index cec3fd2ccd0..0d7606d96d0 100644 --- a/src/sage/geometry/polyhedron/base2.py +++ b/src/sage/geometry/polyhedron/base2.py @@ -343,7 +343,7 @@ def integral_points_count(self, **kwds): r""" Return the number of integral points in the polyhedron. - This generic version of this method simply calls ``integral_points``. + This generic version of this method simply calls :meth:`integral_points`. EXAMPLES:: @@ -527,7 +527,7 @@ def get_integral_point(self, index, **kwds): Return the ``index``-th integral point in this polyhedron. This is equivalent to ``sorted(self.integral_points())[index]``. - However, so long as self.integral_points_count() does not need to + However, so long as :meth:`integral_points_count` does not need to enumerate all integral points, neither does this method. Hence it can be significantly faster. If the polyhedron is not compact, a ``ValueError`` is raised. @@ -539,7 +539,7 @@ def get_integral_point(self, index, **kwds): is raised. - ``**kwds`` -- optional keyword parameters that are passed to - :meth:`self.integral_points_count`. + :meth:`integral_points_count`. ALGORITHM: @@ -625,14 +625,14 @@ def random_integral_point(self, **kwds): INPUT: - ``**kwds`` -- optional keyword parameters that are passed to - :meth:`self.get_integral_point`. + :meth:`get_integral_point`. OUTPUT: The integral point in the polyhedron chosen uniformly at random. If the polyhedron is not compact, a ``ValueError`` is raised. If the - polyhedron does not contain any integral points, an ``EmptySetError`` is - raised. + polyhedron does not contain any integral points, an + :class:`~sage.categories.sets_cat.EmptySetError` is raised. .. SEEALSO:: From 2fbd57880df94b34270ee70874eaec11d83f2280 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 20:58:29 -0700 Subject: [PATCH 19/28] src/sage/geometry/polyhedron/base3.py: Fix method/class references --- src/sage/geometry/polyhedron/base3.py | 34 +++++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/sage/geometry/polyhedron/base3.py b/src/sage/geometry/polyhedron/base3.py index c315960b10f..72f0a66bd7d 100644 --- a/src/sage/geometry/polyhedron/base3.py +++ b/src/sage/geometry/polyhedron/base3.py @@ -103,9 +103,9 @@ def slack_matrix(self): .. NOTE:: The columns correspond to inequalities/equations in the - order :meth:`Hrepresentation`, the rows correspond to + order :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Hrepresentation`, the rows correspond to vertices/rays/lines in the order - :meth:`Vrepresentation`. + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Vrepresentation`. .. SEEALSO:: @@ -180,9 +180,9 @@ def incidence_matrix(self): .. NOTE:: The columns correspond to inequalities/equations in the - order :meth:`Hrepresentation`, the rows correspond to + order :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Hrepresentation`, the rows correspond to vertices/rays/lines in the order - :meth:`Vrepresentation`. + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Vrepresentation`. .. SEEALSO:: @@ -380,8 +380,10 @@ def face_generator(self, face_dimension=None, algorithm=None, **kwds): - ``face_dimension`` -- integer (default ``None``), yield only faces of this dimension if specified + - ``algorithm`` -- string (optional); specify whether to start with facets or vertices: + * ``'primal'`` -- start with the facets * ``'dual'`` -- start with the vertices * ``None`` -- choose automatically @@ -644,13 +646,13 @@ def faces(self, face_dimension): A tuple of :class:`~sage.geometry.polyhedron.face.PolyhedronFace`. See - :mod:`~sage.geometry.polyhedron.face` for details. The order + module :mod:`sage.geometry.polyhedron.face` for details. The order is random but fixed. .. SEEALSO:: :meth:`face_generator`, - :meth:`facet`. + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.facet`. EXAMPLES: @@ -795,6 +797,7 @@ def f_vector(self, num_threads=None, parallelization_depth=None, algorithm=None) - ``algorithm`` -- string (optional); specify whether the face generator starts with facets or vertices: + * ``'primal'`` -- start with the facets * ``'dual'`` -- start with the vertices * ``None`` -- choose automatically @@ -806,10 +809,10 @@ def f_vector(self, num_threads=None, parallelization_depth=None, algorithm=None) .. NOTE:: - The ``vertices`` as given by :meth:`Polyhedron_base.vertices` + The ``vertices`` as given by :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.vertices` do not need to correspond to `0`-dimensional faces. If a polyhedron contains `k` lines they correspond to `k`-dimensional faces. - See example below + See example below. EXAMPLES:: @@ -892,6 +895,7 @@ def vertex_adjacency_matrix(self, algorithm=None): - ``algorithm`` -- string (optional); specify whether the face generator starts with facets or vertices: + * ``'primal'`` -- start with the facets * ``'dual'`` -- start with the vertices * ``None`` -- choose automatically @@ -1029,6 +1033,7 @@ def facet_adjacency_matrix(self, algorithm=None): - ``algorithm`` -- string (optional); specify whether the face generator starts with facets or vertices: + * ``'primal'`` -- start with the facets * ``'dual'`` -- start with the vertices * ``None`` -- choose automatically @@ -1146,7 +1151,7 @@ def simplicity(self): A polytope `P` is `k`-simple, if every `(d-1-k)`-face is contained in exactly `k+1` facets of `P` for `1 \leq k \leq d-1`. Equivalently it is `k`-simple if the polar/dual polytope is `k`-simplicial. - If `self` is a simplex, it returns its dimension. + If ``self`` is a simplex, it returns its dimension. EXAMPLES:: @@ -1197,7 +1202,7 @@ def simpliciality(self): Return the largest integer `k` such that the polytope is `k`-simplicial. A polytope is `k`-simplicial, if every `k`-face is a simplex. - If `self` is a simplex, returns its dimension. + If ``self`` is a simplex, returns its dimension. EXAMPLES:: @@ -1690,7 +1695,8 @@ def meet_of_Hrep(self, *Hrepresentatives): INPUT: - ``Hrepresentatives`` -- facets or indices of Hrepresentatives; - the indices are assumed to be the indices of the Hrepresentation + the indices are assumed to be the indices of the + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Hrepresentation` OUTPUT: a :class:`~sage.geometry.polyhedron.face.PolyhedronFace` @@ -1708,7 +1714,8 @@ def meet_of_Hrep(self, *Hrepresentatives): sage: P.meet_of_Hrep(1,3,7).ambient_H_indices() (0, 1, 3, 7) - The indices are the indices of the Hrepresentation. + The indices are the indices of the + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Hrepresentation`. ``0`` corresponds to an equation and is ignored:: sage: P.meet_of_Hrep(0) @@ -1741,7 +1748,8 @@ def meet_of_Hrep(self, *Hrepresentatives): TESTS: Equations are not considered by the combinatorial polyhedron. - We check that the index corresponds to the Hrepresentation index:: + We check that the index corresponds to the + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Hrepresentation` index:: sage: P = polytopes.permutahedron(3, backend='field') sage: P.Hrepresentation() From 8eece7c84fdd7dc02a7ced5d18c8bf7199d7972b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 21:11:12 -0700 Subject: [PATCH 20/28] src/sage/geometry/polyhedron/base4.py: Fix method/class references --- src/sage/geometry/polyhedron/base4.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/sage/geometry/polyhedron/base4.py b/src/sage/geometry/polyhedron/base4.py index 3cd297a2663..ba3a1bd084a 100644 --- a/src/sage/geometry/polyhedron/base4.py +++ b/src/sage/geometry/polyhedron/base4.py @@ -152,16 +152,17 @@ def vertex_graph(self, **kwds): - ``algorithm`` -- string (optional); specify whether the face generator starts with facets or vertices: + * ``'primal'`` -- start with the facets * ``'dual'`` -- start with the vertices * ``None`` -- choose automatically - ..NOTE:: + .. NOTE:: The graph of a polyhedron with lines has no vertices, as the polyhedron has no vertices (`0`-faces). - The method :meth:`Polyhedron_base:vertices` returns + The method :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.vertices` returns the defining points in this case. EXAMPLES:: @@ -211,7 +212,7 @@ def vertex_digraph(self, f, increasing=True): - ``f`` -- a linear form. The linear form can be provided as: - a vector space morphism with one-dimensional codomain, (see - :meth:`sage.modules.vector_space_morphism.linear_transformation` + :func:`sage.modules.vector_space_morphism.linear_transformation` and :class:`sage.modules.vector_space_morphism.VectorSpaceMorphism`) - a vector ; in this case the linear form is obtained by duality @@ -778,7 +779,7 @@ def restricted_automorphism_group(self, output="abstract"): - For ``output="abstract"`` and ``output="permutation"``: a :class:`PermutationGroup`. - - For ``output="matrix"``: a :class:`MatrixGroup`. + - For ``output="matrix"``: a :func:`~sage.groups.matrix_gps.finitely_generated.MatrixGroup`. - For ``output="matrixlist"``: a list of matrices. @@ -1052,8 +1053,8 @@ def is_combinatorially_isomorphic(self, other, algorithm='bipartite_graph'): INPUT: - ``other`` -- a polyhedron object - - ``algorithm`` (default = ``bipartite_graph``) -- the algorithm to use. - The other possible value is ``face_lattice``. + - ``algorithm`` (default = ``'bipartite_graph'``) -- the algorithm to use. + The other possible value is ``'face_lattice'``. OUTPUT: From cbfbe284253a7b2e5de6a3ece331655de0814c9b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 21:17:42 -0700 Subject: [PATCH 21/28] src/sage/geometry/polyhedron/base5.py: Fix method/class references --- src/sage/geometry/polyhedron/base5.py | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sage/geometry/polyhedron/base5.py b/src/sage/geometry/polyhedron/base5.py index 149d7eb7164..f16bce682b9 100644 --- a/src/sage/geometry/polyhedron/base5.py +++ b/src/sage/geometry/polyhedron/base5.py @@ -678,14 +678,14 @@ def minkowski_sum(self, other): .. MATH:: X \oplus Y = - \cup_{y\in Y} (X+y) = - \cup_{x\in X, y\in Y} (x+y) + \bigcup_{y\in Y} (X+y) = + \bigcup_{x\in X, y\in Y} (x+y) See :meth:`minkowski_difference` for a partial inverse operation. INPUT: - - ``other`` -- a :class:`Polyhedron_base` + - ``other`` -- a :class:`~sage.geometry.polyhedron.base.Polyhedron_base` OUTPUT: @@ -736,7 +736,7 @@ def minkowski_difference(self, other): X \ominus Y = (X^c \oplus Y)^c = - \cap_{y\in Y} (X-y) + \bigcap_{y\in Y} (X-y) where superscript-"c" means the complement in the ambient vector space. The Minkowski difference of convex sets is @@ -753,7 +753,7 @@ def minkowski_difference(self, other): INPUT: - - ``other`` -- a :class:`Polyhedron_base` + - ``other`` -- a :class:`~sage.geometry.polyhedron.base.Polyhedron_base` OUTPUT: @@ -884,7 +884,7 @@ def product(self, other): INPUT: - - ``other`` -- a :class:`Polyhedron_base` + - ``other`` -- a :class:`~sage.geometry.polyhedron.base.Polyhedron_base` OUTPUT: @@ -1147,7 +1147,7 @@ def subdirect_sum(self, other): INPUT: - - ``other`` -- a :class:`Polyhedron_base` + - ``other`` -- a :class:`~sage.geometry.polyhedron.base.Polyhedron_base` EXAMPLES:: @@ -1212,7 +1212,7 @@ def direct_sum(self, other): INPUT: - - ``other`` -- a :class:`Polyhedron_base` + - ``other`` -- a :class:`~sage.geometry.polyhedron.base.Polyhedron_base` EXAMPLES:: @@ -1897,17 +1897,17 @@ def face_truncation(self, face, linear_coefficients=None, cut_frac=None): INPUT: - - ``face`` -- a PolyhedronFace + - ``face`` -- a :class:`~sage.geometry.polyhedron.face.PolyhedronFace` - ``linear_coefficients`` -- tuple of integer. Specifies the coefficient of the normal vector of the cutting hyperplane used to truncate the face. The default direction is determined using the normal fan of the polyhedron. - ``cut_frac`` -- number between 0 and 1. Determines where the - hyperplane cuts the polyhedron. A value close to 0 cuts very close - to the face, whereas a value close to 1 cuts very close to the next - vertex (according to the normal vector of the cutting hyperplane). - Default is `\frac{1}{3}`. + hyperplane cuts the polyhedron. A value close to 0 cuts very close + to the face, whereas a value close to 1 cuts very close to the next + vertex (according to the normal vector of the cutting hyperplane). + Default is `\frac{1}{3}`. OUTPUT: @@ -2269,7 +2269,7 @@ def wedge(self, face, width=1): The backend should be preserved as long as the value of width permits. The base_ring will change to the field of fractions of the current - base_ring, unless width forces a different ring. :: + base_ring, unless ``width`` forces a different ring. :: sage: P = polytopes.cyclic_polytope(3,7, base_ring=ZZ, backend='field') sage: W1 = P.wedge(P.faces(2)[0]); W1.base_ring(); W1.backend() From a485646f504d17a1d059f613cccfda29134bd582 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 21:19:43 -0700 Subject: [PATCH 22/28] src/sage/geometry/cone_catalog.py: Fix references to ConvexRationalPolyhedralCone --- src/sage/geometry/cone_catalog.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/geometry/cone_catalog.py b/src/sage/geometry/cone_catalog.py index 43770fddccb..a3d1ffa670f 100644 --- a/src/sage/geometry/cone_catalog.py +++ b/src/sage/geometry/cone_catalog.py @@ -177,7 +177,7 @@ def nonnegative_orthant(ambient_dim=None, lattice=None): OUTPUT: - A :class:`.ConvexRationalPolyhedralCone` living in ``lattice`` + A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone` living in ``lattice`` and having ``ambient_dim`` standard basis vectors as its generators. Each generating ray has the integer ring as its base ring. @@ -287,7 +287,7 @@ def rearrangement(p, ambient_dim=None, lattice=None): OUTPUT: - A :class:`.ConvexRationalPolyhedralCone` representing the + A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone` representing the rearrangement cone of order ``p`` living in ``lattice``, with ambient dimension ``ambient_dim``. Each generating ray has the integer ring as its base ring. @@ -506,7 +506,7 @@ def schur(ambient_dim=None, lattice=None): OUTPUT: - A :class:`.ConvexRationalPolyhedralCone` representing the Schur + A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone` representing the Schur cone living in ``lattice``, with ambient dimension ``ambient_dim``. Each generating ray has the integer ring as its base ring. @@ -635,7 +635,7 @@ def trivial(ambient_dim=None, lattice=None): OUTPUT: - A :class:`.ConvexRationalPolyhedralCone` representing the + A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone` representing the trivial cone with no nonzero generators living in ``lattice``, with ambient dimension ``ambient_dim``. From b122baf5cc6dff5556270b77593e5ed0c135e6cb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 21:24:12 -0700 Subject: [PATCH 23/28] src/sage/geometry/polyhedron/base6.py: Fix method/class references --- src/sage/geometry/polyhedron/base6.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/geometry/polyhedron/base6.py b/src/sage/geometry/polyhedron/base6.py index 5637e56d890..3257c27fe0a 100644 --- a/src/sage/geometry/polyhedron/base6.py +++ b/src/sage/geometry/polyhedron/base6.py @@ -502,7 +502,7 @@ def tikz(self, view=[0, 0, 1], angle=0, scale=1, .. NOTE:: This is a wrapper of a method of the projection object - `self.projection()`. See :meth:`~sage.geometry.polyhedron.plot.Projection.tikz` + ``self.projection()``. See :meth:`~sage.geometry.polyhedron.plot.Projection.tikz` for more detail. The inputs ``view`` and ``angle`` can be obtained by visualizing it @@ -638,7 +638,7 @@ def gale_transform(self): .. SEEALSO:: - :func`~sage.geometry.polyhedron.library.gale_transform_to_polyhedron`. + :func:`~sage.geometry.polyhedron.library.gale_transform_to_polyhedron`. TESTS:: @@ -718,7 +718,7 @@ def projection(self, projection=None): .. SEEALSO:: - :meth:`~sage.geometry.polyhedron.base.Polyhedron_base.schlegel_projection` for a more interesting projection. + :meth:`~sage.geometry.polyhedron.base6.Polyhedron_base6.schlegel_projection` for a more interesting projection. EXAMPLES:: @@ -782,8 +782,8 @@ def schlegel_projection(self, facet=None, position=None): INPUT: - - ``facet`` -- a PolyhedronFace. The facet into which the Schlegel - diagram is created. The default is the first facet. + - ``facet`` -- a :class:`~sage.geometry.polyhedron.face.PolyhedronFace`. + The facet into which the Schlegel diagram is created. The default is the first facet. - ``position`` -- a positive number. Determines a relative distance from the barycenter of ``facet``. A value close to 0 will place the From 0d3b5efa15e0c30ef2e079d3bef6af98f27c7f26 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 16 Jul 2022 21:26:59 -0700 Subject: [PATCH 24/28] src/sage/geometry/polyhedron/base7.py: Fix method/class references --- src/sage/geometry/polyhedron/base7.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/geometry/polyhedron/base7.py b/src/sage/geometry/polyhedron/base7.py index 898c97fb5c8..634edc2d7a0 100644 --- a/src/sage/geometry/polyhedron/base7.py +++ b/src/sage/geometry/polyhedron/base7.py @@ -216,9 +216,9 @@ def triangulate(self, engine='auto', connected=True, fine=False, regular=None, s OUTPUT: A triangulation of the convex hull of the vertices as a - :class:`~sage.geometry.triangulation.point_configuration.Triangulation`. The + :class:`~sage.geometry.triangulation.element.Triangulation`. The indices in the triangulation correspond to the - :meth:`Vrepresentation` objects. + :meth:`~sage.geometry.polyhedron.base0.Polyhedron_base0.Vrepresentation` objects. EXAMPLES:: @@ -515,7 +515,7 @@ def volume(self, measure='ambient', engine='auto', **kwds): When considering lower-dimensional polytopes, we can ask for the ambient (full-dimensional), the induced measure (of the affine hull) or, in the case of lattice polytopes, for the induced rational measure. - This is controlled by the parameter `measure`. Different engines + This is controlled by the parameter ``measure``. Different engines may have different ideas on the definition of volume of a lower-dimensional object:: From 858e982549d2e2457bd63600e6d565675b5d8582 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 8 Aug 2022 16:48:41 -0700 Subject: [PATCH 25/28] src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx: Reformat algorithm, avoid unicode symbols --- .../face_iterator.pyx | 118 ++++++++++-------- 1 file changed, 67 insertions(+), 51 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index cc36509a47e..4fe24c3d45b 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -1464,84 +1464,100 @@ cdef class FaceIterator(FaceIterator_base): ALGORITHM: - For the special case that the all intervals of the lattice not containing zero are boolean - (e.g. when the polyhedron is simple) the algorithm is modified. See below. - - - A (slightly generalized) description of the algorithm can be found in [KS2019]_. - The algorithm to visit all proper faces exactly once is roughly - equivalent to:: + equivalent to the following. A (slightly generalized) description of the + algorithm can be found in [KS2019]_. + + Initialization:: faces = [set(facet) for facet in P.facets()] face_iterator(faces, []) + The function ``face_iterator`` is defined recursively. It visits all faces of + the polyhedron `P`, except those contained in any of ``visited_all``. + It assumes ``faces`` to be exactly those facets of `P` + that are not contained in any of the ``visited_all``. + It assumes ``visited_all`` to be some list of faces of + a polyhedron `P_2`, which contains `P` as one of its faces:: + def face_iterator(faces, visited_all): - # Visit all faces of a polyhedron `P`, except those contained in - # any of the visited all. + while facets: + one_face = faces.pop() + maybe_new_faces = [one_face.intersection(face) for face in faces] + ... - # Assumes ``faces`` to be exactly those facets of `P` - # that are not contained in any of the ``visited_all``. + At this point we claim that ``maybe_new_faces`` contains all facets of ``one_face``, + which we have not visited before. - # Assumes ``visited_all`` to be some list of faces of - # a polyhedron `P_2`, which contains `P` as one of its faces. + Proof: Let `F` be a facet of ``one_face``. We have a chain: - while facets: - one_face = faces.pop() - new_faces = [one_face.intersection(face) for face in faces] - - # ``maybe_new_faces`` contains all facets of ``one_face``, - # which we have not visited before. - # Proof: Let `F` be a facet of ``one_face``. - # We have a chain: - # `P` ⊃ ``one_face`` ⊃ `F`. - # By diamond property there exists ``second_face`` with: - # `P` ⊃ ``second_face`` ⊃ `F`. - - # Either ``second_face`` is not an element of ``faces``: - # Hence ``second_face`` is contained in one of ``visited_all``. - # In particular, `F` is contained in ``visited_all``. - # Or ``second_face`` is an element of ``faces``: - # Then, intersecting ``one_face`` with ``second_face`` gives - # ``F``. ∎ - - # If an element in ``maybe_new_faces`` is inclusion maximal - # and not contained in any of the ``visited_all``, - # it is a facet of ``one_face``. - # Any facet in ``maybe_new_faces`` of ``one_face`` - # is inclusion maximal. + .. MATH:: + + P \supset \texttt{one_face} \supset F. + + By the diamond property, there exists a ``second_face`` with: + + .. MATH:: + + P \supset \texttt{second_face} \supset F. + + Now either ``second_face`` is not an element of ``faces``: + Hence ``second_face`` is contained in one of ``visited_all``. + In particular, `F` is contained in ``visited_all``. + + Or ``second_face`` is an element of ``faces``: + Then, intersecting ``one_face`` with ``second_face`` gives ``F``. + + This concludes the proof. + + Moreover, if an element in ``maybe_new_faces`` is inclusion-maximal + and not contained in any of the ``visited_all``, it is a facet of ``one_face``. + Any facet in ``maybe_new_faces`` of ``one_face`` is inclusion-maximal. + + Hence, in the following loop, an element ``face1`` in ``maybe_new_faces`` + is a facet of ``one_face`` if and only if it is not contained in another facet:: + + ... maybe_new_faces2 = [] for i, face1 in enumerate(maybe_new_faces): - # ``face1`` is a facet of ``one_face``, - # iff it is not contained in another facet. if (all(not face1 < face2 for face2 in maybe_new_faces[:i]) and all(not face1 <= face2 for face2 in maybe_new_faces[i+1:])): maybe_new_faces2.append(face1) + ... + + Now ``maybe_new_faces2`` contains only facets of ``one_face`` + and some faces contained in any of ``visited_all``. + It also contains all the facets not contained in any of ``visited_all``. + + We construct ``new_faces`` as the list of all facets of ``one_face`` + not contained in any of ``visited_all``:: - # ``maybe_new_faces2`` contains only facets of ``one_face`` - # and some faces contained in any of ``visited_all``. - # It also contains all the facets not contained in any of ``visited_all``. - # Let ``new_faces`` be the list of all facets of ``one_face`` - # not contained in any of ``visited_all``. + ... new_faces = [] for face1 in maybe_new_faces2: if all(not face1 < face2 for face2 in visited_all): new_faces.append(face1) + ... - # By induction we can apply the algorithm, to visit all - # faces of ``one_face`` not contained in ``visited_all``: + By induction we can apply the algorithm, to visit all + faces of ``one_face`` not contained in ``visited_all``:: + + ... face_iterator(new_faces, visited_all) + ... + + Finally we visit ``one_face`` and add it to ``visited_all``:: - # Finally visit ``one_face`` and add it to ``visited_all``: + ... visit(one_face) visited_all.append(one_face) - # Note: At this point, we have visited exactly those faces, - # contained in any of the ``visited_all``. + Note: At this point, we have visited exactly those faces, + contained in any of the ``visited_all``. The function ends here. - For the special case that the all intervals of the lattice not containing zero are boolean - (e.g. when the polyhedron is simple), the algorithm can be modified. + ALGORITHM for the special case that all intervals of the lattice not + containing zero are boolean (e.g. when the polyhedron is simple): We do not assume any other properties of our lattice in this case. Note that intervals of length 2 not containing zero, have exactly 2 elements now. From 50216044e804c7dd8c5eed8050598adb45cbfe9a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 8 Aug 2022 18:31:16 -0700 Subject: [PATCH 26/28] src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx: Reformat algorithm, avoid unicode symbols (fixup) --- .../combinatorial_polyhedron/face_iterator.pyx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index 4fe24c3d45b..f1885cb4873 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -1484,7 +1484,7 @@ cdef class FaceIterator(FaceIterator_base): while facets: one_face = faces.pop() maybe_new_faces = [one_face.intersection(face) for face in faces] - ... + ... At this point we claim that ``maybe_new_faces`` contains all facets of ``one_face``, which we have not visited before. @@ -1517,13 +1517,13 @@ cdef class FaceIterator(FaceIterator_base): Hence, in the following loop, an element ``face1`` in ``maybe_new_faces`` is a facet of ``one_face`` if and only if it is not contained in another facet:: - ... + ... maybe_new_faces2 = [] for i, face1 in enumerate(maybe_new_faces): if (all(not face1 < face2 for face2 in maybe_new_faces[:i]) and all(not face1 <= face2 for face2 in maybe_new_faces[i+1:])): maybe_new_faces2.append(face1) - ... + ... Now ``maybe_new_faces2`` contains only facets of ``one_face`` and some faces contained in any of ``visited_all``. @@ -1532,23 +1532,23 @@ cdef class FaceIterator(FaceIterator_base): We construct ``new_faces`` as the list of all facets of ``one_face`` not contained in any of ``visited_all``:: - ... + ... new_faces = [] for face1 in maybe_new_faces2: if all(not face1 < face2 for face2 in visited_all): new_faces.append(face1) - ... + ... By induction we can apply the algorithm, to visit all faces of ``one_face`` not contained in ``visited_all``:: - ... + ... face_iterator(new_faces, visited_all) - ... + ... Finally we visit ``one_face`` and add it to ``visited_all``:: - ... + ... visit(one_face) visited_all.append(one_face) From feec89bd1bf78ae083db9798845a95916a94a5c1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 8 Aug 2022 18:54:02 -0700 Subject: [PATCH 27/28] src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx: Reformat algorithm, avoid unicode symbols (fixup 2) --- .../polyhedron/combinatorial_polyhedron/face_iterator.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index f1885cb4873..77cd4c79ca0 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -1493,13 +1493,13 @@ cdef class FaceIterator(FaceIterator_base): .. MATH:: - P \supset \texttt{one_face} \supset F. + P \supset \texttt{one\_face} \supset F. By the diamond property, there exists a ``second_face`` with: .. MATH:: - P \supset \texttt{second_face} \supset F. + P \supset \texttt{second\_face} \supset F. Now either ``second_face`` is not an element of ``faces``: Hence ``second_face`` is contained in one of ``visited_all``. From 3082afef02adb97c5cf46f3c96508e980d1ffe44 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 8 Aug 2022 19:09:18 -0700 Subject: [PATCH 28/28] src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx: Reformat algorithm, avoid unicode symbols (fixup 3) --- .../combinatorial_polyhedron/face_iterator.pyx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index 77cd4c79ca0..b8f9f0a27b0 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -1490,16 +1490,9 @@ cdef class FaceIterator(FaceIterator_base): which we have not visited before. Proof: Let `F` be a facet of ``one_face``. We have a chain: - - .. MATH:: - - P \supset \texttt{one\_face} \supset F. - - By the diamond property, there exists a ``second_face`` with: - - .. MATH:: - - P \supset \texttt{second\_face} \supset F. + `P \supset{}` ``one_face`` `{}\supset F`. + By the diamond property, there exists a ``second_face`` with + `P \supset{}` ``second_face`` `{}\supset F`. Now either ``second_face`` is not an element of ``faces``: Hence ``second_face`` is contained in one of ``visited_all``.