Skip to content

Commit 07e5345

Browse files
committed
Calling tidy_peripheral_curves fix in _two_to_three and _three_to_two.
This fixes a bug that Neil Hoffman reported a sequence of M._two_to_three() and M._three_to_two() moves that make M.solution_type() == 'all tetrahedra positively oriented' for M=Manifold("m007(3,1)") because we pick up loops in peripheral curves. These loops don't change the curves homologically but changes the M.gluing_equations().
1 parent 4d1a96f commit 07e5345

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/snappy/extensions/SnapPy/cython_src/SnapPy.pxi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ cdef extern from "kernel_prototypes.h":
622622
int f, int *num_tetrahedra_ptr)
623623
extern c_FuncResult three_to_two(EdgeClass *edge,
624624
EdgeClass **where_to_resume, int *num_tetrahedra_ptr)
625+
extern void tidy_peripheral_curves(c_Triangulation *manifold)
625626
extern void polish_hyperbolic_structures(c_Triangulation *manifold)
626627
extern void compute_holonomies(c_Triangulation *manifold)
627628
extern void compute_edge_angle_sums(c_Triangulation *manifold)

src/snappy/extensions/SnapPy/cython_src/core/triangulation.pyx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,12 @@ cdef class Triangulation():
556556
557557
If the face is not adjacent to two distinct tetrahedra, this
558558
function does nothing and returns a non-zero value.
559+
560+
>>> M = Manifold("m007(3,1)")
561+
>>> M._two_to_three(0,0) # Should succeed and return 0
562+
0
563+
>>> list(M.gluing_equations()[4]) # Test tidy_peripheral_curves is called
564+
[3, -1, -3, -1, -3, 0, 0, -2, -3, 0, -1, 0]
559565
"""
560566

561567
cdef c_FuncResult result
@@ -575,6 +581,7 @@ cdef class Triangulation():
575581
result = two_to_three(tet, f, &self.c_triangulation.num_tetrahedra)
576582

577583
if result == func_OK:
584+
tidy_peripheral_curves(self.c_triangulation)
578585
self._cache.clear(message = '2-3 move')
579586
self._polish_hyperbolic_structures()
580587

@@ -602,12 +609,19 @@ cdef class Triangulation():
602609
\ | /
603610
\|/
604611
0
612+
613+
>>> M = Manifold("eLPkbcddddgors_Bbba(3,1)")
614+
>>> M._three_to_two(0,0) # Should succeed and return 0
615+
0
616+
>>> list(M.gluing_equations()[3]) # Test tidy_peripheral_curves is called
617+
[4, 0, 4, -1, -3, -3, -1, 1, 3]
605618
"""
619+
606620
cdef c_FuncResult result
607621
cdef c_Tetrahedron* tet
608622
cdef EdgeClass* where_to_resume
609623

610-
_ = valid_index(
624+
n = valid_index(
611625
tet_num, self.num_tetrahedra(),
612626
"The specified tetrahedron (%s) does not exist.")
613627

@@ -616,7 +630,7 @@ cdef class Triangulation():
616630
"The specified edge index (%s) is invalid.")
617631

618632
tet = self.c_triangulation.tet_list_begin.next
619-
for i in range(tet_num):
633+
for i in range(n):
620634
tet = tet.next
621635

622636
if tet.edge_class[e].order != 3:
@@ -626,6 +640,7 @@ cdef class Triangulation():
626640
&self.c_triangulation.num_tetrahedra)
627641

628642
if result == func_OK:
643+
tidy_peripheral_curves(self.c_triangulation)
629644
self._cache.clear(message = '3-2 move')
630645
self._polish_hyperbolic_structures()
631646

0 commit comments

Comments
 (0)