Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Some little improvements (add Cd argument in sage.monoids.beta_adic_m…
Browse files Browse the repository at this point in the history
…onoid BetaAdicMonoid.relations, change the style of the arrows for plotting automaton using TikZ)
  • Loading branch information
mercatp committed Aug 11, 2014
1 parent 06e20ef commit 827d952
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/sage/combinat/words/automata.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,11 @@ class Automaton (DiGraph):
self.allow_multiple_edges(True)
for u,v,l in self.edges():
self.delete_edge(u, v, l)
for l2 in d[l]:
self.add_edge(u, v, l2)
if d.has_key(l):
for l2 in d[l]:
self.add_edge(u, v, l2)
else:
print "Key %s not in the dictionary !"%l
self.A = [a for A in d.values() for a in A]

def determinize_rec (self, S, A, a, nof, noempty, verb):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/words/automata_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void TikZ (const char *data, const char *graph_name, double sx, double sy)
printf("start...\n");
fprintf(f, "digraph %s\n{\n"\
" node[fontsize=20]"\
" edge[fontsize=20]"\
" edge[fontsize=20, arrowhead = open]"\
" rankdir = LR;\n"\
" size = \"%lf, %lf\";\n"\
" center = 1;\n"\
Expand Down
7 changes: 4 additions & 3 deletions src/sage/monoids/beta_adic_monoid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ class BetaAdicMonoid(Monoid_class):
di[current_state][e] = c
return di

def relations_automaton (self, ext=False, ss=None, noss=False, verb=False, step=100, limit=None, niter=None):
def relations_automaton (self, ext=False, ss=None, noss=False, Cd=None, verb=False, step=100, limit=None, niter=None):
r"""
Compute the relations automaton of the beta-adic monoid (with or without subshift).
See http://www.latp.univ-mrs.fr/~paul.mercat/Publis/Semi-groupes%20fortement%20automatiques.pdf for a definition of such automaton (without subshift).
Expand Down Expand Up @@ -1066,7 +1066,8 @@ class BetaAdicMonoid(Monoid_class):
if verb: print "places: "; print parch; print pultra

#calcule les bornes max pour chaque valeur absolue
Cd = Set([c-c2 for c in self.C for c2 in self.C])
if Cd is None:
Cd = Set([c-c2 for c in self.C for c2 in self.C])
if verb: print "Cd = %s"%Cd
m = dict([])
for p in parch:
Expand Down Expand Up @@ -1108,7 +1109,7 @@ class BetaAdicMonoid(Monoid_class):
if verb: print "Avant emondation : %s"%res

res.I = [K.zero()]
res.A = Set([c-c2 for c in self.C for c2 in self.C])
res.A = Cd #Set([c-c2 for c in self.C for c2 in self.C])
if verb: print "Emondation..."
if not ext:
res.F = [K.zero()]
Expand Down

0 comments on commit 827d952

Please sign in to comment.