From 5d2e7489483492829a2d4a37bd13b222dbda25d7 Mon Sep 17 00:00:00 2001 From: Jonathan Kliem Date: Fri, 13 Mar 2020 16:28:55 +0100 Subject: [PATCH] fixing failing doctests due to reordering --- src/sage/geometry/polyhedron/base.py | 12 +-- .../combinatorial_polyhedron/base.pyx | 30 ++++---- .../combinatorial_face.pyx | 46 +++++++----- .../combinatorial_polyhedron/conversions.pyx | 74 +++++++++---------- .../polyhedron_face_lattice.pyx | 4 +- 5 files changed, 88 insertions(+), 78 deletions(-) diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py index 01989bbd80e..f4a830d784f 100644 --- a/src/sage/geometry/polyhedron/base.py +++ b/src/sage/geometry/polyhedron/base.py @@ -2031,11 +2031,11 @@ def an_affine_basis(self): sage: P = polytopes.permutahedron(5) sage: P.an_affine_basis() - [A vertex at (4, 1, 5, 2, 3), - A vertex at (5, 1, 4, 2, 3), - A vertex at (4, 2, 5, 1, 3), - A vertex at (4, 1, 5, 3, 2), - A vertex at (1, 2, 3, 4, 5)] + [A vertex at (1, 2, 3, 5, 4), + A vertex at (2, 1, 3, 5, 4), + A vertex at (1, 3, 2, 5, 4), + A vertex at (4, 1, 3, 5, 2), + A vertex at (4, 2, 5, 3, 1)] The method is not implemented for unbounded polyhedra:: @@ -9172,7 +9172,7 @@ def affine_hull_projection(self, as_affine_map=False, orthogonal=False, orthonor sage: A, b = P.affine_hull_projection(orthonormal=True, as_affine_map=True, extend=True) sage: Q = P.affine_hull_projection(orthonormal=True, extend=True) sage: Q.center() - (0.7071067811865475?, 0.7071067811865475?, 2) + (0.7071067811865475?, 1.224744871391589?, 1.732050807568878?) sage: A(P.center()) + b == Q.center() True diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx index d7d27efc5f0..5f7d49fb6f0 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx @@ -2099,29 +2099,33 @@ cdef class CombinatorialPolyhedron(SageObject): sage: face = next(it); face A 2-dimensional face of a 4-dimensional combinatorial polyhedron sage: face.ambient_Vrepresentation() - (A vertex at (4, 1, 5, 2, 3), - A vertex at (4, 2, 5, 1, 3), - A vertex at (5, 1, 4, 2, 3), - A vertex at (5, 2, 4, 1, 3)) + (A vertex at (1, 3, 2, 5, 4), + A vertex at (2, 3, 1, 5, 4), + A vertex at (3, 1, 2, 5, 4), + A vertex at (3, 2, 1, 5, 4), + A vertex at (2, 1, 3, 5, 4), + A vertex at (1, 2, 3, 5, 4)) sage: face = next(it); face A 2-dimensional face of a 4-dimensional combinatorial polyhedron sage: face.ambient_Vrepresentation() - (A vertex at (4, 1, 5, 2, 3), - A vertex at (4, 1, 5, 3, 2), - A vertex at (5, 1, 4, 2, 3), - A vertex at (5, 1, 4, 3, 2)) + (A vertex at (2, 1, 4, 5, 3), + A vertex at (3, 2, 4, 5, 1), + A vertex at (3, 1, 4, 5, 2), + A vertex at (1, 3, 4, 5, 2), + A vertex at (1, 2, 4, 5, 3), + A vertex at (2, 3, 4, 5, 1)) sage: face.ambient_Hrepresentation() - (An inequality (0, 1, 0, 0, 0) x - 1 >= 0, - An inequality (0, 1, 0, 1, 1) x - 6 >= 0, + (An inequality (0, 0, -1, -1, 0) x + 9 >= 0, + An inequality (0, 0, 0, -1, 0) x + 5 >= 0, An equation (1, 1, 1, 1, 1) x - 15 == 0) sage: face.ambient_H_indices() (25, 29) sage: face = next(it); face A 2-dimensional face of a 4-dimensional combinatorial polyhedron sage: face.ambient_H_indices() - (12, 29) + (24, 29) sage: face.ambient_V_indices() - (76, 77, 82, 83, 88, 89) + (32, 89, 90, 94) sage: C = CombinatorialPolyhedron([[0,1,2],[0,1,3],[0,2,3],[1,2,3]]) sage: it = C.face_iter() @@ -2406,7 +2410,7 @@ cdef class CombinatorialPolyhedron(SageObject): A 1-dimensional face of a 3-dimensional combinatorial polyhedron, A 2-dimensional face of a 3-dimensional combinatorial polyhedron] sage: [face.ambient_V_indices() for face in chain] - [(13,), (13, 15), (13, 15, 19, 21)] + [(16,), (15, 16), (8, 9, 14, 15, 16, 17)] sage: P = Polyhedron(rays=[[1,0]], lines=[[0,1]]) sage: C = P.combinatorial_polyhedron() diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx index b7131b58e65..8d5def50799 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx @@ -346,16 +346,20 @@ cdef class CombinatorialFace(SageObject): sage: it = C.face_iter(dimension=2) sage: face = next(it) sage: face.ambient_Vrepresentation() - (A vertex at (4, 1, 5, 2, 3), - A vertex at (4, 2, 5, 1, 3), - A vertex at (5, 1, 4, 2, 3), - A vertex at (5, 2, 4, 1, 3)) + (A vertex at (1, 3, 2, 5, 4), + A vertex at (2, 3, 1, 5, 4), + A vertex at (3, 1, 2, 5, 4), + A vertex at (3, 2, 1, 5, 4), + A vertex at (2, 1, 3, 5, 4), + A vertex at (1, 2, 3, 5, 4)) sage: face = next(it) sage: face.ambient_Vrepresentation() - (A vertex at (4, 1, 5, 2, 3), - A vertex at (4, 1, 5, 3, 2), - A vertex at (5, 1, 4, 2, 3), - A vertex at (5, 1, 4, 3, 2)) + (A vertex at (2, 1, 4, 5, 3), + A vertex at (3, 2, 4, 5, 1), + A vertex at (3, 1, 4, 5, 2), + A vertex at (1, 3, 4, 5, 2), + A vertex at (1, 2, 4, 5, 3), + A vertex at (2, 3, 4, 5, 1)) sage: C = CombinatorialPolyhedron([[0,1,2],[0,1,3],[0,2,3],[1,2,3]]) sage: it = C.face_iter() @@ -406,9 +410,9 @@ cdef class CombinatorialFace(SageObject): sage: it = C.face_iter(dimension=2) sage: face = next(it) sage: next(it).ambient_V_indices() - (76, 77, 100, 101) + (32, 91, 92, 93, 94, 95) sage: next(it).ambient_V_indices() - (76, 77, 82, 83, 88, 89) + (32, 89, 90, 94) sage: C = CombinatorialPolyhedron([[0,1,2],[0,1,3],[0,2,3],[1,2,3]]) sage: it = C.face_iter() @@ -469,10 +473,12 @@ cdef class CombinatorialFace(SageObject): sage: face.Vrepr() doctest:...: DeprecationWarning: the method Vrepr of CombinatorialPolyhedron is deprecated; use ambient_V_indices or ambient_Vrepresentation See https://trac.sagemath.org/28616 for details. - (A vertex at (4, 1, 5, 2, 3), - A vertex at (4, 2, 5, 1, 3), - A vertex at (5, 1, 4, 2, 3), - A vertex at (5, 2, 4, 1, 3)) + (A vertex at (1, 3, 2, 5, 4), + A vertex at (2, 3, 1, 5, 4), + A vertex at (3, 1, 2, 5, 4), + A vertex at (3, 2, 1, 5, 4), + A vertex at (2, 1, 3, 5, 4), + A vertex at (1, 2, 3, 5, 4)) """ from sage.misc.superseded import deprecation deprecation(28616, "the method Vrepr of CombinatorialPolyhedron is deprecated; use ambient_V_indices or ambient_Vrepresentation", 3) @@ -526,12 +532,12 @@ cdef class CombinatorialFace(SageObject): sage: C = CombinatorialPolyhedron(P) sage: it = C.face_iter(2) sage: next(it).ambient_Hrepresentation() - (An inequality (0, 1, 0, 1, 0) x - 3 >= 0, - An inequality (0, 1, 0, 1, 1) x - 6 >= 0, + (An inequality (1, 1, 1, 0, 0) x - 6 >= 0, + An inequality (0, 0, 0, -1, 0) x + 5 >= 0, An equation (1, 1, 1, 1, 1) x - 15 == 0) sage: next(it).ambient_Hrepresentation() - (An inequality (0, 1, 0, 0, 0) x - 1 >= 0, - An inequality (0, 1, 0, 1, 1) x - 6 >= 0, + (An inequality (0, 0, -1, -1, 0) x + 9 >= 0, + An inequality (0, 0, 0, -1, 0) x + 5 >= 0, An equation (1, 1, 1, 1, 1) x - 15 == 0) sage: P = polytopes.cyclic_polytope(4,6) @@ -647,8 +653,8 @@ cdef class CombinatorialFace(SageObject): sage: next(it).Hrepr() doctest:...: DeprecationWarning: the method Hrepr of CombinatorialPolyhedron is deprecated; use ambient_H_indices or ambient_Hrepresentation See https://trac.sagemath.org/28616 for details. - (An inequality (0, 1, 0, 1, 0) x - 3 >= 0, - An inequality (0, 1, 0, 1, 1) x - 6 >= 0, + (An inequality (1, 1, 1, 0, 0) x - 6 >= 0, + An inequality (0, 0, 0, -1, 0) x + 5 >= 0, An equation (1, 1, 1, 1, 1) x - 15 == 0) """ from sage.misc.superseded import deprecation diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx index 135000a9523..7774f68b5ee 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx @@ -277,19 +277,19 @@ def incidence_matrix_to_bit_rep_of_facets(matrix): sage: for i in range(facets.n_faces): # long time ....: print(bit_rep_to_Vrep_list_wrapper(facets, i)) (18, 19, 20, 21, 22, 23) - (9, 11, 15, 17, 21, 23) - (16, 17, 22, 23) - (0, 1, 2, 3, 4, 5) - (2, 4, 8, 10) - (0, 1, 6, 7) - (6, 7, 12, 13, 18, 19) - (3, 5, 9, 11) - (1, 3, 7, 9, 13, 15) - (0, 2, 6, 8, 12, 14) - (12, 14, 18, 20) - (4, 5, 10, 11, 16, 17) - (8, 10, 14, 16, 20, 22) - (13, 15, 19, 21) + (3, 5, 8, 10, 12, 17) + (2, 7, 11, 13, 20, 21) + (2, 5, 12, 13) + (4, 6, 14, 15, 19, 23) + (3, 4, 8, 14) + (6, 7, 21, 23) + (2, 3, 4, 5, 6, 7) + (0, 1, 9, 16, 18, 22) + (0, 9, 10, 17) + (1, 11, 20, 22) + (0, 1, 10, 11, 12, 13) + (15, 16, 18, 19) + (8, 9, 14, 15, 16, 17) """ if unlikely(not is_Matrix(matrix)): @@ -365,30 +365,30 @@ def incidence_matrix_to_bit_rep_of_Vrep(matrix): 14 sage: for i in range(vertices.n_faces): ....: print(bit_rep_to_Vrep_list_wrapper(vertices, i)) - (3, 5, 9) - (3, 5, 8) - (3, 4, 9) - (3, 7, 8) - (3, 4, 11) - (3, 7, 11) - (5, 6, 9) - (5, 6, 8) - (4, 9, 12) - (1, 7, 8) - (4, 11, 12) - (1, 7, 11) - (6, 9, 10) - (6, 8, 13) - (9, 10, 12) - (1, 8, 13) - (2, 11, 12) - (1, 2, 11) - (0, 6, 10) - (0, 6, 13) - (0, 10, 12) - (0, 1, 13) - (0, 2, 12) - (0, 1, 2) + (8, 9, 11) + (8, 10, 11) + (2, 3, 7) + (1, 5, 7) + (4, 5, 7) + (1, 3, 7) + (4, 6, 7) + (2, 6, 7) + (1, 5, 13) + (8, 9, 13) + (1, 9, 11) + (2, 10, 11) + (1, 3, 11) + (2, 3, 11) + (4, 5, 13) + (4, 12, 13) + (8, 12, 13) + (1, 9, 13) + (0, 8, 12) + (0, 4, 12) + (0, 2, 10) + (0, 2, 6) + (0, 8, 10) + (0, 4, 6) """ if unlikely(not is_Matrix(matrix)): raise ValueError("input must be matrix") 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 f7af68746e5..a5199362f72 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx @@ -452,9 +452,9 @@ cdef class PolyhedronFaceLattice: sage: it = C.face_iter(dimension=1) sage: face = next(it) sage: face_via_all_faces_from_iterator(it, C).ambient_Vrepresentation() - (A vertex at (3, 1, 4, 2), A vertex at (3, 2, 4, 1)) + (A vertex at (2, 1, 4, 3), A vertex at (1, 2, 4, 3)) sage: face.ambient_Vrepresentation() - (A vertex at (3, 1, 4, 2), A vertex at (3, 2, 4, 1)) + (A vertex at (2, 1, 4, 3), A vertex at (1, 2, 4, 3)) sage: all(face_via_all_faces_from_iterator(it, C).ambient_Vrepresentation() == ....: face.ambient_Vrepresentation() for face in it) True