17 #ifndef AWALI_ALGOS_PROJECTION_HH
18 # define AWALI_ALGOS_PROJECTION_HH
20 # include <unordered_map>
28 namespace awali {
namespace sttc {
37 template <
typename Labelset,
size_t I>
struct select;
38 template <
typename Labelset,
size_t... I>
struct selects;
41 template <
typename... T,
size_t I>
44 using labelset_t =
typename tp_t::template valueset_t<I>;
48 return std::get<I>(t.
sets());
53 template<
typename... T>
58 template <
typename... T,
size_t... I>
69 template <
typename... T>
80 template <
typename Aut,
size_t I>
94 auto in_labelset = in_context.labelset();
106 for (
auto s:
in_->states())
111 for (
auto t :
in_->all_transitions())
116 out_->new_transition(src->second, dst->second,
117 std::get<I>(
in_->label_of(t)),
in_->weight_of(t));
124 auto history = std::make_shared<single_history<Aut>>(
in_);
125 out_->set_history(history);
126 for (
auto p:
in_->all_states()) {
128 if(
in_->has_name(p)) {
142 template <
typename Aut>
156 auto in_labelset = in_context.labelset();
168 for (
auto s:
in_->states())
173 for (
auto t :
in_->all_transitions())
178 out_->new_transition(src->second, dst->second,
186 auto history = std::make_shared<single_history<Aut>>(
in_);
187 out_->set_history(history);
188 for (
auto p:
in_->all_states())
201 template <
typename Aut,
size_t... I>
215 auto in_labelset = in_context.labelset();
226 for (
auto s:
in_->states())
231 for (
auto t :
in_->all_transitions())
236 out_->new_transition(src->second, dst->second,
244 auto history = std::make_shared<single_history<Aut>>(
in_);
245 out_->set_history(history);
246 for (
auto p:
in_->all_states())
267 template <
size_t I,
typename Tdc>
286 template <
typename Tdc>
310 template <
size_t... I,
typename Tdc>
carries the algebraic settings of automata
Definition: context.hh:40
The semiring of floating Numbers.
Definition: r.hh:35
A ValueSet which is a Cartesian product of ValueSets.
Definition: tupleset.hh:80
const valuesets_t & sets() const
The componants valuesets, as a tuple.
Definition: tupleset.hh:152
weightset_description weightset(const std::string &k)
auto tuple_tail(const Tuple &t) -> typename tail_tuple< Tuple >::type
Definition: sub_tuple.hh:96
Definition: projection.hh:39
Definition: projection.hh:38
Definition: sub_tuple.hh:65
Definition: projection.hh:52
auto projections(const Tdc &in, bool keep_history=true) -> typename internal::projectors< Tdc, I... >::out_automaton_t
Projection and/or permutation of tapes of a transducer.
Definition: projection.hh:313
auto projection(const Tdc &in, bool keep_history=true) -> typename internal::projector< Tdc, I >::out_automaton_t
Projection of one tape of a transducer.
Definition: projection.hh:270
typename internal::context_t_of_impl< internal::base_t< ValueSet > >::type context_t_of
Helper to retrieve the type of the context of a value set.
Definition: traits.hh:66
typename internal::labelset_t_of_impl< internal::base_t< ValueSet > >::type labelset_t_of
Helper to retrieve the type of the labelset of a value set.
Definition: traits.hh:76
auto images(const Tdc &in, bool keep_history=true) -> typename internal::imagers< Tdc >::out_automaton_t
Projection of last tapes of a transducer.
Definition: projection.hh:289
mutable_automaton< Context > make_mutable_automaton(const Context &ctx)
Definition: mutable_automaton.hh:915
std::shared_ptr< internal::mutable_automaton_impl< Context > > mutable_automaton
Definition: mutable_automaton.hh:45
typename internal::weightset_t_of_impl< internal::base_t< ValueSet > >::type weightset_t_of
Helper to retrieve the type of the weightset of a value set.
Definition: traits.hh:86
Main namespace of Awali.
Definition: ato.hh:22
Definition: projection.hh:144
context_t_of< Aut > context_t
Definition: projection.hh:145
mutable_automaton< out_context_t > out_automaton_t
Definition: projection.hh:150
out_automaton_t operator()()
Definition: projection.hh:164
void set_history()
Definition: projection.hh:185
mutable_automaton< out_context_t > out_
Output automaton.
Definition: projection.hh:195
weightset_t_of< context_t > weightset_t
Definition: projection.hh:147
typename select_tail< labelset_t >::labelset_t out_labelset_t
Definition: projection.hh:148
labelset_t_of< context_t > labelset_t
Definition: projection.hh:146
imagers(const Aut &in)
Definition: projection.hh:152
const Aut & in_
Input automaton.
Definition: projection.hh:193
std::unordered_map< state_t, state_t > out_state
input state -> output state.
Definition: projection.hh:197
Definition: projection.hh:82
mutable_automaton< out_context_t > out_automaton_t
Definition: projection.hh:88
void set_history()
Definition: projection.hh:123
std::unordered_map< state_t, state_t > out_state
input state -> output state.
Definition: projection.hh:139
labelset_t_of< context_t > labelset_t
Definition: projection.hh:84
projector(const Aut &in)
Definition: projection.hh:90
weightset_t_of< context_t > weightset_t
Definition: projection.hh:85
mutable_automaton< out_context_t > out_
Output automaton.
Definition: projection.hh:137
context_t_of< Aut > context_t
Definition: projection.hh:83
const Aut & in_
Input automaton.
Definition: projection.hh:135
out_automaton_t operator()()
Definition: projection.hh:102
typename select< labelset_t, I >::labelset_t out_labelset_t
Definition: projection.hh:86
Definition: projection.hh:203
context_t_of< Aut > context_t
Definition: projection.hh:204
out_automaton_t operator()()
Definition: projection.hh:222
std::unordered_map< state_t, state_t > out_state
input state -> output state.
Definition: projection.hh:255
projectors(const Aut &in)
Definition: projection.hh:211
weightset_t_of< context_t > weightset_t
Definition: projection.hh:206
mutable_automaton< out_context_t > out_automaton_t
Definition: projection.hh:209
mutable_automaton< out_context_t > out_
Output automaton.
Definition: projection.hh:253
void set_history()
Definition: projection.hh:243
labelset_t_of< context_t > labelset_t
Definition: projection.hh:205
const Aut & in_
Input automaton.
Definition: projection.hh:251
typename selects< labelset_t, I... >::labelset_t out_labelset_t
Definition: projection.hh:207
static labelset_t get(const tp_t &t)
Definition: projection.hh:47
typename tp_t::template valueset_t< I > labelset_t
Definition: projection.hh:44
typename tuple_to_tupleset< typename tail_tuple< std::tuple< T... > >::type >::type labelset_t
Definition: projection.hh:72
static labelset_t get(const tp_t &t)
Definition: projection.hh:75
Definition: reduce.hh:103
typename tuple_to_tupleset< typename sub_tuple< I... >::template type< std::tuple< T... > >>::type labelset_t
Definition: projection.hh:61
static labelset_t get(const tp_t &t)
Definition: projection.hh:64
Definition: sub_tuple.hh:34
static auto get(const Tuple &t) -> type< Tuple >
Definition: sub_tuple.hh:40