17 #ifndef AWALI_ALGOS_EXP_COPY_HH 
   18 # define AWALI_ALGOS_EXP_COPY_HH 
   24 namespace awali { 
namespace sttc {
 
   30     template <
typename RatExpSet,
 
   31               typename Weightset = weightset_t_of<RatExpSet>>
 
   33       : 
public RatExpSet::const_visitor
 
   44       using ratexp_t = 
typename in_ratexpset_t::ratexp_t;
 
   49       constexpr 
static const char* 
me() { 
return "exp copy"; }
 
   52         : out_weightset_ (out_weightset),
 
   65   res_ = out_ratexpset_.zero();
 
   70   res_ = out_ratexpset_.one();
 
   75   res_ = out_ratexpset_.atom(e.value());
 
   80   auto r = out_ratexpset_.zero(); 
 
   84       r = out_ratexpset_.add(
r, res_);
 
   97   auto r = out_ratexpset_.one();  
 
  101       r = out_ratexpset_.
mul(
r, res_);
 
  108         e.sub()->accept(*
this);
 
  109   res_ = out_ratexpset_.star(res_);
 
  114         e.sub()->accept(*
this);
 
  115   res_ = out_ratexpset_.maybe(res_);
 
  120         e.sub()->accept(*
this);
 
  121   res_ = out_ratexpset_.plus(res_);
 
  126         e.sub()->accept(*
this);
 
  127   res_ = out_ratexpset_.lmul(out_weightset_.conv(in_weightset_, e.weight()), res_);
 
  132         e.sub()->accept(*
this);
 
  133   res_ = out_ratexpset_.rmul(res_, out_weightset_.conv(in_weightset_, e.weight()));
 
  137   return out_ratexpset_;
 
  144       out_ratexpset_t out_ratexpset_{out_context_, in_ratexpset_.identities()};
 
  146       typename out_ratexpset_t::ratexp_t res_;
 
  164     template <
typename OutWeightSet,
 
  170     const OutWeightSet& out_weightset = OutWeightSet() )
 
  186   template <
typename RatExpSet>
 
  195                           template <
typename OutWeightSet,
 
  207         const OutWeightSet& out_weightset = OutWeightSet())
 
  211     return copyer.get_ratexpset();
 
The semiring of complex numbers.
Definition: c.hh:44
 
const labelset_ptr & labelset() const
Definition: context.hh:152
 
The semiring of floating Numbers.
Definition: r.hh:35
 
Definition: ratexp.hh:280
 
Definition: ratexp.hh:262
 
Definition: exp_copy.hh:34
 
RatExpSet in_ratexpset_t
Definition: exp_copy.hh:36
 
AWALI_RAT_VISIT(zero,)
Definition: exp_copy.hh:63
 
typename in_ratexpset_t::ratexp_t ratexp_t
Definition: exp_copy.hh:44
 
context< labelset_t, out_weightset_t > out_context_t
Definition: exp_copy.hh:42
 
ratexpset_of< out_context_t > out_ratexpset_t
Definition: exp_copy.hh:43
 
constexpr static const char * me()
Definition: exp_copy.hh:49
 
weightset_t_of< in_context_t > in_weightset_t
Definition: exp_copy.hh:38
 
labelset_t_of< in_context_t > labelset_t
Definition: exp_copy.hh:39
 
expcopy_visitor(const in_ratexpset_t &ratexpset, const out_weightset_t &out_weightset)
Definition: exp_copy.hh:51
 
AWALI_RAT_VISIT(sum, e)
Definition: exp_copy.hh:78
 
typename out_ratexpset_t::ratexp_t out_ratexp_t
Definition: exp_copy.hh:45
 
context_t_of< in_ratexpset_t > in_context_t
Definition: exp_copy.hh:37
 
out_ratexp_t operator()(const ratexp_t &v)
Definition: exp_copy.hh:57
 
AWALI_RAT_VISIT(atom, e)
Definition: exp_copy.hh:73
 
AWALI_RAT_VISIT(lweight, e)
Definition: exp_copy.hh:124
 
AWALI_RAT_VISIT(rweight, e)
Definition: exp_copy.hh:130
 
AWALI_RAT_VISIT(one,)
Definition: exp_copy.hh:68
 
AWALI_RAT_VISIT(maybe, e)
Definition: exp_copy.hh:112
 
typename RatExpSet::const_visitor super_type
Definition: exp_copy.hh:47
 
AWALI_RAT_VISIT(star, e)
Definition: exp_copy.hh:106
 
Weightset out_weightset_t
Definition: exp_copy.hh:41
 
AWALI_RAT_VISIT(plus, e)
Definition: exp_copy.hh:118
 
out_ratexpset_t get_ratexpset()
Definition: exp_copy.hh:136
 
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_mul_mixin< rat::ratexpset_impl< Context > > ratexpset
Definition: fwd.hh:192
 
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
 
typename internal::labelset_t_of_impl< internal::base_t< ValueSet > >::type labelset_t_of
Helper to retrieve the type of the labelset of a value set.
Definition: traits.hh:76
 
auto promote_ratexpset(const RatExpSet &ratexpset, const OutWeightSet &out_weightset=OutWeightSet()) -> typename rat::expcopy_visitor< RatExpSet, OutWeightSet >::out_ratexpset_t
Compute a derived ratexpset.
Definition: exp_copy.hh:206
 
auto ratexp_copy(const typename RatExpSet::ratexp_t &exp, const RatExpSet &ratexpset, const OutWeightSet &out_weightset=OutWeightSet()) -> typename rat::expcopy_visitor< RatExpSet, OutWeightSet >::out_ratexp_t
copy a rational expression
Definition: exp_copy.hh:168
 
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
 
Provide a variadic mul on top of a binary mul(), and one().
Definition: weightset.hh:38
 
value_t mul(const Ts &... ts) const
Definition: weightset.hh:49
 
#define AWALI_RAT_UNSUPPORTED(Type)
Definition: visitor.hh:75