1 #ifndef VCSN_ALGOS_PREFIX_HH
2 # define VCSN_ALGOS_PREFIX_HH
15 template <
typename Aut>
22 && !aut->is_initial(s))
27 template <
typename Aut>
42 template <
typename Aut>
46 const auto& a = aut->as<Aut>();
61 template <
typename Aut>
70 template <
typename Aut>
85 template <
typename Aut>
89 const auto& a = aut->as<Aut>();
103 template <
typename Aut>
108 if (s != aut->pre() && s != aut->post())
110 if (!aut->is_initial(s))
112 if (!aut->is_final(s))
118 template <
typename Aut>
133 template <
typename Aut>
137 const auto& a = aut->as<Aut>();
152 template <
typename Aut>
156 const auto one = aut->labelset()->one();
158 std::vector<transition_t_of<Aut>> ts;
159 for (
auto s : aut->states())
162 for (
auto t : aut->out(s))
163 if (!aut->labelset()->is_one(aut->label_of(t)))
166 aut->add_transition(s, aut->dst_of(t), one, aut->weight_of(t));
173 template <
typename Aut>
188 template <
typename Aut>
192 const auto& a = aut->as<Aut>();
202 #endif // !VCSN_ALGOS_PREFIX_HH
automaton prefix(const automaton &aut)
Bridge.
automaton suffix(const automaton &aut)
Bridge.
REGISTER_DECLARE(accessible,(const automaton &) -> automaton)
std::shared_ptr< detail::automaton_base > automaton
states_t< Aut > useful_states(const Aut &a)
auto subword(const Aut &aut) -> decltype(::vcsn::copy(aut))
Apply subword_here() to a copy of aut.
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
AutOut copy(const AutIn &input, Pred keep_state)
A copy of input keeping only its states that are accepted by keep_state.
auto factor(const Aut &aut) -> decltype(::vcsn::copy(aut))
Aut & prefix_here(Aut &aut)
Make all coaccessible states final.
states_t< Aut > accessible_states(const Aut &aptr)
Aut & subword_here(Aut &aut)
Add spontaneous transitions for each non spontaneous transition, with same source, destination and weight.
Aut transpose(const transpose_automaton< Aut > &aut)
Aut & suffix_here(Aut &aut)
Make all accessible states initial.
automaton subword(const automaton &aut)
Bridge.
Aut & factor_here(Aut &aut)
Make each useful state both initial and final.
automaton factor(const automaton &aut)
auto suffix(const Aut &aut) -> decltype(::vcsn::copy(aut))
auto prefix(const Aut &aut) -> decltype(::vcsn::copy(aut))