17 template <
typename Aut>
33 else if (ws.is_one(w))
37 state_t initial = res->dst_of(res->initial_transitions().front());
38 for (
auto t: res->all_out(initial))
39 res->lmul_weight(t, w);
42 for (
auto t: res->initial_transitions())
43 res->lmul_weight(t, w);
54 else if (ws.is_one(w))
57 for (
auto t: res->final_transitions())
58 res->rmul_weight(t, w);
67 a->set_initial(a->new_state());
78 template <
typename Aut>
86 template <
typename AutIn,
87 typename AutOut = fresh_automaton_t_of<AutIn>>
92 auto res = copy<AutIn, AutOut>(aut);
102 template <
typename WeightSet,
typename Aut>
106 const auto& a1 = aut->as<Aut>();
107 const auto& w1 = weight->as<
WeightSet>();
113 join(w1.weightset(), *a1->weightset()));
116 auto w2 = ctx.weightset()->conv(w1.weightset(), w1.weight());
128 template <
typename ExpSet>
130 typename ExpSet::value_t
133 const typename ExpSet::value_t&
r)
135 return rs.lmul(w, r);
158 template <
typename WeightSet,
typename ExpSet>
159 expressionset<context<labelset_t_of<ExpSet>,
160 join_t<WeightSet, weightset_t_of<ExpSet>>>>
173 template <
typename WeightSet,
typename ExpSet>
177 const auto& w1 = weight->as<
WeightSet>();
178 const auto& r1 = exp->as<ExpSet>();
180 auto w2 = rs.weightset()->conv(w1.weightset(), w1.weight());
181 auto r2 = rs.conv(r1.expressionset(), r1.expression());
193 template <
typename Aut>
201 template <
typename Aut>
206 auto res =
copy(aut);
216 template <
typename Aut,
typename WeightSet>
220 const auto& a1 = aut->as<Aut>();
221 const auto& w1 = weight->as<
WeightSet>();
224 join(*a1->weightset(), w1.weightset()));
227 auto w2 = ctx.weightset()->conv(w1.weightset(), w1.weight());
237 template <
typename ExpSet>
239 typename ExpSet::value_t
241 const typename ExpSet::value_t&
r,
244 return rs.rmul(r, w);
252 template <
typename ExpSet,
typename WeightSet>
256 const auto& w1 = weight->as<
WeightSet>();
257 const auto& r1 = exp->as<ExpSet>();
259 auto w2 = rs.weightset()->conv(w1.weightset(), w1.weight());
260 auto r2 = rs.conv(r1.expressionset(), r1.expression());
automaton left_mult(const weight &weight, const automaton &aut)
Bridge.
Aut & left_mult_here(const weight_t_of< Aut > &w, Aut &res)
weightset_t_of< context_t > weightset_t
context make_context(const std::string &name)
Bridge.
AutOut make_fresh_automaton(const AutIn &model)
Create an empty, mutable, automaton, based on another one.
auto join(const ValueSet &vs) -> ValueSet
The join of a single valueset.
static automaton_t & left_mult_here(const weight_t &w, automaton_t &res)
Left-multiplication by a weight.
Aut & right_mult_here(Aut &res, const weight_t_of< Aut > &w)
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
context_t_of< automaton_t > context_t
weight_t_of< context_t > weight_t
static automaton_t & zero_here(automaton_t &res)
Transform res into the (standard) empty automaton.
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
AutOut copy(const AutIn &input, KeepState keep_state, KeepTrans keep_trans)
A copy of input keeping only its states that are accepted by keep_state.
static dyn::context ctx(const driver &d)
Get the context of the driver.
mutable_automaton< Context > make_mutable_automaton(const Context &ctx)
std::shared_ptr< const detail::weight_base > weight
bool is_standard(const Aut &a)
Whether a is standard.
Provide a variadic mul on top of a binary mul(), and one().
std::shared_ptr< detail::automaton_base > automaton
void copy_into(const AutIn &in, AutOut &out, KeepState keep_state, KeepTrans keep_trans)
Copy selected states and transitions of an automaton.
expressionset< Context > make_expressionset(const Context &ctx, rat::identities identities={})
Shorthand to expressionset constructor.
expression make_expression(const ExpSet &rs, const typename ExpSet::value_t &r)
static automaton_t & right_mult_here(automaton_t &res, const weight_t &w)
Right-multiplication by a weight.
Ctx make_context(const std::string &name)
expression left_mult_expression(const weight &weight, const expression &exp)
Bridge (left_mult).
automaton right_mult(const automaton &aut, const weight &weight)
Bridge.
std::shared_ptr< detail::expression_base > expression
fresh_automaton_t_of< Aut > right_mult(const Aut &aut, const weight_t_of< Aut > &w)
state_t_of< automaton_t > state_t
context join(const context &c1, const context &c2)
Bridge.
AutOut left_mult(const weight_t_of< AutOut > &w, const AutIn &aut)
expressionset< context< labelset_t_of< ExpSet >, join_t< WeightSet, weightset_t_of< ExpSet > > > > join_weightset_expressionset(const WeightSet &ws, const ExpSet &rs)
Join between an expressionset and a weightset.
expression right_mult_expression(const expression &exp, const weight &weight)
Bridge (right_mult).
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of