Skip to content

Commit

Permalink
Move zeta.py:glue() into plmaps.util
Browse files Browse the repository at this point in the history
  • Loading branch information
DMRobertson committed Sep 5, 2017
1 parent b6b7615 commit 193af24
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
12 changes: 1 addition & 11 deletions plmaps/scripts/zeta.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from thompson import *
from plmaps import *
from plmaps.debug import debug; debug()
from plmaps.util import dump, pairwise
from plmaps.util import dump, pairwise, glue

#1. Load the definition of delta
x0 = PL2.from_aut(standard_generator(0))
Expand All @@ -23,16 +23,6 @@ def Sigma(s):

assert (rot * rot).is_identity()

def glue(*auts, cls=PL2):
D = list( auts[0].domain )
R = list( auts[0].range )
for prev, next in pairwise(auts):
assert next.domain[0] == prev.domain[-1]
assert next.range [0] == prev.range [-1]
D += next.domain[1:]
R += next.range[1:]
return cls(D,R)

epsilon = glue(x1^Sigma0, x1^Sigma1, cls=CPL2)
zeta = epsilon * rot
assert zeta.commutes(rot)
Expand Down
22 changes: 21 additions & 1 deletion plmaps/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,24 @@ def dump(aut, name):
if isinstance(aut, Automorphism):
print(name, aut.tikz_path(), sep="\n")
else:
print(name, aut, sep="\n")
print(name, aut, sep="\n")

def glue(*auts, cls=None):
#TODO: put this function in another file. Circular imports are messy
from .plmap import PL2
from .cplmap import CPLMap
if cls is None:
cls = PL2
D = list( auts[0].domain )
R = list( auts[0].range )
for prev, next in pairwise(auts):
if not issubclass(cls, CPLMap):
assert next.domain[0] == prev.domain[-1]
assert next.range [0] == prev.range [-1]
D += next.domain[1:]
R += next.range[1:]

if issubclass(cls, CPLMap):
cls._uncycle(D)
cls._uncycle(R)
return cls(D,R)

0 comments on commit 193af24

Please sign in to comment.