17 #ifndef AWALI_ALGOS_LEFT_MULT_HH
18 # define AWALI_ALGOS_LEFT_MULT_HH
25 namespace awali {
namespace sttc {
30 template <
typename Aut>
48 state_t initial = res->dst_of(*(res->initial_transitions().begin()));
50 for(
auto s : res->states())
55 for (
auto t: res->all_out(initial))
56 res->lmul_weight(t, w);
58 else if (ws.is_zero(w))
61 for (
auto t: res->initial_transitions())
62 res->lmul_weight(t, w);
73 else if (ws.is_one(w))
76 for (
auto t: res->final_transitions())
77 res->rmul_weight(t, w);
85 automaton_t a = make_shared_ptr<automaton_t>(res->context());
86 a->set_initial(a->add_state());
114 template <
typename Aut>
122 template <
typename Aut>
124 typename Aut::element_type::automaton_nocv_t
127 auto res =
copy(aut);
137 template <
typename RatExpSet>
139 typename RatExpSet::ratexp_t
142 const typename RatExpSet::value_t&
r)
144 return rs.lmul(w,
r);
151 template <
typename Aut>
159 template <
typename Aut>
161 typename Aut::element_type::automaton_nocv_t
164 auto res =
copy(aut);
173 template <
typename RatExpSet>
175 typename RatExpSet::ratexp_t
177 const typename RatExpSet::value_t&
r,
180 return rs.rmul(
r, w);
The semiring of floating Numbers.
Definition: r.hh:35
Aut & right_mult_here(Aut &res, const weight_t_of< Aut > &w)
Definition: left_mult.hh:154
bool is_standard(const Aut &a)
Definition: standard.hh:40
typename internal::weight_t_of_impl< internal::base_t< ValueSet > >::type weight_t_of
Helper to retrieve the type of the weights of a value set.
Definition: traits.hh:81
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
Aut standard(Aut &aut, bool keep_history=true)
Definition: standard.hh:92
AutOut copy(const AutIn &input, Pred keep_state, bool keep_history=true, bool transpose=false)
A copy of input keeping only its states that are accepted by keep_state.
Definition: copy.hh:189
Aut & left_mult_here(Aut &res, const weight_t_of< Aut > &w, bool standard=false)
multiplies the initial states by a weight
Definition: left_mult.hh:117
void require(bool b, Args &&... args)
If b is not verified, raise an error with args as message.
Definition: raise.hh:55
Aut::element_type::automaton_nocv_t left_mult(const Aut &aut, const weight_t_of< Aut > &w, bool standard=false)
Definition: left_mult.hh:125
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
Aut::element_type::automaton_nocv_t right_mult(const Aut &aut, const weight_t_of< Aut > &w)
Definition: left_mult.hh:162
Main namespace of Awali.
Definition: ato.hh:22
unsigned state_t
Definition: types.hh:21
Definition: left_mult.hh:32
Aut automaton_t
Definition: left_mult.hh:33
static automaton_t & left_mult_here(automaton_t &res, const weight_t &w, bool standard)
Left-multiplication by a weight.
Definition: left_mult.hh:40
context_t_of< automaton_t > context_t
Definition: left_mult.hh:34
weightset_t_of< context_t > weightset_t
Definition: left_mult.hh:36
weight_t_of< context_t > weight_t
Definition: left_mult.hh:35
static automaton_t & right_mult_here(automaton_t &res, const weight_t &w)
Right-multiplication by a weight.
Definition: left_mult.hh:68
static automaton_t & zero_here(automaton_t &res)
Transform res into the (standard) empty automaton.
Definition: left_mult.hh:83