32 namespace VCSN_GRAPH_IMPL
34 VCSN_CONTEXT_NAMESPACE
37 template <
class FirstInputIterator,
class SecondInputIterator>
38 automata_set_t make_automata_set(
const FirstInputIterator first_begin,
39 const FirstInputIterator first_end,
40 const SecondInputIterator second_begin,
41 const SecondInputIterator second_end)
43 first_alphabet_t first_alpha;
45 for (FirstInputIterator e = first_begin; e != first_end; ++e)
46 first_alpha.insert(*e);
48 second_alphabet_t second_alpha;
50 for (SecondInputIterator e = second_begin; e != second_end; ++e)
51 second_alpha.insert(*e);
54 first_monoid_t mA(first_alpha);
55 second_monoid_t mB(second_alpha);
56 monoid_t freemonoidproduct(mA, mB);
57 series_set_t series(semiring, freemonoidproduct);
59 return automata_set_t(series);
62 template <
class FirstInputIterator,
class SecondInputIterator>
63 automata_set_t make_automata_set(
const FirstInputIterator first_begin,
64 const FirstInputIterator first_end,
65 const SecondInputIterator second_begin,
66 const SecondInputIterator second_end,
67 const monoid_rep_t& mrep,
68 const first_monoid_rep_t& mrep1,
69 const second_monoid_rep_t& mrep2,
70 const series_rep_t& srep)
72 first_alphabet_t first_alpha;
74 for (FirstInputIterator e = first_begin; e != first_end; ++e)
75 first_alpha.insert(*e);
77 second_alphabet_t second_alpha;
79 for (SecondInputIterator e = second_begin; e != second_end; ++e)
80 second_alpha.insert(*e);
83 first_monoid_t mA(first_alpha, mrep1);
84 second_monoid_t mB(second_alpha, mrep2);
85 monoid_t freemonoidproduct(mA, mB, mrep);
86 series_set_t series(semiring, freemonoidproduct, srep);
88 return automata_set_t(series);
91 template <
class FirstInputIterator,
class SecondInputIterator>
92 automaton_t make_automaton(
const FirstInputIterator first_begin,
93 const FirstInputIterator first_end,
94 const SecondInputIterator second_begin,
95 const SecondInputIterator second_end)
97 return automaton_t(make_automata_set(first_begin, first_end,
98 second_begin, second_end));
101 template <
class FirstInputIterator,
class SecondInputIterator>
102 automaton_t make_automaton(
const FirstInputIterator first_begin,
103 const FirstInputIterator first_end,
104 const SecondInputIterator second_begin,
105 const SecondInputIterator second_end,
106 const monoid_rep_t& mrep,
107 const first_monoid_rep_t& mrep1,
108 const second_monoid_rep_t& mrep2,
109 const series_rep_t& srep)
111 return automaton_t(make_automata_set(first_begin, first_end,
112 second_begin, second_end,
117 template <
class T1,
class T2>
118 automaton_t make_automaton(
const T1& first_alphabet,
119 const T2& second_alphabet)
121 return make_automaton(first_alphabet.begin(), first_alphabet.end(),
122 second_alphabet.begin(), second_alphabet.end());
125 template <
class T1,
class T2>
126 automaton_t make_automaton(
const T1& first_alphabet,
127 const T2& second_alphabet,
128 const monoid_rep_t& mrep,
129 const first_monoid_rep_t& mrep1,
130 const second_monoid_rep_t& mrep2,
131 const series_rep_t& srep)
133 return make_automaton(first_alphabet.begin(), first_alphabet.end(),
134 second_alphabet.begin(), second_alphabet.end(),
135 mrep, mrep1, mrep2, srep);
138 template <
class FirstIterator,
class SecondIterator>
139 monoid_elt_t make_couple(
const FirstIterator first_begin,
140 const FirstIterator first_end,
141 const SecondIterator second_begin,
142 const SecondIterator second_end,
143 const first_monoid_elt_value_t& first_exp,
144 const second_monoid_elt_value_t& second_exp)
146 first_alphabet_t first_alpha;
147 for (FirstIterator e = first_begin; e != first_end; ++e)
148 first_alpha.insert(*e);
150 second_alphabet_t second_alpha;
151 for (SecondIterator e = second_begin; e != second_end; ++e)
152 second_alpha.insert(*e);
154 monoid_t fmp (first_alpha, second_alpha);
155 monoid_elt_value_t fmp_elt_value (first_exp, second_exp);
157 return Element<monoid_t, monoid_elt_value_t> (fmp, fmp_elt_value);
160 template <
class T1,
class T2>
161 monoid_elt_t make_couple(
const T1& first_alphabet,
162 const T2& second_alphabet,
163 const first_monoid_elt_value_t& first_exp,
164 const second_monoid_elt_value_t& second_exp)
166 return make_couple(first_alphabet.begin(), first_alphabet.end(),
167 second_alphabet.begin(), second_alphabet.end(),
168 first_exp, second_exp);
172 template <
typename TransStruct,
174 typename SeriesStruct,
178 AUTOMATON_CONTEXT::rat_exp_t
183 const Element<TransStruct, TransImpl>& t,
184 const Element<SeriesStruct, SeriesImpl>&)
186 AUTOMATON_CONTEXT::automaton_t w = AUTOMATON_CONTEXT::make_automaton(t.structure().series()
187 .monoid().first_monoid().alphabet());
188 AUTOMATON_CONTEXT::automaton_t result = AUTOMATON_CONTEXT::make_automaton(t.structure().series()
189 .monoid().second_monoid().alphabet());
198 template <
typename TransStruct,
202 AUTOMATON_CONTEXT::rat_exp_t
203 evaluation(
const Element<TransStruct, TransImpl>& t,
204 const Element<ArgStruct, ArgImpl>& input)
206 return do_evaluation(t.structure(), t.value(),
207 input.structure(), input.value(),
218 template <
class Chooser>
220 aut_to_exp(
const automaton_t& a,
const Chooser& c)