Vcsn  2.8
Be Rational
vcsn::rat::to_expansion_visitor< ExpSet > Class Template Reference

Functor to compute the expansion of an expression. More...

#include <to-expansion.hh>

Inheritance diagram for vcsn::rat::to_expansion_visitor< ExpSet >:
Collaboration diagram for vcsn::rat::to_expansion_visitor< ExpSet >:

Classes

struct  visit_tuple
 
struct  visit_tuple< false, Dummy >
 

Public Types

using expressionset_t = ExpSet
 
using super_t = typename expressionset_t::const_visitor
 
using self_t = to_expansion_visitor
 
using context_t = context_t_of< expressionset_t >
 
using labelset_t = labelset_t_of< context_t >
 
using expression_t = typename expressionset_t::value_t
 
using weightset_t = weightset_t_of< expressionset_t >
 
using weight_t = typename weightset_t::value_t
 
using expansionset_t = expansionset< expressionset_t >
 
using polynomialset_t = expression_polynomialset_t< expressionset_t >
 
using polynomial_t = typename polynomialset_t::value_t
 
using polys_t = typename expansionset_t::polys_t
 
using expansion_t = typename expansionset_t::value_t
 

Public Member Functions

 to_expansion_visitor (const expressionset_t &rs)
 
expansion_t operator() (const expression_t &v)
 From an expression, build its expansion. More...
 

Static Public Member Functions

static constexpr const charme ()
 

Private Types

using tuple_t = typename super_t::tuple_t
 

Private Member Functions

expansion_t to_expansion (const expression_t &e)
 Facilitate recursion. More...
 
std::ostream & print_ (const expansion_t &v, std::ostream &o=std::cerr) const
 Print an expansion. More...
 
expression_t me (expression_t res) const
 Find if an expression is named. More...
 
 VCSN_RAT_VISIT (name, e)
 When we find that an expression is named, record named -> naming, so that when we need named, we actually use naming. More...
 
 VCSN_RAT_VISIT (zero,)
 
 VCSN_RAT_VISIT (one,)
 
 VCSN_RAT_VISIT (atom, e)
 
 VCSN_RAT_VISIT (add, e)
 
 VCSN_RAT_VISIT (mul, e)
 
expression_t prod_ (typename mul_t::iterator begin, typename mul_t::iterator end) const
 Build a product for these expressions. More...
 
 VCSN_RAT_VISIT (ldivide, e)
 
 VCSN_RAT_VISIT (conjunction, e)
 d(E&F) = d(E) & d(F). More...
 
 VCSN_RAT_VISIT (shuffle, e)
 d(E:F) = d(E):F + E:d(F) dᵗ(E:F) = dᵗ(E):Fᵗ + Eᵗ:dᵗ(F) More...
 
 VCSN_RAT_VISIT (infiltrate, e)
 d(E&:F) = d(E)&:F + d(E)&:d(F) + E&:d(F) dᵗ(E&:F) = dᵗ(E)&:Fᵗ + dᵗ(E)&:dᵗ(F) + Eᵗ&:dᵗ(F) More...
 
 VCSN_RAT_VISIT (complement, e)
 
 VCSN_RAT_VISIT (transposition, e)
 d(Eᵗ) = dᵗ(E) More...
 
 VCSN_RAT_VISIT (star, e)
 If E is normal, d(E*) = <c(E)*> + <c(E)*> dp(E) E*. More...
 
 VCSN_RAT_VISIT (lweight, e)
 
 VCSN_RAT_VISIT (rweight, e)
 
void visit (const tuple_t &v, std::true_type) override
 
 VCSN_RAT_VISIT (compose, e)
 
template<typename Exp = expansion_t>
auto compose (const compose_t &e, int) -> decltype(std::declval< expansionset_t >() .compose(std::declval< Exp >(), std::declval< Exp >()), void())
 
auto compose (const compose_t &, long) -> void
 

Private Attributes

expressionset_t rs_
 Manipulate the expressions. More...
 
labelset_t ls_ = *rs_.labelset()
 Manipulate the labels. More...
 
weightset_t ws_ = *rs_.weightset()
 Manipulate the weights. More...
 
polynomialset_t ps_ = make_expression_polynomialset(rs_)
 Manipulate the polynomials of expressions. More...
 
expansionset_t xs_ = {rs_}
 Manipulate the expansions. More...
 
bool transposed_ = false
 Whether to work transposed. More...
 
expansion_t res_ = xs_.zero()
 The result. More...
 
std::map< expression_t, expression_tnames_
 A table from the expression to the naming expression. More...
 

Detailed Description

template<typename ExpSet>
class vcsn::rat::to_expansion_visitor< ExpSet >

Functor to compute the expansion of an expression.

Template Parameters
ExpSetthe expressionset type.

Definition at line 39 of file to-expansion.hh.

Member Typedef Documentation

◆ context_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::context_t = context_t_of<expressionset_t>

Definition at line 47 of file to-expansion.hh.

◆ expansion_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::expansion_t = typename expansionset_t::value_t

Definition at line 60 of file to-expansion.hh.

◆ expansionset_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::expansionset_t = expansionset<expressionset_t>

Definition at line 52 of file to-expansion.hh.

◆ expression_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::expression_t = typename expressionset_t::value_t

Definition at line 49 of file to-expansion.hh.

◆ expressionset_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::expressionset_t = ExpSet

Definition at line 43 of file to-expansion.hh.

◆ labelset_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::labelset_t = labelset_t_of<context_t>

Definition at line 48 of file to-expansion.hh.

◆ polynomial_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::polynomial_t = typename polynomialset_t::value_t

Definition at line 55 of file to-expansion.hh.

◆ polynomialset_t

Definition at line 54 of file to-expansion.hh.

◆ polys_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::polys_t = typename expansionset_t::polys_t

Definition at line 59 of file to-expansion.hh.

◆ self_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::self_t = to_expansion_visitor

Definition at line 45 of file to-expansion.hh.

◆ super_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::super_t = typename expressionset_t::const_visitor

Definition at line 44 of file to-expansion.hh.

◆ tuple_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::tuple_t = typename super_t::tuple_t
private

Definition at line 391 of file to-expansion.hh.

◆ weight_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::weight_t = typename weightset_t::value_t

Definition at line 51 of file to-expansion.hh.

◆ weightset_t

template<typename ExpSet>
using vcsn::rat::to_expansion_visitor< ExpSet >::weightset_t = weightset_t_of<expressionset_t>

Definition at line 50 of file to-expansion.hh.

Constructor & Destructor Documentation

◆ to_expansion_visitor()

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::to_expansion_visitor ( const expressionset_t rs)
inline

Definition at line 62 of file to-expansion.hh.

Member Function Documentation

◆ compose() [1/2]

template<typename ExpSet>
template<typename Exp = expansion_t>
auto vcsn::rat::to_expansion_visitor< ExpSet >::compose ( const compose_t &  e,
int   
) -> decltype(std::declval<expansionset_t>() .compose(std::declval<Exp>(), std::declval<Exp>()), void())
inlineprivate

◆ compose() [2/2]

template<typename ExpSet>
auto vcsn::rat::to_expansion_visitor< ExpSet >::compose ( const compose_t &  ,
long   
) -> void
inlineprivate

Definition at line 446 of file to-expansion.hh.

◆ me() [1/2]

template<typename ExpSet>
static constexpr const char* vcsn::rat::to_expansion_visitor< ExpSet >::me ( )
inlinestatic

◆ me() [2/2]

template<typename ExpSet>
expression_t vcsn::rat::to_expansion_visitor< ExpSet >::me ( expression_t  res) const
inlineprivate

Find if an expression is named.

Definition at line 138 of file to-expansion.hh.

◆ operator()()

template<typename ExpSet>
expansion_t vcsn::rat::to_expansion_visitor< ExpSet >::operator() ( const expression_t v)
inline

From an expression, build its expansion.

Definition at line 67 of file to-expansion.hh.

◆ print_()

template<typename ExpSet>
std::ostream& vcsn::rat::to_expansion_visitor< ExpSet >::print_ ( const expansion_t v,
std::ostream &  o = std::cerr 
) const
inlineprivate

Print an expansion.

Definition at line 129 of file to-expansion.hh.

Referenced by vcsn::rat::to_expansion_visitor< expressionset_t >::operator()().

◆ prod_()

template<typename ExpSet>
expression_t vcsn::rat::to_expansion_visitor< ExpSet >::prod_ ( typename mul_t::iterator  begin,
typename mul_t::iterator  end 
) const
inlineprivate

Build a product for these expressions.

Pay attention to not building products with 0 or 1 expression.

FIXME: Code duplication with derivation.

Definition at line 257 of file to-expansion.hh.

Referenced by vcsn::rat::to_expansion_visitor< expressionset_t >::VCSN_RAT_VISIT().

◆ to_expansion()

◆ VCSN_RAT_VISIT() [1/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( name  ,
 
)
inlineprivate

When we find that an expression is named, record named -> naming, so that when we need named, we actually use naming.

That's what the function me does.

Definition at line 155 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [2/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( zero  )
inlineprivate

Definition at line 163 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [3/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( one  )
inlineprivate

Definition at line 168 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [4/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( atom  ,
 
)
inlineprivate

Definition at line 173 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [5/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( add  ,
 
)
inlineprivate

Definition at line 180 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [6/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( mul  ,
 
)
inlineprivate

Definition at line 187 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [7/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( ldivide  ,
 
)
inlineprivate

Definition at line 268 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [8/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( conjunction  ,
 
)
inlineprivate

d(E&F) = d(E) & d(F).

Definition at line 282 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [9/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( shuffle  ,
 
)
inlineprivate

d(E:F) = d(E):F + E:d(F) dᵗ(E:F) = dᵗ(E):Fᵗ + Eᵗ:dᵗ(F)

Definition at line 291 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [10/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( infiltrate  ,
 
)
inlineprivate

d(E&:F) = d(E)&:F + d(E)&:d(F) + E&:d(F) dᵗ(E&:F) = dᵗ(E)&:Fᵗ + dᵗ(E)&:dᵗ(F) + Eᵗ&:dᵗ(F)

Definition at line 309 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [11/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( complement  ,
 
)
inlineprivate

Definition at line 327 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [12/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( transposition  ,
 
)
inlineprivate

d(Eᵗ) = dᵗ(E)

Definition at line 333 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [13/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( star  ,
 
)
inlineprivate

If E is normal, d(E*) = <c(E)*> + <c(E)*> dp(E) E*.

otherwise d(E*) = 1 + d(E) E*.

Definition at line 342 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [14/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( lweight  ,
 
)
inlineprivate

Definition at line 371 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [15/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( rweight  ,
 
)
inlineprivate

Definition at line 381 of file to-expansion.hh.

◆ VCSN_RAT_VISIT() [16/16]

template<typename ExpSet>
vcsn::rat::to_expansion_visitor< ExpSet >::VCSN_RAT_VISIT ( compose  ,
 
)
inlineprivate

Definition at line 430 of file to-expansion.hh.

◆ visit()

template<typename ExpSet>
void vcsn::rat::to_expansion_visitor< ExpSet >::visit ( const tuple_t v,
std::true_type   
)
inlineoverrideprivate

Definition at line 424 of file to-expansion.hh.

Member Data Documentation

◆ ls_

template<typename ExpSet>
labelset_t vcsn::rat::to_expansion_visitor< ExpSet >::ls_ = *rs_.labelset()
private

Manipulate the labels.

Definition at line 456 of file to-expansion.hh.

Referenced by vcsn::rat::to_expansion_visitor< expressionset_t >::VCSN_RAT_VISIT().

◆ names_

template<typename ExpSet>
std::map<expression_t, expression_t> vcsn::rat::to_expansion_visitor< ExpSet >::names_
private

A table from the expression to the naming expression.

Definition at line 469 of file to-expansion.hh.

Referenced by vcsn::rat::to_expansion_visitor< expressionset_t >::me(), and vcsn::rat::to_expansion_visitor< expressionset_t >::VCSN_RAT_VISIT().

◆ ps_

template<typename ExpSet>
polynomialset_t vcsn::rat::to_expansion_visitor< ExpSet >::ps_ = make_expression_polynomialset(rs_)
private

Manipulate the polynomials of expressions.

Definition at line 460 of file to-expansion.hh.

Referenced by vcsn::rat::to_expansion_visitor< expressionset_t >::VCSN_RAT_VISIT().

◆ res_

◆ rs_

◆ transposed_

template<typename ExpSet>
bool vcsn::rat::to_expansion_visitor< ExpSet >::transposed_ = false
private

◆ ws_

template<typename ExpSet>
weightset_t vcsn::rat::to_expansion_visitor< ExpSet >::ws_ = *rs_.weightset()
private

Manipulate the weights.

Definition at line 458 of file to-expansion.hh.

Referenced by vcsn::rat::to_expansion_visitor< expressionset_t >::VCSN_RAT_VISIT().

◆ xs_


The documentation for this class was generated from the following file: