Vcsn  2.5.dev
Be Rational
vcsn::rat::expansionset< ExpSet > Struct Template Reference

#include <expansionset.hh>

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

Classes

struct  tuple_impl
 Denormalize a pack of one-tape expansions. More...
 
struct  value_t
 An expansion. More...
 

Public Types

using expressionset_t = ExpSet
 
using self_t = expansionset
 
using context_t = context_t_of< expressionset_t >
 
using labelset_t = labelset_t_of< context_t >
 
using label_t = label_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 polynomialset_t = expression_polynomialset_t< expressionset_t >
 
using polynomial_t = typename polynomialset_t::value_t
 
using monomial_t = typename polynomialset_t::monomial_t
 
using polys_t = std::map< label_t, polynomial_t, vcsn::less< labelset_t > >
 
template<unsigned Tape>
using project_t = expansionset< typename expressionset_t::template project_t< Tape > >
 The type of the expansionset for tape Tape. More...
 

Public Member Functions

 expansionset (const expressionset_t &rs)
 
const expressionset_texpressionset () const
 The expressionset. More...
 
const polynomialset_tpolynomialset () const
 The polynomialset. More...
 
const context_tcontext () const
 The context. More...
 
std::ostream & print_set (std::ostream &o, format fmt={}) const
 Print this valueset. More...
 
std::ostream & print (const value_t &v, std::ostream &o=std::cout, format fmt={}) const
 Print this expansion. More...
 
bool is_normal (const value_t &x) const
 Whether an expansion is normal. More...
 
value_tnormalize (value_t &res) const
 Normalize: eliminate null polynomials and move the constant term from the label one. More...
 
value_tnormalize_ (value_t &res, std::true_type) const
 Normalize res. More...
 
value_tnormalize_ (value_t &res, std::false_type) const
 Normalize when there is no label one: identity. More...
 
value_tdenormalize (value_t &res) const
 Move the constant to the polynomial associated to one. More...
 
value_tdenormalize_ (value_t &res, std::true_type) const
 Denormalize res move the constant to the polynomial associated to one. More...
 
value_tdenormalize_ (value_t &res, std::false_type) const
 Denormalize when there is no label one: identity. More...
 
template<typename OtherExpSet >
value_t conv (const expansionset< OtherExpSet > &other, const typename expansionset< OtherExpSet >::value_t &v) const
 Convert from another expansionset to self. More...
 
value_t zero () const
 The zero. More...
 
value_t one () const
 The one. More...
 
value_t atom (const label_t &l) const
 A single label. More...
 
void add_here (value_t &lhs, const value_t &rhs) const
 In place addition. More...
 
value_t add (value_t res, const value_t &rhs) const
 Addition. More...
 
value_t lweight (const weight_t &w, value_t res) const
 Left-multiplication by w of rhs. More...
 
value_tlweight_here (const weight_t &w, value_t &res) const
 Inplace left-multiplication by w of res. More...
 
value_t rweight (const value_t &lhs, const weight_t &w) const
 Right-multiplication of lhs by w. More...
 
value_trmul_label_here (value_t &res, const expression_t &rhs) const
 In place right multiplication by an expression. More...
 
value_tldivide_here (const weight_t &w, value_t &res) const
 Inplace left-division by w of res. More...
 
value_t conjunction (const value_t &l, const value_t &r) const
 The conjunction of l and r. More...
 
value_t shuffle (const value_t &de, const expression_t &e, const value_t &df, const expression_t &f) const
 The shuffle product of de and df. More...
 
value_t infiltrate (const value_t &de, const expression_t &e, const value_t &df, const expression_t &f) const
 The infiltration product of l and r. More...
 
value_t complement (const value_t &v) const
 The complement of v. More...
 
value_t transpose (const value_t &v) const
 Transpose an expansion. The firsts must be reduced to one. More...
 
value_t ldivide (value_t lhs, value_t rhs) const
 
value_t determinize (const value_t &v) const
 Turn the polynomials into (normalized) monomials. More...
 
template<unsigned Tape>
auto project () const -> project_t< Tape >
 The expansionset for tape Tape. More...
 
template<typename... Expansions>
auto tuple (Expansions &&... es) const -> value_t
 The tuplization of single-tape expansions into a multitape expansion. More...
 
template<size_t Tape>
auto project (const value_t &v) const
 Project a multitape expansion. More...
 
void compose_with_one_ (value_t &, const value_t &, const value_t &, std::false_type) const
 
void compose_with_one_ (value_t &res, const value_t &l, const value_t &r, std::true_type) const
 
void compose_with_one_old_ (value_t &res, const value_t &l, const value_t &r) const
 
void compose_with_one_new_ (value_t &res, const value_t &l, const value_t &r) const
 
template<typename Ctx = context_t>
auto compose (value_t l, value_t r) const -> std::enable_if_t< are_composable< Ctx, Ctx >() &&number_of_tapes< Ctx >::value==2, value_t >
 The composition of l and r. More...
 

Static Public Member Functions

static constexpr const charme ()
 
static symbol sname ()
 The static name. More...
 
static value_t conv (self_t, const value_t &v)
 Conversion from (this and) other weightsets. More...
 

Private Member Functions

template<typename Conjunction >
void conjunctions_with_one_ (value_t &, const value_t &, const value_t &, std::false_type, Conjunction) const
 
template<typename Conjunction >
void conjunctions_with_one_ (value_t &res, const value_t &l, const value_t &r, std::true_type, Conjunction conjunction) const
 
template<typename LabelSet = labelset_t, typename Conjunction >
auto conjunction_ (value_t l, value_t r, Conjunction conjunction) const -> std::enable_if_t< detail::is_letterized_t< LabelSet >
 The conjunction of l and r. More...
 
 denormalize (r)
 
 for (const auto &p:zip_maps(l.polynomials, r.polynomials)) res.polynomials[p.first]
 
 conjunctions_with_one_ (res, l, r, has_one, conjunction)
 
 normalize (res)
 
template<typename LabelSet = labelset_t, typename Conjunction >
auto conjunction_ (const value_t &lhs, const value_t &rhs, Conjunction conjunction) const -> std::enable_if_t<!detail::is_letterized_t< LabelSet >
 The conjunction of l and r. More...
 
 for (const auto &l:lhs.polynomials) for(const auto &r
 
 normalize (res)
 
template<typename Shuffle >
value_tshuffle_ (value_t &res, const value_t &lhs_xpn, const expression_t &lhs_xpr, const value_t &rhs_xpn, const expression_t &rhs_xpr, Shuffle shuffle) const
 The shuffle product of l and r. More...
 
template<bool IsLetterized>
std::enable_if_t<!IsLetterized, value_tcomplement_ (const value_t &) const
 Complement on an invalid labelset. More...
 
template<bool IsLetterized>
std::enable_if_t< IsLetterized, value_tcomplement_ (const value_t &v) const
 Complement on a letterized labelset. More...
 

Private Attributes

 value_t
 
auto res = value_t{ws_.mul(l.constant, r.constant)}
 
auto has_one = bool_constant<context_t::has_one()>()
 
return res
 
expressionset_t rs_
 The expressionset used for the expressions. More...
 
const labelset_tls_ = *rs_.labelset()
 Shorthand to the labelset. More...
 
const weightset_tws_ = *rs_.weightset()
 Shorthand to the weightset. More...
 
polynomialset_t ps_ = make_expression_polynomialset(rs_)
 The polynomialset for the polynomials. More...
 
bool old_way_ = !!getenv("VCSN_OLDWAY")
 Whether to running the old composition code. More...
 
bool denorm_ = old_way_ || !!getenv("VCSN_DENORM")
 Denormalize if requested explicitly, or if running the old way. More...
 

Detailed Description

template<typename ExpSet>
struct vcsn::rat::expansionset< ExpSet >

Definition at line 21 of file expansionset.hh.

Member Typedef Documentation

◆ context_t

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

Definition at line 26 of file expansionset.hh.

◆ expression_t

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

Definition at line 29 of file expansionset.hh.

◆ expressionset_t

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

Definition at line 24 of file expansionset.hh.

◆ label_t

template<typename ExpSet>
using vcsn::rat::expansionset< ExpSet >::label_t = label_t_of<context_t>

Definition at line 28 of file expansionset.hh.

◆ labelset_t

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

Definition at line 27 of file expansionset.hh.

◆ monomial_t

template<typename ExpSet>
using vcsn::rat::expansionset< ExpSet >::monomial_t = typename polynomialset_t::monomial_t

Definition at line 35 of file expansionset.hh.

◆ polynomial_t

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

Definition at line 34 of file expansionset.hh.

◆ polynomialset_t

Definition at line 33 of file expansionset.hh.

◆ polys_t

template<typename ExpSet>
using vcsn::rat::expansionset< ExpSet >::polys_t = std::map<label_t, polynomial_t, vcsn::less<labelset_t> >

Definition at line 42 of file expansionset.hh.

◆ project_t

template<typename ExpSet>
template<unsigned Tape>
using vcsn::rat::expansionset< ExpSet >::project_t = expansionset<typename expressionset_t::template project_t<Tape> >

The type of the expansionset for tape Tape.

Definition at line 641 of file expansionset.hh.

◆ self_t

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

Definition at line 25 of file expansionset.hh.

◆ weight_t

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

Definition at line 31 of file expansionset.hh.

◆ weightset_t

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

Definition at line 30 of file expansionset.hh.

Constructor & Destructor Documentation

◆ expansionset()

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

Definition at line 53 of file expansionset.hh.

Member Function Documentation

◆ add()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::add ( value_t  res,
const value_t rhs 
) const
inline

Addition.

Definition at line 288 of file expansionset.hh.

◆ add_here()

template<typename ExpSet>
void vcsn::rat::expansionset< ExpSet >::add_here ( value_t lhs,
const value_t rhs 
) const
inline

◆ atom()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::atom ( const label_t l) const
inline

A single label.

Definition at line 273 of file expansionset.hh.

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

◆ complement()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::complement ( const value_t v) const
inline

The complement of v.

Definition at line 513 of file expansionset.hh.

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

◆ complement_() [1/2]

template<typename ExpSet>
template<bool IsLetterized>
std::enable_if_t<!IsLetterized, value_t> vcsn::rat::expansionset< ExpSet >::complement_ ( const value_t ) const
inlineprivate

Complement on an invalid labelset.

Definition at line 528 of file expansionset.hh.

◆ complement_() [2/2]

template<typename ExpSet>
template<bool IsLetterized>
std::enable_if_t<IsLetterized, value_t> vcsn::rat::expansionset< ExpSet >::complement_ ( const value_t v) const
inlineprivate

Complement on a letterized labelset.

Definition at line 537 of file expansionset.hh.

◆ compose()

template<typename ExpSet>
template<typename Ctx = context_t>
auto vcsn::rat::expansionset< ExpSet >::compose ( value_t  l,
value_t  r 
) const -> std::enable_if_t<are_composable<Ctx, Ctx>() && number_of_tapes<Ctx>::value == 2, value_t>
inline

The composition of l and r.

Definition at line 909 of file expansionset.hh.

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

◆ compose_with_one_() [1/2]

template<typename ExpSet>
void vcsn::rat::expansionset< ExpSet >::compose_with_one_ ( value_t ,
const value_t ,
const value_t ,
std::false_type   
) const
inline

◆ compose_with_one_() [2/2]

template<typename ExpSet>
void vcsn::rat::expansionset< ExpSet >::compose_with_one_ ( value_t res,
const value_t l,
const value_t r,
std::true_type   
) const
inline

Definition at line 798 of file expansionset.hh.

◆ compose_with_one_new_()

template<typename ExpSet>
void vcsn::rat::expansionset< ExpSet >::compose_with_one_new_ ( value_t res,
const value_t l,
const value_t r 
) const
inline

◆ compose_with_one_old_()

template<typename ExpSet>
void vcsn::rat::expansionset< ExpSet >::compose_with_one_old_ ( value_t res,
const value_t l,
const value_t r 
) const
inline

◆ conjunction()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::conjunction ( const value_t l,
const value_t r 
) const
inline

The conjunction of l and r.

Definition at line 460 of file expansionset.hh.

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

◆ conjunction_() [1/2]

template<typename ExpSet>
template<typename LabelSet = labelset_t, typename Conjunction >
auto vcsn::rat::expansionset< ExpSet >::conjunction_ ( value_t  l,
value_t  r,
Conjunction  conjunction 
) const -> std::enable_if_t<detail::is_letterized_t<LabelSet>
inlineprivate

The conjunction of l and r.

When labelset is letterized.

Definition at line 391 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::conjunction(), and vcsn::rat::expansionset< expressionset_t >::infiltrate().

◆ conjunction_() [2/2]

template<typename ExpSet>
template<typename LabelSet = labelset_t, typename Conjunction >
auto vcsn::rat::expansionset< ExpSet >::conjunction_ ( const value_t lhs,
const value_t rhs,
Conjunction  conjunction 
) const -> std::enable_if_t<!detail::is_letterized_t<LabelSet>
inlineprivate

The conjunction of l and r.

When labelset is not letterized.

Definition at line 413 of file expansionset.hh.

◆ conjunctions_with_one_() [1/3]

template<typename ExpSet>
template<typename Conjunction >
void vcsn::rat::expansionset< ExpSet >::conjunctions_with_one_ ( value_t ,
const value_t ,
const value_t ,
std::false_type  ,
Conjunction   
) const
inlineprivate

Definition at line 349 of file expansionset.hh.

◆ conjunctions_with_one_() [2/3]

template<typename ExpSet>
template<typename Conjunction >
void vcsn::rat::expansionset< ExpSet >::conjunctions_with_one_ ( value_t res,
const value_t l,
const value_t r,
std::true_type  ,
Conjunction  conjunction 
) const
inlineprivate

Definition at line 357 of file expansionset.hh.

◆ conjunctions_with_one_() [3/3]

template<typename ExpSet>
vcsn::rat::expansionset< ExpSet >::conjunctions_with_one_ ( res  ,
,
r  ,
has_one  ,
conjunction   
)
private

◆ context()

template<typename ExpSet>
const context_t& vcsn::rat::expansionset< ExpSet >::context ( ) const
inline

The context.

Definition at line 78 of file expansionset.hh.

◆ conv() [1/2]

template<typename ExpSet>
static value_t vcsn::rat::expansionset< ExpSet >::conv ( self_t  ,
const value_t v 
)
inlinestatic

Conversion from (this and) other weightsets.

Definition at line 243 of file expansionset.hh.

◆ conv() [2/2]

template<typename ExpSet>
template<typename OtherExpSet >
value_t vcsn::rat::expansionset< ExpSet >::conv ( const expansionset< OtherExpSet > &  other,
const typename expansionset< OtherExpSet >::value_t v 
) const
inline

Convert from another expansionset to self.

Definition at line 251 of file expansionset.hh.

◆ denormalize() [1/2]

template<typename ExpSet>
value_t& vcsn::rat::expansionset< ExpSet >::denormalize ( value_t res) const
inline

Move the constant to the polynomial associated to one.

Note that this should be named maybe_denormalize, as if the labelset has no one, the input argument is returned unmodified. In particular, be sure to use the constant term of the result, even if in typically cases it is expected to be zero.

Definition at line 211 of file expansionset.hh.

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

◆ denormalize() [2/2]

template<typename ExpSet>
vcsn::rat::expansionset< ExpSet >::denormalize ( r  )
private

◆ denormalize_() [1/2]

template<typename ExpSet>
value_t& vcsn::rat::expansionset< ExpSet >::denormalize_ ( value_t res,
std::true_type   
) const
inline

Denormalize res move the constant to the polynomial associated to one.

Definition at line 219 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::denormalize().

◆ denormalize_() [2/2]

template<typename ExpSet>
value_t& vcsn::rat::expansionset< ExpSet >::denormalize_ ( value_t res,
std::false_type   
) const
inline

Denormalize when there is no label one: identity.

Definition at line 232 of file expansionset.hh.

◆ determinize()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::determinize ( const value_t v) const
inline

Turn the polynomials into (normalized) monomials.

Definition at line 626 of file expansionset.hh.

◆ expressionset()

template<typename ExpSet>
const expressionset_t& vcsn::rat::expansionset< ExpSet >::expressionset ( ) const
inline

The expressionset.

Definition at line 66 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::conv(), and vcsn::join_weightset_expansionset().

◆ for() [1/2]

template<typename ExpSet>
vcsn::rat::expansionset< ExpSet >::for ( const auto &  p:zip_mapsl.polynomials, r.polynomials)
private

◆ for() [2/2]

template<typename ExpSet>
vcsn::rat::expansionset< ExpSet >::for ( const auto &l:lhs.  polynomials) const &
inlineprivate

Definition at line 419 of file expansionset.hh.

◆ infiltrate()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::infiltrate ( const value_t de,
const expression_t e,
const value_t df,
const expression_t f 
) const
inline

The infiltration product of l and r.

Definition at line 486 of file expansionset.hh.

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

◆ is_normal()

template<typename ExpSet>
bool vcsn::rat::expansionset< ExpSet >::is_normal ( const value_t x) const
inline

Whether an expansion is normal.

Definition at line 148 of file expansionset.hh.

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

◆ ldivide()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::ldivide ( value_t  lhs,
value_t  rhs 
) const
inline

◆ ldivide_here()

template<typename ExpSet>
value_t& vcsn::rat::expansionset< ExpSet >::ldivide_here ( const weight_t w,
value_t res 
) const
inline

Inplace left-division by w of res.

Definition at line 337 of file expansionset.hh.

◆ lweight()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::lweight ( const weight_t w,
value_t  res 
) const
inline

Left-multiplication by w of rhs.

Definition at line 295 of file expansionset.hh.

◆ lweight_here()

template<typename ExpSet>
value_t& vcsn::rat::expansionset< ExpSet >::lweight_here ( const weight_t w,
value_t res 
) const
inline

Inplace left-multiplication by w of res.

Definition at line 302 of file expansionset.hh.

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

◆ me()

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

◆ normalize() [1/3]

◆ normalize() [2/3]

template<typename ExpSet>
vcsn::rat::expansionset< ExpSet >::normalize ( res  )
private

◆ normalize() [3/3]

template<typename ExpSet>
vcsn::rat::expansionset< ExpSet >::normalize ( res  )
private

◆ normalize_() [1/2]

template<typename ExpSet>
value_t& vcsn::rat::expansionset< ExpSet >::normalize_ ( value_t res,
std::true_type   
) const
inline

Normalize res.

There must not remain a constant-term associated to one: put it with the constant term of the expansion. I.e., turn ε⊙[⟨w⟩ε + P...] + X_p... into ⟨w⟩ + ε⊙[P...] + X_p....

Definition at line 180 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::normalize().

◆ normalize_() [2/2]

template<typename ExpSet>
value_t& vcsn::rat::expansionset< ExpSet >::normalize_ ( value_t res,
std::false_type   
) const
inline

Normalize when there is no label one: identity.

Definition at line 199 of file expansionset.hh.

◆ one()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::one ( ) const
inline

◆ polynomialset()

template<typename ExpSet>
const polynomialset_t& vcsn::rat::expansionset< ExpSet >::polynomialset ( ) const
inline

The polynomialset.

Definition at line 72 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::conv().

◆ print()

template<typename ExpSet>
std::ostream& vcsn::rat::expansionset< ExpSet >::print ( const value_t v,
std::ostream &  o = std::cout,
format  fmt = {} 
) const
inline

Print this expansion.

Definition at line 112 of file expansionset.hh.

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

◆ print_set()

template<typename ExpSet>
std::ostream& vcsn::rat::expansionset< ExpSet >::print_set ( std::ostream &  o,
format  fmt = {} 
) const
inline

Print this valueset.

Definition at line 84 of file expansionset.hh.

◆ project() [1/2]

template<typename ExpSet>
template<unsigned Tape>
auto vcsn::rat::expansionset< ExpSet >::project ( ) const -> project_t<Tape>
inline

The expansionset for tape Tape.

Definition at line 645 of file expansionset.hh.

◆ project() [2/2]

template<typename ExpSet>
template<size_t Tape>
auto vcsn::rat::expansionset< ExpSet >::project ( const value_t v) const
inline

Project a multitape expansion.

Definition at line 775 of file expansionset.hh.

◆ rmul_label_here()

template<typename ExpSet>
value_t& vcsn::rat::expansionset< ExpSet >::rmul_label_here ( value_t res,
const expression_t rhs 
) const
inline

In place right multiplication by an expression.

Definition at line 328 of file expansionset.hh.

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

◆ rweight()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::rweight ( const value_t lhs,
const weight_t w 
) const
inline

Right-multiplication of lhs by w.

Definition at line 316 of file expansionset.hh.

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

◆ shuffle()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::shuffle ( const value_t de,
const expression_t e,
const value_t df,
const expression_t f 
) const
inline

The shuffle product of de and df.

d(E) : F + E : d(F)

Definition at line 473 of file expansionset.hh.

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

◆ shuffle_()

template<typename ExpSet>
template<typename Shuffle >
value_t& vcsn::rat::expansionset< ExpSet >::shuffle_ ( value_t res,
const value_t lhs_xpn,
const expression_t lhs_xpr,
const value_t rhs_xpn,
const expression_t rhs_xpr,
Shuffle  shuffle 
) const
inlineprivate

The shuffle product of l and r.

Definition at line 439 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::infiltrate(), and vcsn::rat::expansionset< expressionset_t >::shuffle().

◆ sname()

template<typename ExpSet>
static symbol vcsn::rat::expansionset< ExpSet >::sname ( )
inlinestatic

The static name.

Definition at line 58 of file expansionset.hh.

◆ transpose()

template<typename ExpSet>
value_t vcsn::rat::expansionset< ExpSet >::transpose ( const value_t v) const
inline

Transpose an expansion. The firsts must be reduced to one.

Definition at line 571 of file expansionset.hh.

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

◆ tuple()

template<typename ExpSet>
template<typename... Expansions>
auto vcsn::rat::expansionset< ExpSet >::tuple ( Expansions &&...  es) const -> value_t
inline

The tuplization of single-tape expansions into a multitape expansion.

Another implementation is possible, based on the following two-tape example taking e0 and e1, two single-tape expansions:

auto res = value_t{ws_.mul(e0.constant, e1.constant)}; for (const auto& p0: e0.polynomials) for (const auto& p1: e1.polynomials) { auto l = label_t{p0.first, p1.first}; ps_.add_here(res.polynomials[l], ps_.tuple(p0.second, p1.second)); } if (!ws_.is_zero(e0.constant)) { auto rs0 = detail::project<0>(rs_); using p0_t = typename polynomialset_t::template project_t<0>; auto p0 = p0_t{{rs0.one(), e0.constant}}; for (const auto& p1: e1.polynomials) { auto l = label_t{detail::label_one(*rs0.labelset()), p1.first}; ps_.add_here(res.polynomials[l], ps_.tuple(p0, p1.second)); } } if (!ws_.is_zero(e1.constant)) { auto rs1 = detail::project<1>(rs_); using p1_t = typename polynomialset_t::template project_t<1>; auto p1 = p1_t{{rs1.one(), e1.constant}}; for (const auto& p0: e0.polynomials) { auto l = label_t{p0.first, detail::label_one(*rs1.labelset())}; ps_.add_here(res.polynomials[l], ps_.tuple(p0.second, p1)); } } return res;

The first part, the two nested for-loops that deal with the polynomial part of the expansions, is easy to scale to variadic tuples (that's a Cartesian product). The second part, the two if's and loop that deal with the constant terms, is more tricky.

Rather than making the code more complex, since the constant part of the expansions is just the weight of the unit polynomial for the unit label, let's denormalize the expansions, let the general laws apply, and then normalize the result.

Definition at line 766 of file expansionset.hh.

Referenced by vcsn::rat::to_expansion_visitor< ExpSet >::visit_tuple< bool, Dummy >::work_().

◆ zero()

Member Data Documentation

◆ denorm_

template<typename ExpSet>
bool vcsn::rat::expansionset< ExpSet >::denorm_ = old_way_ || !!getenv("VCSN_DENORM")
private

Denormalize if requested explicitly, or if running the old way.

Definition at line 955 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::compose().

◆ has_one

◆ ls_

◆ old_way_

template<typename ExpSet>
bool vcsn::rat::expansionset< ExpSet >::old_way_ = !!getenv("VCSN_OLDWAY")
private

Whether to running the old composition code.

Definition at line 953 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::compose_with_one_().

◆ ps_

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

The polynomialset for the polynomials.

Definition at line 951 of file expansionset.hh.

Referenced by vcsn::rat::expansionset< expressionset_t >::add_here(), vcsn::rat::expansionset< expressionset_t >::atom(), vcsn::rat::expansionset< expressionset_t >::complement_(), vcsn::rat::expansionset< expressionset_t >::compose(), vcsn::rat::expansionset< expressionset_t >::compose_with_one_new_(), vcsn::rat::expansionset< expressionset_t >::compose_with_one_old_(), vcsn::rat::expansionset< expressionset_t >::conjunction(), vcsn::rat::expansionset< expressionset_t >::conjunctions_with_one_(), vcsn::rat::expansionset< expressionset_t >::conv(), vcsn::rat::expansionset< expressionset_t >::denormalize_(), vcsn::rat::expansionset< expressionset_t >::determinize(), vcsn::rat::expansionset< expressionset_t >::for(), vcsn::rat::expansionset< expressionset_t >::infiltrate(), vcsn::rat::expansionset< expressionset_t >::ldivide(), vcsn::rat::expansionset< expressionset_t >::lweight_here(), vcsn::rat::expansionset< expressionset_t >::normalize_(), vcsn::rat::expansionset< expressionset_t >::polynomialset(), vcsn::rat::expansionset< expressionset_t >::print(), vcsn::rat::expansionset< expressionset_t >::project(), vcsn::rat::expansionset< expressionset_t >::rmul_label_here(), vcsn::rat::expansionset< expressionset_t >::rweight(), vcsn::rat::expansionset< expressionset_t >::shuffle_(), vcsn::rat::expansionset< expressionset_t >::transpose(), and vcsn::rat::expansionset< ExpSet >::tuple_impl< Expansions >::tuple().

◆ res [1/2]

◆ res [2/2]

template<typename ExpSet>
return vcsn::rat::expansionset< ExpSet >::res
private

Definition at line 406 of file expansionset.hh.

◆ rs_

◆ value_t

◆ ws_


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