17 #ifndef AWALI_ALGOS_EXPAND_HH 
   18 # define AWALI_ALGOS_EXPAND_HH 
   25 namespace awali { 
namespace sttc {
 
   36     template <
typename RatExpSet>
 
   38       : 
public RatExpSet::const_visitor
 
   42       using ratexp_t = 
typename ratexpset_t::value_t;
 
   45       using weight_t = 
typename weightset_t::value_t;
 
   52       constexpr 
static const char* 
me() { 
return "expand"; }
 
   69         for (
const auto& m: p)
 
   70           res = rs_.add(res, rs_.lmul(m.second, m.first));
 
  101         res_ = std::move(res);
 
  106         auto res = 
expand(v.head());
 
  107         for (
auto c: v.tail())
 
  110             for (
const auto& l: res)
 
  113                              rs_.conjunction(l.first, 
r.first),
 
  114                              ws_.mul(l.second, 
r.second));
 
  117         res_ = std::move(res);
 
  130         res_ = std::move(res);
 
  136         v.sub()->accept(*
this);
 
  142         v.sub()->accept(*
this);
 
  143         res_ = ps_.
lmul(v.weight(), std::move(res_));
 
  148         v.sub()->accept(*
this);
 
  149         res_ = ps_.
rmul(std::move(res_), v.weight());
 
  165   template <
typename RatExpSet>
 
  166   typename RatExpSet::value_t
 
  167   expand(
const RatExpSet& rs, 
const typename RatExpSet::value_t& e)
 
The semiring of complex numbers.
Definition: c.hh:44
 
Linear combination of labels: map labels to weights.
Definition: polynomialset.hh:69
 
value_t mul(const value_t &l, const value_t &r) const
The product of polynomials l and r.
Definition: polynomialset.hh:192
 
const value_t & one() const
Definition: polynomialset.hh:327
 
std::map< label_t, weight_t, internal::less< labelset_t > > value_t
Definition: polynomialset.hh:83
 
value_t & add_here(value_t &v, const value_t &p) const
v += p.
Definition: polynomialset.hh:130
 
value_t add(const value_t &l, const value_t &r) const
The sum of polynomials l and r.
Definition: polynomialset.hh:182
 
const value_t & zero() const
Definition: polynomialset.hh:353
 
value_t rmul(const value_t &v, const weight_t &w) const
Right exterior product.
Definition: polynomialset.hh:266
 
value_t lmul(const weight_t &w, const value_t &v) const
Left exterior product.
Definition: polynomialset.hh:241
 
The semiring of floating Numbers.
Definition: r.hh:35
 
Definition: ratexp.hh:280
 
Definition: ratexp.hh:262
 
ratexp_polynomialset_t< ratexpset_t > polynomialset_t
Definition: expand.hh:47
 
expand_visitor(const ratexpset_t &rs)
Definition: expand.hh:54
 
polynomial_t expand(const ratexp_t &e)
Syntactic sugar: recursive call to this visitor.
Definition: expand.hh:75
 
AWALI_RAT_VISIT(atom, v)
Definition: expand.hh:91
 
typename weightset_t::value_t weight_t
Definition: expand.hh:45
 
typename RatExpSet::const_visitor super_type
Definition: expand.hh:50
 
AWALI_RAT_VISIT(lweight, v)
Definition: expand.hh:140
 
AWALI_RAT_VISIT(zero,)
Definition: expand.hh:81
 
ratexp_t operator()(const ratexp_t &v)
Definition: expand.hh:59
 
RatExpSet ratexpset_t
Definition: expand.hh:41
 
context_t_of< ratexpset_t > context_t
Definition: expand.hh:43
 
AWALI_RAT_VISIT(conjunction, v)
Definition: expand.hh:104
 
weightset_t_of< ratexpset_t > weightset_t
Definition: expand.hh:44
 
typename polynomialset_t::value_t polynomial_t
Definition: expand.hh:48
 
AWALI_RAT_VISIT(star, v)
Definition: expand.hh:133
 
AWALI_RAT_VISIT(rweight, v)
Definition: expand.hh:146
 
AWALI_RAT_VISIT(sum, v)
Definition: expand.hh:96
 
AWALI_RAT_VISIT(one,)
Definition: expand.hh:86
 
ratexp_t ratexp(const polynomial_t p)
Definition: expand.hh:66
 
typename ratexpset_t::value_t ratexp_t
Definition: expand.hh:42
 
constexpr static const char * me()
Definition: expand.hh:52
 
Definition: ratexp.hh:176
 
An inner node with multiple children.
Definition: ratexp.hh:115
 
An inner node implementing a weight.
Definition: ratexp.hh:208
 
variadic< type_t::sum, Label, Weight > sum
Definition: fwd.hh:154
 
ratexp_polynomialset_t< RatExpSet > make_ratexp_polynomialset(const RatExpSet &rs)
From a RatExpSet to its polynomialset.
Definition: split.hh:48
 
typename internal::context_t_of_impl< internal::base_t< ValueSet > >::type context_t_of
Helper to retrieve the type of the context of a value set.
Definition: traits.hh:66
 
RatExpSet::value_t expand(const RatExpSet &rs, const typename RatExpSet::value_t &e)
Expanding a typed ratexp shared_ptr.
Definition: expand.hh:167
 
typename internal::weightset_t_of_impl< internal::base_t< ValueSet > >::type weightset_t_of
Helper to retrieve the type of the weightset of a value set.
Definition: traits.hh:86
 
Main namespace of Awali.
Definition: ato.hh:22
 
#define AWALI_RAT_UNSUPPORTED(Type)
Definition: visitor.hh:73