18 template <
typename ExpSet>
24 template <
typename ExpSet>
29 template <
typename ExpSet>
33 using context_t =
context<ExpSet,
35 return context_t{
rs, *rs.weightset()};
74 template <
typename ExpSet>
76 :
public ExpSet::const_visitor
85 using weight_t =
typename weightset_t::value_t;
90 using super_t =
typename expressionset_t::const_visitor;
93 constexpr
static const char*
me() {
return "split"; }
109 return std::move(
res_);
130 for (
const auto&
v: e)
135 res_ = std::move(res);
149 ps_.del_weight(l_split,
rs_.one());
152 return ps_.add(
ps_.rmul_label(l_split, r),
153 ps_.lweight(l_split_const,
split(r)));
162 for (
const auto& m: l)
171 for (
unsigned i = 2, n = e.size(); i < n; ++i)
187 ps_.del_weight(l_split,
rs_.one());
191 for (
const auto& e: l_split)
195 ps_.lweight(l_split_const,
split(r)));
205 for (
const auto& m: l)
214 for (
unsigned i = 2, n = e.size(); i < n; ++i)
227 void visit(const tuple_t&,
std::true_type)
override
229 raise(
me(),
": tuple is not supported");
239 e.sub()->accept(*
this);
245 e.sub()->accept(*
this);
260 template <
typename ExpSet>
262 split(
const ExpSet&
rs,
const typename ExpSet::value_t& e)
273 template <
typename ExpSet>
277 const auto& e = exp->
as<ExpSet>();
278 const auto&
rs = e.valueset();
280 return {ps, vcsn::split<ExpSet>(
rs, e.value())};
286 template <
typename PolynomialSet>
287 typename PolynomialSet::value_t
289 const typename PolynomialSet::value_t& p)
291 using polynomial_t =
typename PolynomialSet::value_t;
293 const auto&
rs = *ps.labelset();
295 for (
const auto& m: p)
301 template <
typename ExpSet>
302 rat::expression_polynomial_t<ExpSet>
313 template <
typename PolynomialSet>
317 const auto& p = poly->
as<PolynomialSet>();
318 const auto& ps = p.valueset();
319 return {ps, vcsn::split_polynomial<PolynomialSet>(ps, p.value())};
polynomial_t product(const expression_t &l, const expression_t &r)
The split-product of l with r.
expression_polynomialset_t< ExpSet > make_expression_polynomialset(const ExpSet &rs)
From a ExpSet to its polynomialset.
An inner node implementing a weight.
PolynomialSet::value_t split_polynomial(const PolynomialSet &ps, const typename PolynomialSet::value_t &p)
Split a polynomial of expressions, given the polynomialset.
typename expression_polynomialset_t< ExpSet >::value_t expression_polynomial_t
Type of polynomials of expressions from the ExpSet type.
typename super_t::tuple_t tuple_t
polynomial split(const expression &exp)
Break exp.
auto weight_of(const welement< Label, Weight > &m) -> decltype(m.weight())
The weight of a welement.
Provide a variadic mul on top of a binary mul(), and one().
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
rat::expression_polynomial_t< ExpSet > split(const ExpSet &rs, const typename ExpSet::value_t &e)
Split an expression.
static constexpr const char * me()
Name of this algorithm, for error messages.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
VCSN_RAT_VISIT(mul, e)
Handle an n-ary product.
weightset_t ws_
Shorthand to the weightset.
typename polynomialset_t::value_t polynomial_t
void visit(const tuple_t &, std::true_type) override
#define VCSN_RAT_UNSUPPORTED(Type)
VCSN_RAT_VISIT(rweight, e)
VCSN_RAT_VISIT(conjunction, e)
Handle an n-ary conjunction.
polynomial_t conjunction(const expression_t &l, const expression_t &r)
The split-product of l with r.
weightset_t_of< expressionset_t > weightset_t
label_t_of< context_t > label_t
polynomial split(const expression &exp)
Bridge.
typename weightset_t::value_t weight_t
An inner node with multiple children.
context_t_of< expressionset_t > context_t
split_visitor(const expressionset_t &rs)
polynomial_t split(const expression_t &v)
Easy recursion.
polynomialset< context< ExpSet, weightset_t_of< ExpSet >>> expression_polynomialset_t
Type of PolynomialSet of expressions from the ExpSet type.
polynomial_t conjunction(const polynomial_t &l, const expression_t &r)
The split-product of l with r.
auto & as()
Extract wrapped typed value.
weightset_mixin< detail::polynomialset_impl< Context, Kind >> polynomialset
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
VCSN_RAT_VISIT(lweight, e)
value_impl< detail::expression_tag > expression
polynomial_t operator()(const expression_t &v)
Break an expression into a polynomial.
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
polynomial_t product(const polynomial_t &l, const expression_t &r)
The split-product of l with r.
labelset_t_of< context_t > labelset_t
auto label_of(const welement< Label, Weight > &m) -> decltype(m.label())
The label of a welement.
value_impl< detail::polynomial_tag > polynomial
typename expressionset_t::const_visitor super_t
polynomial_t res_
The result.
typename expressionset_t::value_t expression_t
Break a rational expression into a polynomial.