13 template <
typename ExpSet>
27 template <
typename ExpSet>
29 :
public ExpSet::const_visitor
33 using super_t =
typename expressionset_t::const_visitor;
42 constexpr
static const char*
me() {
return "constant_term"; }
55 catch (
const std::runtime_error& e)
57 raise(e,
" while computing constant-term of: ",
to_string(
rs_, v));
67 return std::move(
res_);
90 res_ = std::move(res);
95 template <
typename Node>
101 res_ = std::move(res);
152 template <
bool = context_t::is_lat,
153 typename Dummy =
void>
161 std::get<I>(v.sub()));
165 template <
size_t... I>
179 template <
typename Dummy>
201 template <
typename ExpSet>
214 template <
typename ExpSet>
218 const auto& e = exp->
as<ExpSet>();
219 return {*e.valueset().weightset(),
220 constant_term<ExpSet>(e.valueset(), e.value())};
value_impl< detail::weight_tag > weight
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
static constexpr const char * me()
Name of this algorithm, for error messages.
#define BUILTIN_UNREACHABLE()
VCSN_RAT_VISIT(infiltrate, v)
void visit(const tuple_t &v, std::true_type) override
VCSN_RAT_VISIT(shuffle, v)
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
typename super_t::tuple_t tuple_t
An inner node implementing a weight.
weight_t operator()(const tuple_t &)
VCSN_RAT_UNSUPPORTED(ldivide)
y, yet both operands have a null constant-term.
typename expressionset_t::value_t expression_t
weight_t constant_term(const expression_t &v)
Easy recursion.
context_t_of< expressionset_t > context_t
VCSN_RAT_VISIT(complement, v)
weight_t_of< expressionset_t > weight_t
weight constant_term(const expression &exp)
Bridge.
typename expressionset_t::const_visitor super_t
weight_t operator()(const tuple_t &v)
Entry point.
void visit_product(const Node &v)
Visit a variadic node whose constant-term is the product of the constant-terms of its children...
std::string to_string(identities i)
Wrapper around operator<<.
weightset_t_of< expressionset_t > weightset_t
VCSN_RAT_VISIT(rweight, v)
weight_t operator()(const expression_t &v)
VCSN_RAT_VISIT(lweight, v)
auto & as()
Extract wrapped typed value.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
A functor to compute the constant term of an expression.
An inner node with multiple children.
weight_t work_(const tuple_t &v, detail::index_sequence< I... >)
Product of the constant-terms of all tapes.
weight_t_of< ExpSet > constant_term(const ExpSet &rs, const typename ExpSet::value_t &e)
The constant term of e.
value_impl< detail::expression_tag > expression
VCSN_RAT_VISIT(conjunction, v)
weight_t work_(const tuple_t &v)
Constant term for one tape.
constant_term_visitor(const expressionset_t &rs)
VCSN_RAT_VISIT(transposition, v)