1 #ifndef VCSN_ALGOS_QUOTIENT_HH
2 # define VCSN_ALGOS_QUOTIENT_HH
5 # include <unordered_map>
6 # include <unordered_set>
20 template <
typename Aut>
29 using set_t = std::vector<state_t>;
63 return lhs[0] < rhs[0];
73 state_to_class[s] = c;
76 = make_shared_ptr<partition_automaton_t>(aut);
83 = s == aut->pre() ? res->pre()
84 : s == aut->post() ? res->post()
85 : res->new_state(set);
93 for (
auto t : aut->all_out(s))
97 res->add_transition(src, dst, aut->label_of(t), aut->weight_of(t));
100 return std::move(res);
113 const char* sep =
"";
123 const char* sep =
"";
124 for (
unsigned i = 0; i < c2ss.size(); ++i)
126 o << sep <<
'[' << i <<
"] = ";
140 template <
typename Aut>
153 #endif // !VCSN_ALGOS_QUOTIENT_HH
class_to_state_t class_to_res_state_
partition_automaton_t operator()(const automaton_t &aut)
The minimized automaton.
auto quotient(const Aut &a, typename detail::quotienter< Aut >::class_to_set_t &classes) -> partition_automaton< Aut >
std::unordered_map< state_t, class_t > state_to_class_t
void sort_classes_()
Sort the classes.
partition_automaton< automaton_t > partition_automaton_t
std::ostream & print_(const set_t &ss, std::ostream &o) const
std::ostream & print_(const class_to_set_t &c2ss, std::ostream &o) const
auto sort(const Aut &a) -> permutation_automaton< Aut >
partition_automaton_t build_result_(const automaton_t &aut)
Build the resulting automaton.
std::vector< state_t > class_to_state_t
class_to_set_t & class_to_set_
quotienter(class_to_set_t &class_to_set)
std::vector< state_t > set_t
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
state_t_of< automaton_t > state_t
std::shared_ptr< detail::partition_automaton_impl< Aut >> partition_automaton
A partition automaton as a shared pointer.
std::vector< set_t > class_to_set_t
Apply a quotient onto an automaton: fuse equivalent states.