18 template <
typename Aut>
24 using automaton_t = Aut;
30 weightset_t ws(*res->context().weightset());
32 state_t initial = res->dst_of(res->initial_transitions().front());
34 weight_t w = ws.star(res->get_final_weight(initial));
37 for (
auto ti: res->out(initial))
39 res->lmul_weight(ti, w);
40 for (
auto tf: res->final_transitions())
41 if (res->src_of(tf) != initial)
48 ws.mul(res->weight_of(tf), res->weight_of(ti)));
50 for (
auto tf: res->final_transitions())
51 res->rmul_weight(tf, w);
52 res->set_final(initial, w);
58 template <
typename Aut>
72 template <
typename Aut>
76 const auto& aut = a->as<Aut>();
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
AutOut copy(const AutIn &input, KeepState keep_state, KeepTrans keep_trans)
A copy of input keeping only its states that are accepted by keep_state.
bool is_standard(const Aut &a)
Whether a is standard.
fresh_automaton_t_of< Aut > star(const Aut &aut)
Star of a standard automaton.
std::shared_ptr< detail::automaton_base > automaton
void require(bool b, Args &&...args)
If b is not verified, raise an error with args as message.
Aut & star_here(Aut &res)
In-place star of a standard automaton.
automaton star(const automaton &a)
Bridge.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of