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())};
static constexpr const char * me()
Name of this algorithm, for error messages.
weight_t operator()(const tuple_t &v)
Entry point.
VCSN_RAT_VISIT(infiltrate, v)
value_impl< detail::weight_tag > weight
void visit(const tuple_t &v, std::true_type) override
VCSN_RAT_VISIT(shuffle, v)
An inner node implementing a weight.
typename super_t::tuple_t tuple_t
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
VCSN_RAT_UNSUPPORTED(ldivide)
y`, yet both operands have a null constant-term.
typename expressionset_t::value_t expression_t
weight_t work_(const tuple_t &v, detail::index_sequence< I... >)
Product of the constant-terms of all tapes.
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
typename expressionset_t::const_visitor super_t
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
weight_t_of< ExpSet > constant_term(const ExpSet &rs, const typename ExpSet::value_t &e)
The constant term of e.
#define BUILTIN_UNREACHABLE()
An inner node with multiple children.
void visit_product(const Node &v)
Visit a variadic node whose constant-term is the product of the constant-terms of its children...
weightset_t_of< expressionset_t > weightset_t
auto & as()
Extract wrapped typed value.
VCSN_RAT_VISIT(rweight, v)
weight_t work_(const tuple_t &v)
Constant term for one tape.
weight_t operator()(const expression_t &v)
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
value_impl< detail::expression_tag > expression
VCSN_RAT_VISIT(lweight, v)
A functor to compute the constant term of an expression.
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
weight constant_term(const expression &exp)
Bridge.
std::string to_string(identities i)
Wrapper around operator<<.
weight_t operator()(const tuple_t &)
VCSN_RAT_VISIT(conjunction, v)
constant_term_visitor(const expressionset_t &rs)
VCSN_RAT_VISIT(transposition, v)