1 #ifndef VCSN_ALGOS_LEFT_MULT_HH
2 # define VCSN_ALGOS_LEFT_MULT_HH
18 template <
typename Aut>
34 else if (ws.is_one(w))
38 state_t initial = res->dst_of(res->initial_transitions().front());
39 for (
auto t: res->all_out(initial))
40 res->lmul_weight(t, w);
43 for (
auto t: res->initial_transitions())
44 res->lmul_weight(t, w);
55 else if (ws.is_one(w))
58 for (
auto t: res->final_transitions())
59 res->rmul_weight(t, w);
67 automaton_t a = make_shared_ptr<automaton_t>(res->context());
68 a->set_initial(a->new_state());
79 template <
typename Aut>
87 template <
typename AutIn,
88 typename AutOut =
typename AutIn::element_type::automaton_nocv_t>
93 auto res = copy<AutIn, AutOut>(aut);
103 template <
typename WeightSet,
typename Aut>
107 const auto& a1 = aut->as<Aut>();
108 const auto& w1 = weight->as<
WeightSet>();
114 join(w1.weightset(), *a1->weightset()));
117 auto w2 = ctx.weightset()->conv(w1.weightset(), w1.weight());
132 template <
typename RatExpSet>
134 typename RatExpSet::value_t
137 const typename RatExpSet::value_t&
r)
139 return rs.lmul(w, r);
162 template <
typename WeightSet,
typename RatExpSet>
163 ratexpset<context<labelset_t_of<RatExpSet>,
164 join_t<WeightSet, weightset_t_of<RatExpSet>>>>
177 template <
typename WeightSet,
typename RatExpSet>
181 const auto& w1 = weight->as<
WeightSet>();
182 const auto& r1 = exp->as<RatExpSet>();
184 auto w2 = rs.weightset()->conv(w1.weightset(), w1.weight());
185 auto r2 = rs.conv(r1.ratexpset(), r1.ratexp());
200 template <
typename Aut>
208 template <
typename Aut>
210 typename Aut::element_type::automaton_nocv_t
213 auto res =
copy(aut);
223 template <
typename Aut,
typename WeightSet>
227 const auto& a1 = aut->as<Aut>();
228 const auto& w1 = weight->as<
WeightSet>();
231 join(*a1->weightset(), w1.weightset()));
234 auto w2 = ctx.weightset()->conv(w1.weightset(), w1.weight());
247 template <
typename RatExpSet>
249 typename RatExpSet::value_t
251 const typename RatExpSet::value_t&
r,
254 return rs.rmul(r, w);
262 template <
typename RatExpSet,
typename WeightSet>
266 const auto& w1 = weight->as<
WeightSet>();
267 const auto& r1 = exp->as<RatExpSet>();
269 auto w2 = rs.weightset()->conv(w1.weightset(), w1.weight());
270 auto r2 = rs.conv(r1.ratexpset(), r1.ratexp());
282 #endif // !VCSN_ALGOS_LEFT_MULT_HH
ratexp make_ratexp(const RatExpSet &rs, const typename RatExpSet::value_t &ratexp)
mutable_automaton< Context > make_mutable_automaton(const Context &ctx)
REGISTER_DECLARE(accessible,(const automaton &) -> automaton)
std::shared_ptr< detail::automaton_base > automaton
ratexpset< context< labelset_t_of< RatExpSet >, join_t< WeightSet, weightset_t_of< RatExpSet > > > > join_weightset_ratexpset(const WeightSet &ws, const RatExpSet &rs)
Join between a ratexpset and a weightset.
static automaton_t & left_mult_here(const weight_t &w, automaton_t &res)
Left-multiplication by a weight.
ratexpset< Context > make_ratexpset(const Context &ctx, rat::identities identities)
Shorthand to ratexpset constructor.
bool is_standard(const Aut &a)
Whether a is standard.
context make_context(const std::string &name)
Bridge.
std::shared_ptr< const detail::weight_base > weight
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
std::shared_ptr< detail::ratexp_base > ratexp
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
automaton left_mult(const weight &weight, const automaton &aut)
Bridge.
AutOut copy(const AutIn &input, Pred keep_state)
A copy of input keeping only its states that are accepted by keep_state.
Aut & left_mult_here(const weight_t_of< Aut > &w, Aut &res)
automaton right_mult(const automaton &aut, const weight &weight)
Bridge.
static automaton_t & zero_here(automaton_t &res)
Transform res into the (standard) empty automaton.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
state_t_of< automaton_t > state_t
Aut::element_type::automaton_nocv_t right_mult(const Aut &aut, const weight_t_of< Aut > &w)
static automaton_t & right_mult_here(automaton_t &res, const weight_t &w)
Right-multiplication by a weight.
Provide a variadic mul on top of a binary mul(), and one().
Aut & right_mult_here(Aut &res, const weight_t_of< Aut > &w)
weightset_t_of< context_t > weightset_t
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
context_t_of< automaton_t > context_t
void copy_into(const AutIn &in, AutOut &out, Pred keep_state)
Copy an automaton.
weight_t_of< context_t > weight_t
auto join(const ValueSet &vs) -> ValueSet
The join of a single valueset.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
ratexp right_mult_ratexp(const ratexp &exp, const weight &weight)
Bridge.
Ctx make_context(const std::string &name)
AutOut left_mult(const weight_t_of< AutOut > &w, const AutIn &aut)
ratexp left_mult_ratexp(const weight &weight, const ratexp &exp)
Bridge.