Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions surface_dynamics/flat_surfaces/homology.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,20 +1080,19 @@ def cycle_basis(self, intersection=False, verbose=False):
return cycles, m
return cycles

def is_cycle(self,c):
def is_cycle(self, c) -> bool:
r"""
Test whether ``c`` is a cycle.

A *path* is a sequence of oriented edges such that each edge starts
where the preceding one ends. A *cycle* is a path which starts where it
ends.
"""
for i in range(len(c)-1):
if self.dart_to_vertex(c[i][1]) != self.dart_to_vertex(c[i+1][0]):
for i in range(len(c) - 1):
if self.dart_to_vertex(c[i][1]) != self.dart_to_vertex(c[i + 1][0]):
return False
if self.dart_to_vertex(c[-1][1]) != self.dart_to_vertex(c[0][0]):
return False
return True
return self.dart_to_vertex(c[-1][1]) == self.dart_to_vertex(c[0][0])


class RibbonGraphWithAngles(RibbonGraph):
r"""
Expand Down
22 changes: 13 additions & 9 deletions surface_dynamics/flat_surfaces/separatrix_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -3137,23 +3137,27 @@ def is_hyperelliptic(self,verbose=False):
for cy in self.cylinders():
for k in cy[0]:
# check that p(k) is on the top of the cyl that has k on its bottom
if p[k] not in cy[1]: return False
if p[k] not in cy[1]:
return False
# check that if k is on bot and top of cyl, then p(k) = k
if k in cy[1]:
if k != p[k]: return False
if k != p[k]:
return False
wsep += 1
if verbose: print("wsep", wsep)
# check number of w pts
if wsep + 2*self.ncyls() != z[0] + 3: return False
# check that cylinders are stable under involution
if self != CylinderDiagram(
[(cy[0],tuple(map(lambda x: p[x],cy[0]))) for cy in self.cylinders()]):
if wsep + 2*self.ncyls() != z[0] + 3:
return False
return True
# check that cylinders are stable under involution
return self == CylinderDiagram(
[(cy[0], tuple(map(lambda x: p[x], cy[0])))
for cy in self.cylinders()])
elif len(z) == 2: # should be stratum H(g-1,g-1)
if z[0] != z[1]: return False
if z[0] != z[1]:
return False
for cy in self.cylinders():
if len(cy[0]) != len(cy[1]): return False
if len(cy[0]) != len(cy[1]):
return False
b = self.bot()
t = self.top()
# build list of seps in cyclic order around first zero, starting by outgoing sep 0
Expand Down
24 changes: 11 additions & 13 deletions surface_dynamics/interval_exchanges/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3594,31 +3594,29 @@ def has_rauzy_move(self, winner, side='right'):
return False

# winner or loser letter is repeated on the other interval (True)
if self._twin[0][-1][0] == 1: return True
if self._twin[1][-1][0] == 0: return True
if self._twin[0][-1][0] == 1:
return True
if self._twin[1][-1][0] == 0:
return True

# the loser letter is the only letter repeated in
# the loser interval (False)
if [i for i,_ in self._twin[loser]].count(loser) == 2:
return False

return True
return [i for i,_ in self._twin[loser]].count(loser) != 2

elif side == 0:
# the same letter at the left-end (False)
if (self._twin[0][0] == (1,0)):
if self._twin[0][0] == (1, 0):
return False

# winner or loser repeated on the other interval (True)
if self._twin[0][0][0] == 1: return True
if self._twin[1][0][0] == 0: return True
if self._twin[0][0][0] == 1:
return True
if self._twin[1][0][0] == 0:
return True

# the loser letter is the only letter repeated in
# the loser interval (False)
if [i for i,_ in self._twin[loser]].count(loser) == 2:
return False

return True
return [i for i,_ in self._twin[loser]].count(loser) != 2

def orientation_cover(self):
r"""
Expand Down