Awali
Another Weighted Automata library
Public Types | Public Member Functions | Static Public Member Functions
awali::sttc::polynomialset< Context > Class Template Reference

Linear combination of labels: map labels to weights. More...

#include <polynomialset.hh>

Public Types

using context_t = Context
 
using label_t = typename labelset_t::value_t
 Polynomials over labels. More...
 
using labelset_ptr = typename context_t::labelset_ptr
 
using labelset_t = labelset_t_of< context_t >
 
using monomial_t = typename value_t::value_type
 A pair <label, weight>. More...
 
using polynomialset_t = polynomialset< context_t >
 
using self_type = polynomialset< Context >
 
using value_t = std::map< label_t, weight_t, internal::less< labelset_t > >
 
using weight_t = weight_t_of< context_t >
 
using weightset_ptr = typename context_t::weightset_ptr
 
using weightset_t = weightset_t_of< context_t >
 

Public Member Functions

 polynomialset ()=delete
 
 polynomialset (const context_t &ctx)
 
 polynomialset (const polynomialset &)=default
 
value_t add (const value_t &l, const value_t &r) const
 The sum of polynomials l and r. More...
 
value_tadd_here (value_t &v, const label_t &l, const weight_t k) const
 v += (l, k). More...
 
value_tadd_here (value_t &v, const monomial_t &p) const
 v += m. More...
 
value_tadd_here (value_t &v, const value_t &p) const
 v += p. More...
 
value_t conjunction (const value_t &l, const value_t &r) const
 The conjunction of polynomials l and r. More...
 
const context_tcontext () const
 
template<typename C >
value_t conv (const polynomialset< C > &sps, const typename polynomialset< C >::value_t &v) const
 Convert from another polynomialset to type_t. More...
 
template<typename WS >
value_t conv (const WS &ws, const typename WS::value_t &v) const
 FIXME: use enable_if to prevent this from being instantiated when WS is a polynomialset. More...
 
value_t conv (std::istream &i, const char sep='+') const
 Construct from a string. More...
 
value_tdel_weight (value_t &v, const label_t &w) const
 Remove the monomial of w in v. More...
 
std::string format (const monomial_t &m) const
 Format a monomial. More...
 
std::string format (const value_t &v, const std::string &sep=" + ", const std::string &fmt="text") const
 
const weight_t get_weight (const value_t &v, const label_t &w) const ATTRIBUTE_PURE
 
bool is_one (const value_t &v) const ATTRIBUTE_PURE
 
bool is_zero (const value_t &v) const
 
const labelset_ptrlabelset () const
 
value_tldiv_here (const weight_t &w, value_t &v) const
 Left exterior division. More...
 
value_t lmul (const weight_t &w, const value_t &v) const
 Left exterior product. More...
 
value_t lmul_letter (const label_t &lhs, const value_t &v) const
 Left product by a label. More...
 
const monomial_tmonomial_one () const
 
value_t mul (const value_t &l, const value_t &r) const
 The product of polynomials l and r. More...
 
const value_tone () const
 
std::ostream & print (const monomial_t &m, std::ostream &out, const std::string &format="text") const
 Print a monomial. More...
 
std::ostream & print (const value_t &v, std::ostream &out, const std::string &format="text", const std::string &sep=" + ") const
 Print a value (a polynomial). More...
 
std::ostream & print_set (std::ostream &o, const std::string &format="text") const
 
value_trdiv_here (value_t &v, const weight_t &w) const
 Right exterior division. More...
 
value_t rmul (const value_t &v, const weight_t &w) const
 Right exterior product. More...
 
value_t rmul_letter (const value_t &v, const label_t &rhs) const
 Right product. More...
 
value_tset_weight (value_t &v, const label_t &w, const weight_t k) const
 Set the monomial of w in v to weight k. More...
 
value_t star (const value_t &v) const
 The star of polynomial v. More...
 
value_t transpose (const value_t &v) const
 
std::string vname (bool full=true) const
 The dynamic name. More...
 
const weightset_ptrweightset () const
 
const value_tzero () const
 

Static Public Member Functions

static value_t conv (self_type, value_t v)
 Conversion from (this and) other weightsets. More...
 
static bool equals (const value_t &l, const value_t &r) ATTRIBUTE_PURE
 
static size_t hash (const monomial_t &m)
 
static size_t hash (const value_t &v)
 
static value_t ldiv (const value_t &l, const value_t &r)
 
static bool less_than (const value_t &lhs, const value_t &rhs)
 
static self_type make (std::istream &is)
 Build from the description in is. More...
 
static ATTRIBUTE_PURE bool monomial_less_than (const monomial_t &lhs, const monomial_t &rhs)
 
static value_t rdiv (const value_t &, const value_t &)
 
static constexpr bool show_one ()
 
static std::string sname ()
 The static name. More...
 
static constexpr star_status_t star_status ()
 

Detailed Description

template<class Context>
class awali::sttc::polynomialset< Context >

Linear combination of labels: map labels to weights.

Template Parameters
Contextthe LabelSet and WeightSet types.

Member Typedef Documentation

◆ context_t

template<class Context >
using awali::sttc::polynomialset< Context >::context_t = Context

◆ label_t

template<class Context >
using awali::sttc::polynomialset< Context >::label_t = typename labelset_t::value_t

Polynomials over labels.

◆ labelset_ptr

template<class Context >
using awali::sttc::polynomialset< Context >::labelset_ptr = typename context_t::labelset_ptr

◆ labelset_t

template<class Context >
using awali::sttc::polynomialset< Context >::labelset_t = labelset_t_of<context_t>

◆ monomial_t

template<class Context >
using awali::sttc::polynomialset< Context >::monomial_t = typename value_t::value_type

A pair <label, weight>.

◆ polynomialset_t

template<class Context >
using awali::sttc::polynomialset< Context >::polynomialset_t = polynomialset<context_t>

◆ self_type

template<class Context >
using awali::sttc::polynomialset< Context >::self_type = polynomialset<Context>

◆ value_t

template<class Context >
using awali::sttc::polynomialset< Context >::value_t = std::map<label_t, weight_t, internal::less<labelset_t> >

◆ weight_t

template<class Context >
using awali::sttc::polynomialset< Context >::weight_t = weight_t_of<context_t>

◆ weightset_ptr

template<class Context >
using awali::sttc::polynomialset< Context >::weightset_ptr = typename context_t::weightset_ptr

◆ weightset_t

template<class Context >
using awali::sttc::polynomialset< Context >::weightset_t = weightset_t_of<context_t>

Constructor & Destructor Documentation

◆ polynomialset() [1/3]

template<class Context >
awali::sttc::polynomialset< Context >::polynomialset ( )
delete

◆ polynomialset() [2/3]

template<class Context >
awali::sttc::polynomialset< Context >::polynomialset ( const polynomialset< Context > &  )
default

◆ polynomialset() [3/3]

template<class Context >
awali::sttc::polynomialset< Context >::polynomialset ( const context_t ctx)

Member Function Documentation

◆ add()

template<class Context >
value_t awali::sttc::polynomialset< Context >::add ( const value_t l,
const value_t r 
) const

The sum of polynomials l and r.

◆ add_here() [1/3]

template<class Context >
value_t& awali::sttc::polynomialset< Context >::add_here ( value_t v,
const label_t l,
const weight_t  k 
) const

v += (l, k).

◆ add_here() [2/3]

template<class Context >
value_t& awali::sttc::polynomialset< Context >::add_here ( value_t v,
const monomial_t p 
) const

v += m.

◆ add_here() [3/3]

template<class Context >
value_t& awali::sttc::polynomialset< Context >::add_here ( value_t v,
const value_t p 
) const

v += p.

◆ conjunction()

template<class Context >
value_t awali::sttc::polynomialset< Context >::conjunction ( const value_t l,
const value_t r 
) const

The conjunction of polynomials l and r.

Not valid for all the labelsets.

◆ context()

template<class Context >
const context_t& awali::sttc::polynomialset< Context >::context ( ) const

◆ conv() [1/4]

template<class Context >
template<typename C >
value_t awali::sttc::polynomialset< Context >::conv ( const polynomialset< C > &  sps,
const typename polynomialset< C >::value_t v 
) const

Convert from another polynomialset to type_t.

◆ conv() [2/4]

template<class Context >
template<typename WS >
value_t awali::sttc::polynomialset< Context >::conv ( const WS &  ws,
const typename WS::value_t &  v 
) const

FIXME: use enable_if to prevent this from being instantiated when WS is a polynomialset.

Then use this same technique for ratexps.

◆ conv() [3/4]

template<class Context >
static value_t awali::sttc::polynomialset< Context >::conv ( self_type  ,
value_t  v 
)
static

Conversion from (this and) other weightsets.

◆ conv() [4/4]

template<class Context >
value_t awali::sttc::polynomialset< Context >::conv ( std::istream &  i,
const char  sep = '+' 
) const

Construct from a string.

Somewhat more general than a mere reversal of "format", in particular "a+a" is properly understood as "<2>a" in char_z.

Parameters
ithe stream to parse
septhe separator between monomials.

◆ del_weight()

template<class Context >
value_t& awali::sttc::polynomialset< Context >::del_weight ( value_t v,
const label_t w 
) const

Remove the monomial of w in v.

◆ equals()

template<class Context >
static bool awali::sttc::polynomialset< Context >::equals ( const value_t l,
const value_t r 
)
static

◆ format() [1/2]

template<class Context >
std::string awali::sttc::polynomialset< Context >::format ( const monomial_t m) const

Format a monomial.

◆ format() [2/2]

template<class Context >
std::string awali::sttc::polynomialset< Context >::format ( const value_t v,
const std::string &  sep = " + ",
const std::string &  fmt = "text" 
) const

◆ get_weight()

template<class Context >
const weight_t awali::sttc::polynomialset< Context >::get_weight ( const value_t v,
const label_t w 
) const

◆ hash() [1/2]

template<class Context >
static size_t awali::sttc::polynomialset< Context >::hash ( const monomial_t m)
static

◆ hash() [2/2]

template<class Context >
static size_t awali::sttc::polynomialset< Context >::hash ( const value_t v)
static

◆ is_one()

template<class Context >
bool awali::sttc::polynomialset< Context >::is_one ( const value_t v) const

◆ is_zero()

template<class Context >
bool awali::sttc::polynomialset< Context >::is_zero ( const value_t v) const

◆ labelset()

template<class Context >
const labelset_ptr& awali::sttc::polynomialset< Context >::labelset ( ) const

◆ ldiv()

template<class Context >
static value_t awali::sttc::polynomialset< Context >::ldiv ( const value_t l,
const value_t r 
)
static

◆ ldiv_here()

template<class Context >
value_t& awali::sttc::polynomialset< Context >::ldiv_here ( const weight_t w,
value_t v 
) const

Left exterior division.

◆ less_than()

template<class Context >
static bool awali::sttc::polynomialset< Context >::less_than ( const value_t lhs,
const value_t rhs 
)
static

◆ lmul()

template<class Context >
value_t awali::sttc::polynomialset< Context >::lmul ( const weight_t w,
const value_t v 
) const

Left exterior product.

◆ lmul_letter()

template<class Context >
value_t awali::sttc::polynomialset< Context >::lmul_letter ( const label_t lhs,
const value_t v 
) const

Left product by a label.

◆ make()

template<class Context >
static self_type awali::sttc::polynomialset< Context >::make ( std::istream &  is)
static

Build from the description in is.

◆ monomial_less_than()

template<class Context >
static ATTRIBUTE_PURE bool awali::sttc::polynomialset< Context >::monomial_less_than ( const monomial_t lhs,
const monomial_t rhs 
)
static

◆ monomial_one()

template<class Context >
const monomial_t& awali::sttc::polynomialset< Context >::monomial_one ( ) const

◆ mul()

template<class Context >
value_t awali::sttc::polynomialset< Context >::mul ( const value_t l,
const value_t r 
) const

The product of polynomials l and r.

◆ one()

template<class Context >
const value_t& awali::sttc::polynomialset< Context >::one ( ) const

◆ print() [1/2]

template<class Context >
std::ostream& awali::sttc::polynomialset< Context >::print ( const monomial_t m,
std::ostream &  out,
const std::string &  format = "text" 
) const

Print a monomial.

◆ print() [2/2]

template<class Context >
std::ostream& awali::sttc::polynomialset< Context >::print ( const value_t v,
std::ostream &  out,
const std::string &  format = "text",
const std::string &  sep = " + " 
) const

Print a value (a polynomial).

◆ print_set()

template<class Context >
std::ostream& awali::sttc::polynomialset< Context >::print_set ( std::ostream &  o,
const std::string &  format = "text" 
) const

◆ rdiv()

template<class Context >
static value_t awali::sttc::polynomialset< Context >::rdiv ( const value_t ,
const value_t  
)
static

◆ rdiv_here()

template<class Context >
value_t& awali::sttc::polynomialset< Context >::rdiv_here ( value_t v,
const weight_t w 
) const

Right exterior division.

◆ rmul()

template<class Context >
value_t awali::sttc::polynomialset< Context >::rmul ( const value_t v,
const weight_t w 
) const

Right exterior product.

◆ rmul_letter()

template<class Context >
value_t awali::sttc::polynomialset< Context >::rmul_letter ( const value_t v,
const label_t rhs 
) const

Right product.

◆ set_weight()

template<class Context >
value_t& awali::sttc::polynomialset< Context >::set_weight ( value_t v,
const label_t w,
const weight_t  k 
) const

Set the monomial of w in v to weight k.

◆ show_one()

template<class Context >
static constexpr bool awali::sttc::polynomialset< Context >::show_one ( )
staticconstexpr

◆ sname()

template<class Context >
static std::string awali::sttc::polynomialset< Context >::sname ( )
static

The static name.

◆ star()

template<class Context >
value_t awali::sttc::polynomialset< Context >::star ( const value_t v) const

The star of polynomial v.

◆ star_status()

template<class Context >
static constexpr star_status_t awali::sttc::polynomialset< Context >::star_status ( )
staticconstexpr

◆ transpose()

template<class Context >
value_t awali::sttc::polynomialset< Context >::transpose ( const value_t v) const

◆ vname()

template<class Context >
std::string awali::sttc::polynomialset< Context >::vname ( bool  full = true) const

The dynamic name.

◆ weightset()

template<class Context >
const weightset_ptr& awali::sttc::polynomialset< Context >::weightset ( ) const

◆ zero()

template<class Context >
const value_t& awali::sttc::polynomialset< Context >::zero ( ) const

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