Vcsn  2.8
Be Rational
to-expression-expansion.hh
Go to the documentation of this file.
1 #pragma once
2 
5 
6 namespace vcsn
7 {
12  template <typename ExpansionSet>
13  typename ExpansionSet::expression_t
14  to_expression(const ExpansionSet& xs,
15  const typename ExpansionSet::value_t& x)
16  {
17  const auto& es = xs.expressionset();
18  const auto& ps = xs.polynomialset();
19  auto res = es.lweight(x.constant, es.one());
20  for (const auto& p: x.polynomials)
21  res = es.add(res,
22  es.mul(es.atom(p.first), ps.to_label(p.second)));
23  return res;
24  }
25 
26  namespace dyn
27  {
28  namespace detail
29  {
31  template <typename ExpansionSet>
34  {
35  const auto& x = exp->as<ExpansionSet>();
36  return {x.valueset(), to_expression(x.valueset(), x.value())};
37  }
38  }
39  }
40 }
auto & as()
Extract wrapped typed value.
Definition: value.hh:55
expression to_expression_expansion(const expansion &exp)
Bridge (to_expression).
A dyn Value/ValueSet.
Definition: fwd.hh:29
Definition: a-star.hh:8
ExpSet::value_t to_expression(Aut &a, Profiler &profiler)
Definition: to-automaton.hh:65
value_impl< detail::expression_tag > expression
Definition: fwd.hh:31
return res
Definition: multiply.hh:399
expression to_expression(const automaton &aut, identities ids, const std::string &algo)
Bridge.