Skip to content

Commit

Permalink
Merge pull request #49 from videlec/triangulations-with-boundaries
Browse files Browse the repository at this point in the history
Triangulation with boundary (meromorphic differentials)
  • Loading branch information
videlec authored Nov 4, 2024
2 parents 05dbc19 + c32885c commit 7f288d0
Show file tree
Hide file tree
Showing 22 changed files with 5,911 additions and 2,470 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
strategy:
matrix:
include:
- optionals: "sage"
sagelib: "9.3"
python: "3.9"
- optionals: "sage"
sagelib: "10.0"
python: "3.10"
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ferenczi_zamboni.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The smallest dilatation is the golden rotation::
sage: SS.flip(0)
sage: SS.flip(2)
sage: SS.relabel("(0,2,1)")
sage: SS.xy_scaling(a, 1/a)
sage: SS.xy_scaling(-a, -1/a)
sage: SS == S
True

Expand Down
44 changes: 30 additions & 14 deletions doc/source/veerer_demo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Core vs not core

sage: FS = S.flat_structure_min()
sage: FS.plot()
Graphics object consisting of 37 graphics primitives
Graphics object consisting of ... graphics primitives

::

Expand Down Expand Up @@ -247,17 +247,17 @@ some flat structure
::

sage: # triangulation of some flat structure
sage: T0.is_geometric()
sage: T0.is_delaunay()
True

The geometric polytope that parametrizes the geometric vectors is a sub-polytope
of the product of the two train-track polytopes.

::

sage: print(T1.is_geometric())
sage: print(T1.is_delaunay())
True
sage: print(T1.geometric_polytope())
sage: print(T1.delaunay_cone())
Cone of dimension 8 in ambient dimension 18 made of 13 facets (backend=ppl)

Core automaton
Expand All @@ -272,40 +272,52 @@ from `T_i` by a flip.

sage: # T0 was the torus example
sage: from veerer import CoreAutomaton
sage: A0 = CoreAutomaton(T0)
sage: A0 = CoreAutomaton()
sage: A0.add_seed(T0)
1
sage: A0.run()
0
sage: A0
Core veering automaton with 2 vertices

::

sage: print(A0.num_states(), A0.num_transitions())
2 4
sage: print(sum(vt.is_geometric() for vt in A0))
sage: print(sum(vt.is_delaunay() for vt in A0))
2
sage: print(sum(vt.is_cylindrical() for vt in A0))
2

::

sage: # T1 was the genus 2 example in H(2)
sage: A1 = CoreAutomaton(T1)
sage: A1 = CoreAutomaton()
sage: A1.add_seed(T1)
1
sage: A1.run()
0

::

sage: print(A1.num_states(), A1.num_transitions())
86 300
sage: print(sum(vt.is_geometric() for vt in A1))
sage: print(sum(vt.is_delaunay() for vt in A1))
54
sage: print(sum(vt.is_cylindrical() for vt in A1))
24

::

sage: # T2 was the genus 1 example in Q(1^2, -1^2)
sage: A2 = CoreAutomaton(T2)
sage: A2 = CoreAutomaton()
sage: A2.add_seed(T2)
1
sage: A2.run()
0
sage: print(A2.num_states(), A2.num_transitions())
1074 3620
sage: print(sum(vt.is_geometric() for vt in A2))
sage: print(sum(vt.is_delaunay() for vt in A2))
270
sage: print(sum(vt.is_cylindrical() for vt in A2))
196
Expand Down Expand Up @@ -343,12 +355,16 @@ filtering cylindrical (single test is cheap) ~2 sec for H(4)^hyp

::

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: H = Stratum([4], 1).hyperelliptic_component() # optional - surface_dynamics
sage: V = VeeringTriangulation.from_stratum(H) # optional - surface_dynamics
sage: AV = CoreAutomaton()
sage: AV.add_seed(V) # optional - surface_dynamics
1
sage: AV.run() # long time - ~21 secs # optional - surface_dynamics
0
sage: print(AV.num_states()) # long time - ~150 µs # optional - surface_dynamics
9116
sage: sum(v.is_geometric() for v in AV) # long time - ~21 secs # optional - surface_dynamics
sage: sum(v.is_delaunay() for v in AV) # long time - ~21 secs # optional - surface_dynamics
2916
sage: sum(v.is_cylindrical() for v in AV) # long time - ~1.5 secs # optional - surface_dynamics
636
Expand Down
20 changes: 14 additions & 6 deletions tests/test_automaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import pytest

from veerer import VeeringTriangulation, CoreAutomaton, ReducedCoreAutomaton, GeometricAutomaton
from veerer import VeeringTriangulation, CoreAutomaton, ReducedCoreAutomaton, DelaunayAutomaton

@pytest.mark.parametrize("fp, cols",
[("(0,2,~1)(1,~0,~2)", "RBB"),
Expand All @@ -30,10 +30,15 @@
("(0,~9,8)(1,10,~2)(2,~6,~3)(3,5,~4)(4,9,~5)(6,11,~7)(7,~10,~8)(~11,~1,~0)", "RBBBBRRBBBRB")])
def test_automata(fp, cols):
V = VeeringTriangulation(fp, cols)
assert V.is_geometric()
C = CoreAutomaton(V)
assert V.is_delaunay()
C = CoreAutomaton()
C.add_seed(V)
C.run()

R = ReducedCoreAutomaton()
R.add_seed(V)
R.run()

R = ReducedCoreAutomaton(V)
assert len(R) <= len(C)
reduced = set()
for x in C:
Expand All @@ -44,6 +49,9 @@ def test_automata(fp, cols):
reduced.add(x)
assert set(R) == reduced

G = GeometricAutomaton(V)
G = DelaunayAutomaton()
G.add_seed(V)
G.run()

assert len(G) <= len(C)
assert set(G) == set(x for x in C if x.is_geometric())
assert set(G) == set(x for x in C if x.is_delaunay())
57 changes: 57 additions & 0 deletions tests/test_canonical_labels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
######################################################################
# This file is part of veerer.
#
# Copyright (C) 2024 Vincent Delecroix
#
# veerer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# veerer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with veerer. If not, see <https://www.gnu.org/licenses/>.
######################################################################

import pytest

from veerer.permutation import perm_init, perm_random, perm_random_centralizer
from veerer.triangulation import Triangulation
from veerer.strebel_graph import StrebelGraph
from veerer.veering_triangulation import VeeringTriangulation
from veerer.linear_family import VeeringTriangulationLinearFamily, StrebelGraphLinearFamily

@pytest.mark.parametrize("C", [
Triangulation("(0,1,2)(~2,~0,~1)"),
Triangulation("(0,~1,2)(~0,1,~3)(4,~5,3)(~4,6,~2)(7,~6,8)(~7,5,~9)(10,~11,9)(~10,11,~8)"),
Triangulation("(0,10,~9)(1,~8,9)(2,~6,7)(3,~4,5)(4,~3,~11)(6,~2,~5)(8,~1,~7)(11,~10,~0)"),
Triangulation("(0,1,2)", boundary="(~2:1)(~1:1)(~0:1)"),
Triangulation("(0,2,1)(3,~1,~0)", boundary="(~3:1,~2:1)"),
VeeringTriangulation("(0,1,2)(~2,~0,~1)", "RRB"),
VeeringTriangulation("(0,~6,~3)(1,7,~2)(2,~1,~0)(3,5,~4)(4,8,~5)(6,~8,~7)", "RBPBRBPRB"),
VeeringTriangulation("(0,~1,2)(~0,1,~3)(4,~5,3)(~4,6,~2)(7,~6,8)(~7,5,~9)(10,~11,9)(~10,11,~8)", "BRBBBRRBBBBR"),
VeeringTriangulation("(0,1,2)(3,4,~0)", boundary="(~4:1)(~3:1)(~2:1)(~1:1)", colouring="RBRBR"),
StrebelGraph("(0,1,2)(~0,~1:1,~2:2)"),
StrebelGraph("(0,~1,2)(~0,1,~3)(4,~5,3)(~4,6,~2)(7,~6,8)(~7,5,~9)(10,~11,9)(~10,11,~8)"),
VeeringTriangulationLinearFamily("(0,1,2)(~2,~0,~1)", "RRB", [(1, 0, -1), (0, 1, 1)]),
VeeringTriangulationLinearFamily("(0,1,2)(3,4,5)(~5,~3,~1)(~4,~2,~0)", "BRRBRR", [(1, 0, 1, 0, 0, 0), (0, 1, 1, 0, 1, 1), (0, 0, 0, 1, 0, 1)]),
StrebelGraphLinearFamily("(0,1,2)(~2:2,~0,~1:1)", [(1, 0, 1), (0, 1, -1)])
])
def test_canonical_labels(C):
C = C.copy(mutable=True)
C.set_canonical_labels()
C.set_immutable()
D = C.copy(mutable=True)
for _ in range(20):
p = perm_random_centralizer(C.edge_permutation(copy=False))
D.relabel(p)
D.set_canonical_labels()
assert C == D

if __name__ == '__main__':
import sys
sys.exit(pytest.main(sys.argv))
52 changes: 0 additions & 52 deletions tests/test_geometric_polytope.py

This file was deleted.

5 changes: 3 additions & 2 deletions veerer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
from .triangulation import Triangulation
from .cover import TriangulationCover
from .veering_triangulation import VeeringTriangulation, VeeringTriangulations
from .linear_family import VeeringTriangulationLinearFamily
from .automaton import FlipGraph, CoreAutomaton, ReducedCoreAutomaton, GeometricAutomaton, GeometricAutomatonSubspace
from .linear_family import VeeringTriangulationLinearFamily, StrebelGraphLinearFamily
from .strebel_graph import StrebelGraph
from .automaton import FlipGraph, CoreAutomaton, ReducedCoreAutomaton, DelaunayAutomaton, DelaunayStrebelAutomaton
from .flip_sequence import VeeringFlipSequence
from .flat_structure import FlatVeeringTriangulation
from .layout import FlatVeeringTriangulationLayout
Expand Down
Loading

0 comments on commit 7f288d0

Please sign in to comment.