From a45bb655f48d152a750f0e4a30d445c5bea92593 Mon Sep 17 00:00:00 2001 From: Paul Mercat Date: Fri, 8 Jul 2016 19:45:26 +0200 Subject: [PATCH] Add a function zero_complete() for FastAutomaton, a function shift for BetaAdicMonoid (not well tested) and correct some little things. --- src/sage/combinat/words/automataC.c | 58 ++++++++++++++++++++++++++- src/sage/combinat/words/automataC.h | 5 ++- src/sage/combinat/words/cautomata.pyx | 38 ++++++++++++++---- src/sage/monoids/beta_adic_monoid.pyx | 36 ++++++++++++++++- 4 files changed, 126 insertions(+), 11 deletions(-) diff --git a/src/sage/combinat/words/automataC.c b/src/sage/combinat/words/automataC.c index cf7fd4d3f9c..123ba900501 100644 --- a/src/sage/combinat/words/automataC.c +++ b/src/sage/combinat/words/automataC.c @@ -30,6 +30,13 @@ PyMODINIT_FUNC initdautomata(void) typedef Automate Automaton; +/* +void printAutomaton (Automaton a) +{ + printf("Automate ayant %d lettres, %d états, état initial %d.\n", a.na, a.n, a.i); +} +*/ + Dict NewDict (int n) { Dict r; @@ -550,6 +557,12 @@ bool IsCompleteAutomaton (Automaton a) //return true iff a state was added bool CompleteAutomaton (Automaton *a) { +/* + if (a->n == 0) + { + AddEtat(a, false); //ajoute un état + } +*/ int ne = a->n; //nouvel état int i,j; bool add_etat = false; @@ -772,8 +785,13 @@ void Product_rec(Automaton r, int i1, int i2, Automaton a1, Automaton a2, Dict d } } -Automaton Product(Automaton a1, Automaton a2, Dict d) +Automaton Product (Automaton a1, Automaton a2, Dict d, bool verb) { + if (verb) + { + printAutomaton(a1); + printAutomaton(a2); + } //printf("a1.na=%d, a2.na=%d\n", a1.na, a2.na); //compte le nombre de lettres de l'alphabet final int i, na=0; @@ -1708,6 +1726,44 @@ Automaton Duplicate (Automaton a, InvertDict id, int na2, bool verb) return r; } +void ZeroComplete_rec (Automaton a, int etat, bool *vu, int l0, bool verb) +{ + if (verb) + printf("etat %d ..\n", etat); + vu[etat] = true; + int i, e; + for (i=0;i