From d8424b7f383dbcabd5ef0c7b739ae995acb798ff Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Thu, 18 Jan 2024 20:55:22 +0100 Subject: [PATCH 01/15] functions for conversion from sage-flatsurf/pyflatsurf --- veerer/flatsurf_conversion.py | 185 ++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 veerer/flatsurf_conversion.py diff --git a/veerer/flatsurf_conversion.py b/veerer/flatsurf_conversion.py new file mode 100644 index 00000000..e0913528 --- /dev/null +++ b/veerer/flatsurf_conversion.py @@ -0,0 +1,185 @@ +r""" +Conversions from pyflatsurf and sage-flatsurf to veerer. +""" + +from array import array + +from sage.matrix.constructor import matrix + +from .triangulation import Triangulation +from .veering_triangulation import VeeringTriangulation +from .linear_family import VeeringTriangulationLinearFamily + + +def oriented_slope(a, rotate=1): + r""" + Return either ``(1, 1)``, ``(1, -1)``, ``(-1, 1)`` or ``(-1, -1)``. + + If ``rotate`` is set to ``1`` then consider the edge as if it was rotated counterclockwise + infinitesimally (to make horizontal edges positive slopes and vertical edges negative + slopes). If it is set to ``-1`` then the rotation is in clockwise direction. If it is + set to ``0`` then return ``0`` on horizontal and vertical. + + EXAMPLES:: + + sage: from veerer.flatsurf_conversion import oriented_slope + sage: oriented_slope((1, 1)) + (1, 1) + sage: oriented_slope((-1, 1)) + (-1, 1) + sage: oriented_slope((-1, -1)) + (-1, -1) + sage: oriented_slope((1, -1)) + (1, -1) + + sage: oriented_slope((1, 0)) + (1, 1) + sage: oriented_slope((0, 1)) + (-1, 1) + sage: oriented_slope((-1, 0)) + (-1, -1) + sage: oriented_slope((0, -1)) + (1, -1) + + sage: oriented_slope((1, 0), rotate=-1) + (1, -1) + sage: oriented_slope((0, 1), rotate=-1) + (1, 1) + sage: oriented_slope((-1, 0), rotate=-1) + (-1, 1) + sage: oriented_slope((0, -1), rotate=-1) + (-1, -1) + + sage: oriented_slope((1, 0), rotate=0) + 0 + sage: oriented_slope((0, 1), rotate=0) + 0 + sage: oriented_slope((-1, 0), rotate=0) + 0 + sage: oriented_slope((0, -1), rotate=0) + 0 + + sage: oriented_slope((0, 0)) + Traceback (most recent call last): + ... + ValueError: zero vector + """ + x, y = a + if not x and not y: + raise ValueError("zero vector") + if (x > 0 and y > 0): + return (1, 1) + if (x < 0 and y < 0): + return (-1, -1) + if (x > 0 and y < 0): + return (1, -1) + if (x < 0 and y > 0): + return (-1, 1) + + if rotate == 0: + return 0 + if rotate == 1: + if x > 0: + return (1, 1) + if y > 0: + return (-1, 1) + if x < 0: + return (-1, -1) + if y < 0 : + return (1, -1) + if rotate == -1: + if x > 0: + return (1, -1) + if y > 0: + return (1, 1) + if x < 0: + return (-1, 1) + if y < 0: + return (-1, -1) + raise ValueError("invalid argument rotate={}".format(rotate)) + + +def pyflatsurf_surface_to_veerer_veering_triangulation(surface): + r""" + Convert a pyflatsurf surface in a veering triangulation. + + Note that the flatstructure is lost in the process. + """ + faces = surface.faces() + n = 3 * faces.size() + ep = array('i', [n - i - 1 for i in range(n)]) + fp = array('i', [-1] * n) + slopes = [None] * n + x_orientation = [None] * n + for face in faces: + a, b, c = face + va = surface.fromHalfEdge(a) + sa = oriented_slope((va.x(), va.y())) + vb = surface.fromHalfEdge(b) + sb = oriented_slope((vb.x(), vb.y())) + vc = surface.fromHalfEdge(c) + sc = oriented_slope((vc.x(), vc.y())) + a = a.id() + b = b.id() + c = c.id() + if a < 0 : + a = n + a + elif a > 0: + a = a - 1 + if b < 0: + b = n + b + elif b > 0: + b = b - 1 + if c < 0: + c = n + c + elif c > 0: + c = c - 1 + fp[a] = b + fp[b] = c + fp[c] = a + x_orientation[a] = sa[0] + slopes[a] = sa[0] * sa[1] + x_orientation[b] = sb[0] + slopes[b] = sb[0] * sb[1] + x_orientation[c] = sc[0] + slopes[c] = sc[0] * sc[1] + + colors = "".join("R" if x == 1 else "B" for x in slopes) + t = Triangulation.from_face_edge_perms(fp, ep) + return VeeringTriangulation(t, colors), x_orientation + + +def sage_flatsurf_orbit_closure_to_veerer_linear_family(orbit_closure): + r""" + Conversion of sage-flatsurf ``GL2ROrbitClosure`` to veerer ``VeeringTriangulationLinearFamily``. + + EXAMPLES:: + + sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure + sage: from veerer.flatsurf_conversion import sage_flatsurf_orbit_closure_to_veerer_linear_family + sage: P = Polygon(angles=(1,1,1,7), lengths=(3, 2)) + sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() + sage: S2 = S1.l_infinity_delaunay_triangulation() + sage: O = GL2ROrbitClosure(S2) + sage: for d in O.decompositions(4): + ....: O.update_tangent_space_from_flow_decomposition(d) + ....: if O.dimension() == 4: + ....: break + sage: sage_flatsurf_orbit_closure_to_veerer_linear_family(O) + VeeringTriangulationLinearFamily("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,~5,13)(14,~6,15)(16,~11,~10)(17,18,~12)(19,~13,20)(~20,~17,~16)(~19,~18,~14)(~15,~7,~9)", "BRRRRRBRBBBRRBRRRBRBR", [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, 0, c0, 2*c0, c0, c0, -c0, c0, c0, 0), (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, c0 - 1, 1, c0, 1, 0, -c0 + 1, 2*c0 - 2, -c0 + 2, -c0 + 1), (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, -1, 1, c0 - 1, c0 - 1), (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, -c0 + 1, c0 - 1, c0 - 1)]) + """ + vt, x_orientation = pyflatsurf_surface_to_veerer_veering_triangulation(orbit_closure._surface) + + # build generators for the tangent space + phi = orbit_closure.V2.base_ring().coerce_embedding() + K = phi.codomain() + subspace = [] + for i in range(orbit_closure._U_rank): + v = orbit_closure.lift(orbit_closure._U[i]) + v = [x_orientation[j] * phi(v[j]) for j in range(len(v))] + subspace.append(v) + + R = orbit_closure.field_of_definition() + if orbit_closure.base_ring() != R: + subspace = matrix(orbit_closure.base_ring(), subspace).echelon_form().change_ring(R) + return VeeringTriangulationLinearFamily(vt, subspace) From f55b3b94a7a9ed8ad17ab27c9381b62d7f759cf0 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Thu, 18 Jan 2024 21:02:31 +0100 Subject: [PATCH 02/15] optional flag in doctest --- veerer/flatsurf_conversion.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/veerer/flatsurf_conversion.py b/veerer/flatsurf_conversion.py index e0913528..ea42ea8c 100644 --- a/veerer/flatsurf_conversion.py +++ b/veerer/flatsurf_conversion.py @@ -155,17 +155,17 @@ def sage_flatsurf_orbit_closure_to_veerer_linear_family(orbit_closure): EXAMPLES:: - sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure + sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure # optional - sage_flatsurf sage: from veerer.flatsurf_conversion import sage_flatsurf_orbit_closure_to_veerer_linear_family - sage: P = Polygon(angles=(1,1,1,7), lengths=(3, 2)) - sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() - sage: S2 = S1.l_infinity_delaunay_triangulation() - sage: O = GL2ROrbitClosure(S2) - sage: for d in O.decompositions(4): + sage: P = Polygon(angles=(1,1,1,7), lengths=(3, 2)) # optional - sage_flatsurf + sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() # optional - sage_flatsurf + sage: S2 = S1.l_infinity_delaunay_triangulation() # optional - sage_flatsurf + sage: O = GL2ROrbitClosure(S2) # optional - sage_flatsurf + sage: for d in O.decompositions(4): # optional - sage_flatsurf ....: O.update_tangent_space_from_flow_decomposition(d) ....: if O.dimension() == 4: ....: break - sage: sage_flatsurf_orbit_closure_to_veerer_linear_family(O) + sage: sage_flatsurf_orbit_closure_to_veerer_linear_family(O) # optional - sage_flatsurf VeeringTriangulationLinearFamily("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,~5,13)(14,~6,15)(16,~11,~10)(17,18,~12)(19,~13,20)(~20,~17,~16)(~19,~18,~14)(~15,~7,~9)", "BRRRRRBRBBBRRBRRRBRBR", [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, 0, c0, 2*c0, c0, c0, -c0, c0, c0, 0), (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, c0 - 1, 1, c0, 1, 0, -c0 + 1, 2*c0 - 2, -c0 + 2, -c0 + 1), (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, -1, 1, c0 - 1, c0 - 1), (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, -c0 + 1, c0 - 1, c0 - 1)]) """ vt, x_orientation = pyflatsurf_surface_to_veerer_veering_triangulation(orbit_closure._surface) From e3c1ec0d56fd37c8d960538ada303c24c3f74498 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Thu, 18 Jan 2024 21:59:47 +0100 Subject: [PATCH 03/15] replace tab --- veerer/flatsurf_conversion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/veerer/flatsurf_conversion.py b/veerer/flatsurf_conversion.py index ea42ea8c..8a613779 100644 --- a/veerer/flatsurf_conversion.py +++ b/veerer/flatsurf_conversion.py @@ -166,7 +166,7 @@ def sage_flatsurf_orbit_closure_to_veerer_linear_family(orbit_closure): ....: if O.dimension() == 4: ....: break sage: sage_flatsurf_orbit_closure_to_veerer_linear_family(O) # optional - sage_flatsurf - VeeringTriangulationLinearFamily("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,~5,13)(14,~6,15)(16,~11,~10)(17,18,~12)(19,~13,20)(~20,~17,~16)(~19,~18,~14)(~15,~7,~9)", "BRRRRRBRBBBRRBRRRBRBR", [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, 0, c0, 2*c0, c0, c0, -c0, c0, c0, 0), (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, c0 - 1, 1, c0, 1, 0, -c0 + 1, 2*c0 - 2, -c0 + 2, -c0 + 1), (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, -1, 1, c0 - 1, c0 - 1), (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, -c0 + 1, c0 - 1, c0 - 1)]) + VeeringTriangulationLinearFamily("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,~5,13)(14,~6,15)(16,~11,~10)(17,18,~12)(19,~13,20)(~20,~17,~16)(~19,~18,~14)(~15,~7,~9)", "BRRRRRBRBBBRRBRRRBRBR", [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, 0, c0, 2*c0, c0, c0, -c0, c0, c0, 0), (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, c0 - 1, 1, c0, 1, 0, -c0 + 1, 2*c0 - 2, -c0 + 2, -c0 + 1), (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, -1, 1, c0 - 1, c0 - 1), (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, -c0 + 1, c0 - 1, c0 - 1)]) """ vt, x_orientation = pyflatsurf_surface_to_veerer_veering_triangulation(orbit_closure._surface) From 5613b941936839a1067c2847f66a8349ef1e867d Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Thu, 18 Jan 2024 22:06:54 +0100 Subject: [PATCH 04/15] add pyflatsurf to optional flag --- veerer/flatsurf_conversion.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/veerer/flatsurf_conversion.py b/veerer/flatsurf_conversion.py index 8a613779..224763e7 100644 --- a/veerer/flatsurf_conversion.py +++ b/veerer/flatsurf_conversion.py @@ -155,17 +155,17 @@ def sage_flatsurf_orbit_closure_to_veerer_linear_family(orbit_closure): EXAMPLES:: - sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure # optional - sage_flatsurf + sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure # optional - sage_flatsurf, pyflatsurf sage: from veerer.flatsurf_conversion import sage_flatsurf_orbit_closure_to_veerer_linear_family sage: P = Polygon(angles=(1,1,1,7), lengths=(3, 2)) # optional - sage_flatsurf - sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() # optional - sage_flatsurf - sage: S2 = S1.l_infinity_delaunay_triangulation() # optional - sage_flatsurf - sage: O = GL2ROrbitClosure(S2) # optional - sage_flatsurf - sage: for d in O.decompositions(4): # optional - sage_flatsurf + sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() # optional - sage_flatsurf, pyflatsurf + sage: S2 = S1.l_infinity_delaunay_triangulation() # optional - sage_flatsurf, pyflatsurf + sage: O = GL2ROrbitClosure(S2) # optional - sage_flatsurf, pyflatsurf + sage: for d in O.decompositions(4): # optional - sage_flatsurf, pyflatsurf ....: O.update_tangent_space_from_flow_decomposition(d) ....: if O.dimension() == 4: ....: break - sage: sage_flatsurf_orbit_closure_to_veerer_linear_family(O) # optional - sage_flatsurf + sage: sage_flatsurf_orbit_closure_to_veerer_linear_family(O) # optional - sage_flatsurf, pyflatsurf VeeringTriangulationLinearFamily("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,~5,13)(14,~6,15)(16,~11,~10)(17,18,~12)(19,~13,20)(~20,~17,~16)(~19,~18,~14)(~15,~7,~9)", "BRRRRRBRBBBRRBRRRBRBR", [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, 0, c0, 2*c0, c0, c0, -c0, c0, c0, 0), (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, c0 - 1, 1, c0, 1, 0, -c0 + 1, 2*c0 - 2, -c0 + 2, -c0 + 1), (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, -1, 1, c0 - 1, c0 - 1), (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, -c0 + 1, c0 - 1, c0 - 1)]) """ vt, x_orientation = pyflatsurf_surface_to_veerer_veering_triangulation(orbit_closure._surface) From 2c280f9e646ca3071c23a04f21c68f53b8f6fca5 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Thu, 18 Jan 2024 22:10:13 +0100 Subject: [PATCH 05/15] add pyflatsurf to conda env --- .github/workflows/test.yml | 17 ++++++++++------- environment.yml | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb767ad4..63d36a9e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,25 +13,25 @@ jobs: strategy: matrix: include: - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,surface_dynamicsr" + - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,surface_dynamicsr" sagelib: "9.3" python: "3.9.2" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,surface_dynamics" + - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,surface_dynamics" sagelib: "9.4" python: "3.9.5" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pynormaliz,surface_dynamics" + - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflaturf,pynormaliz,surface_dynamics" sagelib: "9.5" python: "3.9.9" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pynormaliz,surface_dynamics" + - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" sagelib: "9.6" python: "3.10.5" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pynormaliz,surface_dynamics" + - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" sagelib: "9.7" python: "3.10.5" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pynormaliz,surface_dynamics" + - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" sagelib: "9.8" python: "3.10.5" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pynormaliz,surface_dynamics" + - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" sagelib: "10.0" python: "3.10.5" # Test optional dependencies in isolation @@ -53,6 +53,9 @@ jobs: - optionals: "sage,surface_dynamics" sagelib: "10.0" python: "3.10.5" + - optionals: "sage,pyflatsurf" + sagelib: "10.0" + python: "3.10.5" steps: - uses: actions/checkout@v2 with: { submodules: recursive } diff --git a/environment.yml b/environment.yml index 85707990..47502785 100644 --- a/environment.yml +++ b/environment.yml @@ -23,6 +23,7 @@ dependencies: - sage-flatsurf # optional: sage_flatsurf - pyeantic >=1.0.0,<2 # optional: pyeantic - pyintervalxt >=3.1.0,<4 # optional: pyintervalxt + - pyflatsurf # optional: pyflatsurf # Work around https://github.com/conda-forge/pynormaliz-feedstock/issues/10 by pinning normaliz and pynormaliz - pynormaliz 2.17 # optional: pynormaliz - normaliz 3.9.4 # optional: pynormaliz From 1be6043ba11299aa40f8c367c6fc6aac11334966 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Sat, 27 Jan 2024 11:35:57 +0100 Subject: [PATCH 06/15] higher python versions in test environment --- .github/workflows/test.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63d36a9e..0522069b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,47 +15,47 @@ jobs: include: - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,surface_dynamicsr" sagelib: "9.3" - python: "3.9.2" + python: "3.9.15" - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,surface_dynamics" sagelib: "9.4" - python: "3.9.5" + python: "3.9.15" - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflaturf,pynormaliz,surface_dynamics" sagelib: "9.5" - python: "3.9.9" + python: "3.9.15" - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" sagelib: "9.6" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" sagelib: "9.7" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" sagelib: "9.8" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" sagelib: "10.0" - python: "3.10.5" + python: "3.10.8" # Test optional dependencies in isolation - optionals: "sage" sagelib: "10.0" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,sage_flatsurf" sagelib: "10.0" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,pyeantic" sagelib: "10.0" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,pyintervalxt" sagelib: "10.0" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,pynormaliz" sagelib: "10.0" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,surface_dynamics" sagelib: "10.0" - python: "3.10.5" + python: "3.10.8" - optionals: "sage,pyflatsurf" sagelib: "10.0" - python: "3.10.5" + python: "3.10.8" steps: - uses: actions/checkout@v2 with: { submodules: recursive } From b9d75901ce732c0014e1a583fdc2797ce17ea4b9 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Sat, 27 Jan 2024 11:36:13 +0100 Subject: [PATCH 07/15] more constraints in environment.yml --- environment.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/environment.yml b/environment.yml index 47502785..a2cfedbe 100644 --- a/environment.yml +++ b/environment.yml @@ -21,9 +21,9 @@ dependencies: # Work around https://github.com/conda-forge/givaro-feedstock/issues/13 - givaro=4.1.1=h192cbe9_1 - sage-flatsurf # optional: sage_flatsurf - - pyeantic >=1.0.0,<2 # optional: pyeantic - - pyintervalxt >=3.1.0,<4 # optional: pyintervalxt - - pyflatsurf # optional: pyflatsurf + - pyeantic >=1,<2 # optional: pyeantic + - pyintervalxt >=3,<4 # optional: pyintervalxt + - pyflatsurf >=3.10.1,<4 # optional: pyflatsurf # Work around https://github.com/conda-forge/pynormaliz-feedstock/issues/10 by pinning normaliz and pynormaliz - pynormaliz 2.17 # optional: pynormaliz - normaliz 3.9.4 # optional: pynormaliz From 3f52ac71747441d46d599cb3e97772811adadcaf Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Fri, 20 Sep 2024 13:51:17 +0200 Subject: [PATCH 08/15] fix a bug when building surfaces from train track coordinates --- veerer/veering_triangulation.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/veerer/veering_triangulation.py b/veerer/veering_triangulation.py index 694267b0..7e07e7c5 100644 --- a/veerer/veering_triangulation.py +++ b/veerer/veering_triangulation.py @@ -3040,8 +3040,7 @@ def _flat_structure_from_train_track_lengths(self, VH, VV, base_ring=None, mutab from sage.modules.free_module import VectorSpace if base_ring is None: - from sage.rings.rational_field import QQ - base_ring = QQ + base_ring = self.base_ring() assert len(VH) == len(VV) == self.num_edges() assert all(x >=0 for x in VH) @@ -3091,6 +3090,18 @@ def flat_structure_middle(self, backend=None): sage: T.flat_structure_middle() FlatVeeringTriangulation(Triangulation("(0,1,2)"), [(1, 2), (-2, -1), (1, -1)]) + sage: x = polygen(QQ) + sage: K = NumberField(x^2 - x - 1, 'c0', embedding=(1+AA(5).sqrt())/2) + sage: c0 = K.gen() + sage: T = VeeringTriangulation("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,13,~5)(14,15,~6)(16,~11,~10)(17,18,~12)(19,20,~13)(~20,~15,~18)(~19,~16,~17)(~14,~7,~9)", "BRRRRRBRBBBRBRRRRRBBR") + sage: deformations = [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, c0, 0, c0, 2*c0, c0, 0, c0, -c0, c0), + ....: (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, 1, c0 - 1, 1, c0, 0, -c0 + 1, -c0 + 2, -c0 + 1, 2*c0 - 2), + ....: (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, c0 - 1, c0 - 1, -1, 1), + ....: (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, c0 - 1, c0 - 1, -c0 + 1)] + sage: F = VeeringTriangulationLinearFamily(T, deformations) + sage: F.flat_structure_middle() + FlatVeeringTriangulation(Triangulation("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,13,~5)(14,15,~6)(16,~11,~10)(17,18,~12)(19,20,~13)(~20,~15,~18)(~19,~16,~17)(~14,~7,~9)"), [(c0 - 1, -c0 - 2), (c0, 3*c0), ..., (-c0 + 1, c0 + 2)]) + sage: from surface_dynamics import * # optional - surface_dynamics sage: Q = QuadraticStratum({1:4, -1:4}) # optional - surface_dynamics sage: CT = VeeringTriangulation.from_stratum(Q) # optional - surface_dynamics From b9cb38919553ea3a4d773658f538377af5e434bd Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Fri, 20 Sep 2024 13:52:48 +0200 Subject: [PATCH 09/15] sage changed its mind about number field embeddings --- veerer/flatsurf_conversion.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/veerer/flatsurf_conversion.py b/veerer/flatsurf_conversion.py index 224763e7..f33d5fd1 100644 --- a/veerer/flatsurf_conversion.py +++ b/veerer/flatsurf_conversion.py @@ -165,8 +165,11 @@ def sage_flatsurf_orbit_closure_to_veerer_linear_family(orbit_closure): ....: O.update_tangent_space_from_flow_decomposition(d) ....: if O.dimension() == 4: ....: break - sage: sage_flatsurf_orbit_closure_to_veerer_linear_family(O) # optional - sage_flatsurf, pyflatsurf - VeeringTriangulationLinearFamily("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,~5,13)(14,~6,15)(16,~11,~10)(17,18,~12)(19,~13,20)(~20,~17,~16)(~19,~18,~14)(~15,~7,~9)", "BRRRRRBRBBBRRBRRRBRBR", [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, 0, c0, 2*c0, c0, c0, -c0, c0, c0, 0), (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, c0 - 1, 1, c0, 1, 0, -c0 + 1, 2*c0 - 2, -c0 + 2, -c0 + 1), (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, -1, 1, c0 - 1, c0 - 1), (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, -c0 + 1, c0 - 1, c0 - 1)]) + sage: F = sage_flatsurf_orbit_closure_to_veerer_linear_family(O) # optional - sage_flatsurf, pyflatsurf + sage: F.base_ring() # optional - sage_flatsurf, pyflatsurf + Number Field in c0 with defining polynomial x^2 - x - 1 with c0 = 1.618033988749895? + sage: F # optional - sage_flatsurf, pyflatsurf + VeeringTriangulationLinearFamily("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,13,~5)(14,15,~6)(16,~11,~10)(17,18,~12)(19,20,~13)(~20,~15,~18)(~19,~16,~17)(~14,~7,~9)", "BRRRRRBRBBBRBRRRRRBBR", [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, c0, 0, c0, 2*c0, c0, 0, c0, -c0, c0), (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, 1, c0 - 1, 1, c0, 0, -c0 + 1, -c0 + 2, -c0 + 1, 2*c0 - 2), (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, c0 - 1, c0 - 1, -1, 1), (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, c0 - 1, c0 - 1, -c0 + 1)]) """ vt, x_orientation = pyflatsurf_surface_to_veerer_veering_triangulation(orbit_closure._surface) From 626b80114e29d6c59f4fc4db9c9800e376c4d504 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Fri, 20 Sep 2024 14:50:49 +0200 Subject: [PATCH 10/15] use FreeModule rather than VectorSpace --- veerer/veering_triangulation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/veerer/veering_triangulation.py b/veerer/veering_triangulation.py index 7e07e7c5..22ee45d9 100644 --- a/veerer/veering_triangulation.py +++ b/veerer/veering_triangulation.py @@ -3037,7 +3037,7 @@ def _flat_structure_from_train_track_lengths(self, VH, VV, base_ring=None, mutab Return a flat structure from two vectors ``VH`` and ``VV`` satisfying the train track equations. """ - from sage.modules.free_module import VectorSpace + from sage.modules.free_module import FreeModule if base_ring is None: base_ring = self.base_ring() @@ -3049,7 +3049,7 @@ def _flat_structure_from_train_track_lengths(self, VH, VV, base_ring=None, mutab self._set_train_track_constraints(self._tt_check, VH, HORIZONTAL, False, False) self._set_train_track_constraints(self._tt_check, VV, VERTICAL, False, False) - V = VectorSpace(base_ring, 2) + V = FreeModule(base_ring, 2) vectors = [V((x, y if self._colouring[i] == RED else -y)) for \ i,(x,y) in enumerate(zip(VV, VH))] m = self.num_edges() From 134a3c262cec18621986919e39e8092adbd148b3 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Fri, 20 Sep 2024 14:58:39 +0200 Subject: [PATCH 11/15] scaling seems to depend on sage version --- veerer/veering_triangulation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/veerer/veering_triangulation.py b/veerer/veering_triangulation.py index 22ee45d9..66043e59 100644 --- a/veerer/veering_triangulation.py +++ b/veerer/veering_triangulation.py @@ -3100,7 +3100,7 @@ def flat_structure_middle(self, backend=None): ....: (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, c0 - 1, c0 - 1, -c0 + 1)] sage: F = VeeringTriangulationLinearFamily(T, deformations) sage: F.flat_structure_middle() - FlatVeeringTriangulation(Triangulation("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,13,~5)(14,15,~6)(16,~11,~10)(17,18,~12)(19,20,~13)(~20,~15,~18)(~19,~16,~17)(~14,~7,~9)"), [(c0 - 1, -c0 - 2), (c0, 3*c0), ..., (-c0 + 1, c0 + 2)]) + FlatVeeringTriangulation(Triangulation("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,13,~5)(14,15,~6)(16,~11,~10)(17,18,~12)(19,20,~13)(~20,~15,~18)(~19,~16,~17)(~14,~7,~9)"), ...) sage: from surface_dynamics import * # optional - surface_dynamics sage: Q = QuadraticStratum({1:4, -1:4}) # optional - surface_dynamics From 004d6fce6bc3610b1759b57b1e17d8a0d877a975 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Fri, 20 Sep 2024 15:22:06 +0200 Subject: [PATCH 12/15] update tests and examples wrt deprecation warnings in surface-dynamics --- doc/source/veerer_demo.rst | 4 ++-- veerer/automaton.py | 20 +++++++++---------- veerer/veering_quadrangulation.py | 6 +++--- veerer/veering_triangulation.py | 33 +++++++++++++++---------------- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/doc/source/veerer_demo.rst b/doc/source/veerer_demo.rst index 18f284a1..fb8f2d1b 100644 --- a/doc/source/veerer_demo.rst +++ b/doc/source/veerer_demo.rst @@ -142,7 +142,7 @@ train-tracks. :: sage: # constructing veering triangulations from a component stratum - sage: Q = QuadraticStratum(3,3,3,3) # optional - surface_dynamics + sage: Q = Stratum([3,3,3,3], 2) # optional - surface_dynamics sage: Qreg = Q.regular_component() # optional - surface_dynamics sage: Qirr = Q.irregular_component() # optional - surface_dynamics @@ -343,7 +343,7 @@ filtering cylindrical (single test is cheap) ~2 sec for H(4)^hyp :: - sage: H = AbelianStratum(4).hyperelliptic_component() # optional - surface_dynamics + sage: H = Stratum([4], 1).hyperelliptic_component() # optional - surface_dynamics sage: V = VeeringTriangulation.from_stratum(H) # optional - surface_dynamics sage: AV = CoreAutomaton(V) # long time - ~21 secs # optional - surface_dynamics sage: print(AV.num_states()) # long time - ~150 µs # optional - surface_dynamics diff --git a/veerer/automaton.py b/veerer/automaton.py index ba061e36..05c8762b 100644 --- a/veerer/automaton.py +++ b/veerer/automaton.py @@ -67,9 +67,9 @@ class Automaton(object): Exploring strata:: - sage: from surface_dynamics import * # optional - surface_dynamics - sage: strata = [AbelianStratum(2), QuadraticStratum(2,-1,-1), # optional - surface_dynamics - ....: QuadraticStratum(2,2), AbelianStratum(1,1)] + sage: from surface_dynamics import Stratum # optional - surface_dynamics + sage: strata = [Stratum([2], 1), Stratum([2,-1,-1], 2), # optional - surface_dynamics + ....: Stratum([2,2], 2), Stratum([1,1], 1)] sage: for stratum in strata: # optional - surface_dynamics ....: print(stratum) ....: vt = VeeringTriangulation.from_stratum(stratum) @@ -466,13 +466,13 @@ def from_stratum(self, stratum, **kwds): EXAMPLES:: sage: from veerer import * - sage: from surface_dynamics import * # optional - surface_dynamics - sage: CoreAutomaton.from_stratum(AbelianStratum(2)) # optional - surface_dynamics + sage: from surface_dynamics import Stratum # optional - surface_dynamics + sage: CoreAutomaton.from_stratum(Stratum([2], 1)) # optional - surface_dynamics Core veering automaton with 86 vertices - sage: GeometricAutomaton.from_stratum(AbelianStratum(2)) # optional - surface_dynamics + sage: GeometricAutomaton.from_stratum(Stratum([2], 1)) # optional - surface_dynamics Geometric veering automaton with 54 vertices - sage: Q = QuadraticStratum(8) # optional - surface_dynamics + sage: Q = Stratum([8], 2) # optional - surface_dynamics sage: A = CoreAutomaton.from_stratum(Q, max_size=100) # optional - surface_dynamics sage: A # optional - surface_dynamics Partial core veering automaton with 101 vertices @@ -956,11 +956,11 @@ def cylinder_diagrams(self, col=RED): EXAMPLES:: sage: from veerer import RED, BLUE, GeometricAutomaton - sage: from surface_dynamics import AbelianStratum # optional - surface_dynamics - sage: A = GeometricAutomaton.from_stratum(AbelianStratum(2)) # optional - surface_dynamics + sage: from surface_dynamics import Stratum # optional - surface_dynamics + sage: A = GeometricAutomaton.from_stratum(Stratum([2], 1)) # optional - surface_dynamics sage: len(A.cylinder_diagrams(RED)) # optional - surface_dynamics 2 - sage: A = GeometricAutomaton.from_stratum(AbelianStratum(1, 1)) # optional - surface_dynamics + sage: A = GeometricAutomaton.from_stratum(Stratum([1, 1], 1)) # optional - surface_dynamics sage: len(A.cylinder_diagrams(RED)) # optional - surface_dynamics 4 diff --git a/veerer/veering_quadrangulation.py b/veerer/veering_quadrangulation.py index 9aa29085..26ba1fc0 100644 --- a/veerer/veering_quadrangulation.py +++ b/veerer/veering_quadrangulation.py @@ -2011,12 +2011,12 @@ def ferenczi_zamboni_class(k, labelled=False): sage: len(ferenczi_zamboni_class(4, labelled=False)) # optional - surface_dynamics 10 """ - from surface_dynamics import AbelianStratum + from surface_dynamics import Stratum o = one_quadrangulation(k).to_origami() if k % 2: - assert o.stratum_component() == AbelianStratum(k-1).hyperelliptic_component() + assert o.stratum_component() == Stratum([k-1], 1).hyperelliptic_component() elif k != 2: - assert o.stratum_component() == AbelianStratum((k-2)//2, (k-2)//2).hyperelliptic_component() + assert o.stratum_component() == Stratum([(k-2)//2, (k-2)//2], 1).hyperelliptic_component() if not labelled: ocan = o.relabel(inplace=False) diff --git a/veerer/veering_triangulation.py b/veerer/veering_triangulation.py index 66043e59..7c55ea27 100644 --- a/veerer/veering_triangulation.py +++ b/veerer/veering_triangulation.py @@ -65,10 +65,10 @@ class VeeringTriangulation(Triangulation): sage: from surface_dynamics import * # optional - surface_dynamics - sage: VeeringTriangulation.from_stratum(AbelianStratum(2)) # optional - surface_dynamics + sage: VeeringTriangulation.from_stratum(Stratum([2], 1)) # optional - surface_dynamics VeeringTriangulation("(0,6,~5)(1,8,~7)(2,7,~6)(3,~1,~8)(4,~2,~3)(5,~0,~4)", "RRRBBBBBB") - sage: vt = VeeringTriangulation.from_stratum(QuadraticStratum({1:4})) # optional - surface_dynamics + sage: vt = VeeringTriangulation.from_stratum(Stratum({1:4}, 2)) # optional - surface_dynamics sage: vt.stratum() # optional - surface_dynamics Q_2(1^4) @@ -488,13 +488,13 @@ def from_stratum(cls, c, folded_edges=False, mutable=False, check=True): sage: from surface_dynamics import * # optional - surface_dynamics sage: from veerer import * - sage: T = VeeringTriangulation.from_stratum(AbelianStratum(2)) # optional - surface_dynamics + sage: T = VeeringTriangulation.from_stratum(Stratum([2], 1)) # optional - surface_dynamics sage: T # optional - surface_dynamics VeeringTriangulation("(0,6,~5)(1,8,~7)(2,7,~6)(3,~1,~8)(4,~2,~3)(5,~0,~4)", "RRRBBBBBB") sage: T.stratum() # optional - surface_dynamics H_2(2) - sage: Q = QuadraticStratum(9,-1) # optional - surface_dynamics + sage: Q = Stratum([9,-1], 2) # optional - surface_dynamics sage: CTreg = VeeringTriangulation.from_stratum(Q.regular_component()) # optional - surface_dynamics sage: CTreg.stratum() # optional - surface_dynamics @@ -1080,14 +1080,14 @@ def stratum(self): Some examples with purple edges:: - sage: from surface_dynamics import AbelianStratum, QuadraticStratum # optional - surface_dynamics - sage: C = AbelianStratum(2) # optional - surface_dynamics - sage: t = VeeringTriangulation.from_stratum(C, mutable=True) # optional - surface_dynamics - sage: t.forgot_forward_flippable_colour() # optional - surface_dynamics - sage: t.stratum() # optional - surface_dynamics + sage: from surface_dynamics import Stratum # optional - surface_dynamics + sage: C = Stratum([2], 1) # optional - surface_dynamics + sage: t = VeeringTriangulation.from_stratum(C, mutable=True) # optional - surface_dynamics + sage: t.forgot_forward_flippable_colour() # optional - surface_dynamics + sage: t.stratum() # optional - surface_dynamics H_2(2) - sage: C = QuadraticStratum(1,1,1,1) # optional - surface_dynamics + sage: C = Stratum([1,1,1,1], 2) # optional - surface_dynamics sage: t = VeeringTriangulation.from_stratum(C, mutable=True) # optional - surface_dynamics sage: t.forgot_forward_flippable_colour() # optional - surface_dynamics sage: t.stratum() # optional - surface_dynamics @@ -1095,14 +1095,13 @@ def stratum(self): """ from .features import surface_dynamics_feature surface_dynamics_feature.require() + from surface_dynamics import Stratum A = self.angles() if any(a%2 for a in A) or not self.is_abelian(): - from surface_dynamics import QuadraticStratum - return QuadraticStratum([(a-2) for a in A]) + return Stratum([(a - 2) for a in A], 2) else: - from surface_dynamics import AbelianStratum - return AbelianStratum([(a-2)/2 for a in A]) + return Stratum([(a - 2) // 2 for a in A], 1) def dimension(self): r""" @@ -1798,7 +1797,7 @@ def to_string(self): 'RRB_120_012' sage: from surface_dynamics import * # optional - surface_dynamics - sage: T = VeeringTriangulation.from_stratum(QuadraticStratum({1:20})) # optional - surface_dynamics + sage: T = VeeringTriangulation.from_stratum(Stratum({1:20}, 2)) # optional - surface_dynamics sage: s = T.to_string() # optional - surface_dynamics sage: TT = VeeringTriangulation.from_string(s) # optional - surface_dynamics sage: T == TT # optional - surface_dynamics @@ -3103,7 +3102,7 @@ def flat_structure_middle(self, backend=None): FlatVeeringTriangulation(Triangulation("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,13,~5)(14,15,~6)(16,~11,~10)(17,18,~12)(19,20,~13)(~20,~15,~18)(~19,~16,~17)(~14,~7,~9)"), ...) sage: from surface_dynamics import * # optional - surface_dynamics - sage: Q = QuadraticStratum({1:4, -1:4}) # optional - surface_dynamics + sage: Q = Stratum({1:4, -1:4}, 2) # optional - surface_dynamics sage: CT = VeeringTriangulation.from_stratum(Q) # optional - surface_dynamics sage: CT.flat_structure_middle() # optional - surface_dynamics FlatVeeringTriangulation(Triangulation("(0,18,~17)(1,20,~19)...(19,~18,~0)"), [(3, 3), (1, 1), ..., (-3, -3)]) @@ -3138,7 +3137,7 @@ def flat_structure_min(self, allow_degenerations=False): sage: from veerer import * sage: from surface_dynamics import * # optional - surface_dynamics - sage: Q = QuadraticStratum({1:4, -1:4}) # optional - surface_dynamics + sage: Q = Stratum({1:4, -1:4}, 2) # optional - surface_dynamics sage: CT = VeeringTriangulation.from_stratum(Q) # optional - surface_dynamics sage: CT.flat_structure_min() # optional - surface_dynamics FlatVeeringTriangulation(Triangulation("(0,18,~17)(1,20,~19)...(19,~18,~0)"), [(3, 3), (1, 1), ..., (-3, -3)]) From bcf51dc2d6cb7fcfbd7959caed7a217f69db10e8 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Fri, 20 Sep 2024 15:45:01 +0200 Subject: [PATCH 13/15] add pyflatsurf feature and fix optional doctest tag syntax --- veerer/features.py | 5 ++++- veerer/flatsurf_conversion.py | 23 ++++++++++++++--------- veerer/tatami_decomposition.py | 10 +++++----- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/veerer/features.py b/veerer/features.py index 9e094102..11d3e512 100644 --- a/veerer/features.py +++ b/veerer/features.py @@ -4,7 +4,7 @@ from sage.features import PythonModule -flatsurf_feature = PythonModule( +sage_flatsurf_feature = PythonModule( "flatsurf", url="https://flatsurf.github.io/sage-flatsurf/#installation" ) surface_dynamics_feature = PythonModule( @@ -16,6 +16,9 @@ curver_feature = PythonModule( "curver", url="https://curver.readthedocs.io/en/master/user/install.html" ) +pyflatsurf_feature = PythonModule( + "pyflatsurf", url="https://github.com/flatsurf/flatsurf" +) pynormaliz_feature = PythonModule( "PyNormaliz", url="https://github.com/Normaliz/PyNormaliz" ) diff --git a/veerer/flatsurf_conversion.py b/veerer/flatsurf_conversion.py index f33d5fd1..c9c26edb 100644 --- a/veerer/flatsurf_conversion.py +++ b/veerer/flatsurf_conversion.py @@ -6,6 +6,7 @@ from sage.matrix.constructor import matrix +from .features import sage_flatsurf_feature, pyflatsurf_feature from .triangulation import Triangulation from .veering_triangulation import VeeringTriangulation from .linear_family import VeeringTriangulationLinearFamily @@ -105,6 +106,8 @@ def pyflatsurf_surface_to_veerer_veering_triangulation(surface): Note that the flatstructure is lost in the process. """ + pyflatsurf_feature.require() + faces = surface.faces() n = 3 * faces.size() ep = array('i', [n - i - 1 for i in range(n)]) @@ -155,22 +158,24 @@ def sage_flatsurf_orbit_closure_to_veerer_linear_family(orbit_closure): EXAMPLES:: - sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure # optional - sage_flatsurf, pyflatsurf + sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure # optional - sage_flatsurf pyflatsurf sage: from veerer.flatsurf_conversion import sage_flatsurf_orbit_closure_to_veerer_linear_family - sage: P = Polygon(angles=(1,1,1,7), lengths=(3, 2)) # optional - sage_flatsurf - sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() # optional - sage_flatsurf, pyflatsurf - sage: S2 = S1.l_infinity_delaunay_triangulation() # optional - sage_flatsurf, pyflatsurf - sage: O = GL2ROrbitClosure(S2) # optional - sage_flatsurf, pyflatsurf - sage: for d in O.decompositions(4): # optional - sage_flatsurf, pyflatsurf + sage: P = Polygon(angles=(1,1,1,7), lengths=(3, 2)) # optional - sage_flatsurf pyflatsurf + sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() # optional - sage_flatsurf pyflatsurf + sage: S2 = S1.l_infinity_delaunay_triangulation() # optional - sage_flatsurf pyflatsurf + sage: O = GL2ROrbitClosure(S2) # optional - sage_flatsurf pyflatsurf + sage: for d in O.decompositions(4): # optional - sage_flatsurf pyflatsurf ....: O.update_tangent_space_from_flow_decomposition(d) ....: if O.dimension() == 4: ....: break - sage: F = sage_flatsurf_orbit_closure_to_veerer_linear_family(O) # optional - sage_flatsurf, pyflatsurf - sage: F.base_ring() # optional - sage_flatsurf, pyflatsurf + sage: F = sage_flatsurf_orbit_closure_to_veerer_linear_family(O) # optional - sage_flatsurf pyflatsurf + sage: F.base_ring() # optional - sage_flatsurf pyflatsurf Number Field in c0 with defining polynomial x^2 - x - 1 with c0 = 1.618033988749895? - sage: F # optional - sage_flatsurf, pyflatsurf + sage: F # optional - sage_flatsurf pyflatsurf VeeringTriangulationLinearFamily("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,13,~5)(14,15,~6)(16,~11,~10)(17,18,~12)(19,20,~13)(~20,~15,~18)(~19,~16,~17)(~14,~7,~9)", "BRRRRRBRBBBRBRRRRRBBR", [(1, 0, 1, 0, 1, c0, c0, 0, -1, -c0, -c0, 0, c0, 0, c0, 2*c0, c0, 0, c0, -c0, c0), (0, 1, 1, 0, 0, c0, c0 - 1, 0, -1, -1, -1, -1, 1, c0 - 1, 1, c0, 0, -c0 + 1, -c0 + 2, -c0 + 1, 2*c0 - 2), (0, 0, 0, 1, 1, 0, 0, 0, 0, -c0, -c0 + 1, 1, 0, 0, c0, c0, c0, c0 - 1, c0 - 1, -1, 1), (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, c0 - 1, c0 - 1, c0 - 1, -c0 + 1)]) """ + sage_flatsurf_feature.require() + vt, x_orientation = pyflatsurf_surface_to_veerer_veering_triangulation(orbit_closure._surface) # build generators for the tangent space diff --git a/veerer/tatami_decomposition.py b/veerer/tatami_decomposition.py index dd8104b9..97873c0b 100644 --- a/veerer/tatami_decomposition.py +++ b/veerer/tatami_decomposition.py @@ -55,21 +55,21 @@ def tatami_decomposition(rectangles, base_ring=None): sage: from veerer.constants import LEFT, RIGHT sage: r0 = ((1, RIGHT, 1), (1, RIGHT, 0), (0, LEFT, 0), (0, LEFT, 1), (3, RIGHT, 2), (3, RIGHT, 1), (0, RIGHT, 2), (0, RIGHT, 1)) sage: r1 = ((3, LEFT, 0), (3, LEFT, 2), (0, LEFT, 1), (0, LEFT, 2), (3, RIGHT, 1), (1, LEFT, 1), (0, RIGHT, 1), (0, RIGHT, 0)) - sage: tatami_decomposition([r0, r1]) # optional: sage_flatsurf + sage: tatami_decomposition([r0, r1]) # optional - sage_flatsurf Translation Surface built from a square and a rectangle TESTS:: - sage: tatami_decomposition([r0, r1], ZZ) # optional: sage_flatsurf + sage: tatami_decomposition([r0, r1], ZZ) # optional - sage_flatsurf Translation Surface built from a square and a rectangle - sage: tatami_decomposition([r0, r1], QQ) # optional: sage_flatsurf + sage: tatami_decomposition([r0, r1], QQ) # optional - sage_flatsurf Translation Surface built from a square and a rectangle - sage: tatami_decomposition([r0, r1], AA) # optional: sage_flatsurf + sage: tatami_decomposition([r0, r1], AA) # optional - sage_flatsurf Translation Surface built from a square and a rectangle sage: r0 = ((1, RIGHT, AA(1)), (1, RIGHT, 0), (0, LEFT, 0), (0, LEFT, 1), (3, RIGHT, 2), (3, RIGHT, 1), (0, RIGHT, 2), (0, RIGHT, 1)) sage: r1 = ((3, LEFT, 0), (3, LEFT, 2), (0, LEFT, 1), (0, LEFT, 2), (3, RIGHT, 1), (1, LEFT, 1), (0, RIGHT, 1), (0, RIGHT, 0)) - sage: tatami_decomposition([r0, r1]) # optional: sage_flatsurf + sage: tatami_decomposition([r0, r1]) # optional - sage_flatsurf Translation Surface built from a square and a rectangle """ if base_ring is None: From 37711e541f9f33768f0224abb6f77c9633c91c9a Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Fri, 20 Sep 2024 16:18:14 +0200 Subject: [PATCH 14/15] add another test --- veerer/flatsurf_conversion.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/veerer/flatsurf_conversion.py b/veerer/flatsurf_conversion.py index c9c26edb..ca2267ba 100644 --- a/veerer/flatsurf_conversion.py +++ b/veerer/flatsurf_conversion.py @@ -105,6 +105,20 @@ def pyflatsurf_surface_to_veerer_veering_triangulation(surface): Convert a pyflatsurf surface in a veering triangulation. Note that the flatstructure is lost in the process. + + EXAMPLES:: + + sage: from veerer.flatsurf_conversion import pyflatsurf_surface_to_veerer_veering_triangulation + + sage: from flatsurf import Polygon, similarity_surfaces # optional - sage_flatsurf pyflatsurf + sage: P = Polygon(angles=(1,1,1,7), lengths=(3, 2)) # optional - sage_flatsurf pyflatsurf + sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() # optional - sage_flatsurf pyflatsurf + sage: S2 = S1.l_infinity_delaunay_triangulation() # optional - sage_flatsurf pyflatsurf + sage: S2.is_veering_triangulated() # optional - sage_flatsurf pyflatsurf + True + sage: S3 = S2.pyflatsurf().codomain().flat_triangulation() # optional - sage_flatsurf pyflatsurf + sage: pyflatsurf_surface_to_veerer_veering_triangulation(S3) # optional - sage_flatsurf pyflatsurf + (VeeringTriangulation("(0,1,2)(3,4,~0)(5,6,~1)(7,8,~2)(9,~3,10)(11,~8,~4)(12,13,~5)(14,15,~6)(16,~11,~10)(17,18,~12)(19,20,~13)(~20,~15,~18)(~19,~16,~17)(~14,~7,~9)", "BRRRRRBRBBBRBRRRRRBBR"), [-1, -1, 1, 1, ..., -1, 1, 1]) """ pyflatsurf_feature.require() @@ -158,8 +172,9 @@ def sage_flatsurf_orbit_closure_to_veerer_linear_family(orbit_closure): EXAMPLES:: - sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure # optional - sage_flatsurf pyflatsurf sage: from veerer.flatsurf_conversion import sage_flatsurf_orbit_closure_to_veerer_linear_family + + sage: from flatsurf import Polygon, similarity_surfaces, GL2ROrbitClosure # optional - sage_flatsurf pyflatsurf sage: P = Polygon(angles=(1,1,1,7), lengths=(3, 2)) # optional - sage_flatsurf pyflatsurf sage: S1 = similarity_surfaces.billiard(P).minimal_cover("translation").erase_marked_points() # optional - sage_flatsurf pyflatsurf sage: S2 = S1.l_infinity_delaunay_triangulation() # optional - sage_flatsurf pyflatsurf From 2221e1413287db4c5c6e097160ac60eb8b486700 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Fri, 20 Sep 2024 16:26:10 +0200 Subject: [PATCH 15/15] drop older sage versions and use newer ones --- .github/workflows/test.yml | 50 +++++++++++++++----------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0522069b..963a3462 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,49 +13,37 @@ jobs: strategy: matrix: include: - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,surface_dynamicsr" + - optionals: "sage" sagelib: "9.3" python: "3.9.15" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,surface_dynamics" - sagelib: "9.4" - python: "3.9.15" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflaturf,pynormaliz,surface_dynamics" - sagelib: "9.5" - python: "3.9.15" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" - sagelib: "9.6" - python: "3.10.8" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" - sagelib: "9.7" - python: "3.10.8" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" - sagelib: "9.8" - python: "3.10.8" - - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" + - optionals: "sage" sagelib: "10.0" python: "3.10.8" + - optionals: "sage,sage_flatsurf,pyeantic,pyintervalxt,pyflatsurf,pynormaliz,surface_dynamics" + sagelib: "10.4" + python: "3.12.15" # Test optional dependencies in isolation - optionals: "sage" - sagelib: "10.0" - python: "3.10.8" + sagelib: "10.4" + python: "3.12.15" - optionals: "sage,sage_flatsurf" - sagelib: "10.0" - python: "3.10.8" + sagelib: "10.4" + python: "3.12.15" - optionals: "sage,pyeantic" - sagelib: "10.0" - python: "3.10.8" + sagelib: "10.4" + python: "3.12.15" - optionals: "sage,pyintervalxt" - sagelib: "10.0" - python: "3.10.8" + sagelib: "10.4" + python: "3.12.15" - optionals: "sage,pynormaliz" - sagelib: "10.0" - python: "3.10.8" + sagelib: "10.4" + python: "3.12.15" - optionals: "sage,surface_dynamics" - sagelib: "10.0" - python: "3.10.8" + sagelib: "10.4" + python: "3.12.15" - optionals: "sage,pyflatsurf" - sagelib: "10.0" - python: "3.10.8" + sagelib: "10.4" + python: "3.12.15" steps: - uses: actions/checkout@v2 with: { submodules: recursive }