![]() |
Vcsn
2.0
Be Rational
|
Linear combination of labels: map labels to weights. More...
#include <fwd.hh>
Public Types | |
using | self_type = polynomialset< Context > |
using | context_t = Context |
using | labelset_t = labelset_t_of< context_t > |
using | weightset_t = weightset_t_of< context_t > |
using | polynomialset_t = polynomialset< context_t > |
using | labelset_ptr = typename context_t::labelset_ptr |
using | weightset_ptr = typename context_t::weightset_ptr |
using | label_t = typename labelset_t::value_t |
Polynomials over labels. More... | |
using | weight_t = weight_t_of< context_t > |
using | value_t = std::map< label_t, weight_t, vcsn::less< labelset_t >> |
using | monomial_t = typename value_t::value_type |
A pair <label, weight>. More... | |
Public Member Functions | |
polynomialset ()=delete | |
polynomialset (const polynomialset &)=default | |
polynomialset (const context_t &ctx) | |
std::string | vname (bool full=true) const |
The dynamic name. More... | |
const context_t & | context () const |
const labelset_ptr & | labelset () const |
const weightset_ptr & | weightset () const |
value_t & | del_weight (value_t &v, const label_t &w) const |
Remove the monomial of w in v. More... | |
value_t & | set_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 & | add_here (value_t &v, const value_t &p) const |
v += p. More... | |
value_t & | add_here (value_t &v, const monomial_t &p) const |
v += m. More... | |
value_t & | add_here (value_t &v, const label_t &l, const weight_t k) const |
v += (l, k). More... | |
const weight_t | get_weight (const value_t &v, const label_t &w) const ATTRIBUTE_PURE |
value_t | add (const value_t &l, const value_t &r) const |
The sum of polynomials l and r. More... | |
value_t | mul (const value_t &l, const value_t &r) const |
The product of polynomials l and r. More... | |
value_t | conjunction (const value_t &l, const value_t &r) const |
The conjunction of polynomials l and r. More... | |
weight_t | scalar_product (const value_t &l, const value_t &r) const |
The sum of the weights of the common labels. More... | |
value_t | star (const value_t &v) const |
The star of polynomial v. More... | |
value_t | lmul (const weight_t &w, const value_t &v) const |
Left exterior product. More... | |
value_t | lmul (const label_t &lhs, const value_t &v) const |
Left product by a label. More... | |
value_t | rmul (const value_t &v, const weight_t &w) const |
Right exterior product. More... | |
value_t | rmul (const value_t &v, const label_t &rhs) const |
Right product. More... | |
value_t & | ldiv_here (const weight_t &w, value_t &v) const |
Left exterior division. More... | |
value_t & | rdiv_here (value_t &v, const weight_t &w) const |
Right exterior division. More... | |
template<typename WeightSet , typename std::enable_if<!std::is_same< WeightSet, z >::value, int >::type = 0> | |
WeightSet::value_t | norm_ (value_t &v) const |
In the general case, normalize by the first (non null) weight. More... | |
template<typename WeightSet , typename std::enable_if< std::is_same< WeightSet, z >::value, int >::type = 0> | |
WeightSet::value_t | norm_ (value_t &v) const |
For Z, take the GCD, with the sign of the first value. More... | |
weight_t | normalize_here (value_t &v) const |
Normalize v in place, and return the factor which was divided. More... | |
const value_t & | one () const |
const monomial_t & | monomial_one () const |
bool | is_one (const value_t &v) const ATTRIBUTE_PURE |
const value_t & | zero () const |
bool | is_zero (const value_t &v) const |
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... | |
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... | |
value_t | transpose (const value_t &v) const |
std::ostream & | print_set (std::ostream &o, symbol format=symbol{"text"}) const |
value_t | conv (std::istream &i, const char sep= '+') const |
Construct from a string. More... | |
std::ostream & | print (const monomial_t &m, std::ostream &out, symbol format=symbol{"text"}) const |
Print a monomial. More... | |
std::ostream & | print (const value_t &v, std::ostream &out, symbol format=symbol{"text"}, const std::string &sep=" + ") const |
Print a value (a polynomial). More... | |
Static Public Member Functions | |
static std::string | sname () |
The static name. More... | |
static value_t | rdiv (const value_t &, const value_t &) |
static value_t | ldiv (const value_t &l, const value_t &r) |
static ATTRIBUTE_PURE bool | monomial_equals (const monomial_t &lhs, const monomial_t &rhs) |
static bool | equals (const value_t &l, const value_t &r) ATTRIBUTE_PURE |
static constexpr bool | show_one () |
static constexpr star_status_t | star_status () |
static value_t | conv (self_type, value_t v) |
Conversion from (this and) other weightsets. More... | |
static ATTRIBUTE_PURE bool | monomial_less_than (const monomial_t &lhs, const monomial_t &rhs) |
static bool | less_than (const value_t &lhs, const value_t &rhs) |
static ATTRIBUTE_PURE size_t | hash (const monomial_t &m) |
static ATTRIBUTE_PURE size_t | hash (const value_t &v) |
static self_type | make (std::istream &is) |
Build from the description in is. More... | |
Private Member Functions | |
std::ostream & | print_weight_ (const weight_t &w, std::ostream &out, symbol format=symbol{"text"}) const |
Print a weight. More... | |
std::ostream & | print_without_ranges_ (const value_t &v, std::ostream &out, symbol format=symbol{"text"}, const std::string &sep=" + ") const |
Print a polynomial value without ranges. More... | |
std::ostream & | print_with_ranges_ (const value_t &v, std::ostream &out, symbol format=symbol{"text"}, const std::string &sep=" + ") const |
Print a polynomial value with ranges. More... | |
template<typename context > | |
std::enable_if <!(context::is_lal||context::is_lan), std::ostream & >::type | print_ (const value_t &v, std::ostream &out, symbol format=symbol{"text"}, const std::string &sep=" + ") const |
Print a non-null value for neither LAL nor LAN. More... | |
template<typename Ctx > | |
std::enable_if< Ctx::is_lal||Ctx::is_lan, std::ostream & >::type | print_ (const value_t &v, std::ostream &out, symbol format=symbol{"text"}, const std::string &sep=" + ") const |
Print a non-null value for LAL or LAN. More... | |
Private Attributes | |
context_t | ctx_ |
Static Private Attributes | |
static constexpr char | langle = '<' |
Left marker for weight in concrete syntax. More... | |
static constexpr char | rangle = '>' |
Right marker for weight in concrete syntax. More... | |
Linear combination of labels: map labels to weights.
Context | the LabelSet and WeightSet types. |
using vcsn::polynomialset< Context >::context_t = Context |
Definition at line 58 of file polynomialset.hh.
using vcsn::polynomialset< Context >::label_t = typename labelset_t::value_t |
Polynomials over labels.
Definition at line 66 of file polynomialset.hh.
using vcsn::polynomialset< Context >::labelset_ptr = typename context_t::labelset_ptr |
Definition at line 63 of file polynomialset.hh.
using vcsn::polynomialset< Context >::labelset_t = labelset_t_of<context_t> |
Definition at line 59 of file polynomialset.hh.
using vcsn::polynomialset< Context >::monomial_t = typename value_t::value_type |
A pair <label, weight>.
Definition at line 71 of file polynomialset.hh.
using vcsn::polynomialset< Context >::polynomialset_t = polynomialset<context_t> |
Definition at line 61 of file polynomialset.hh.
using vcsn::polynomialset< Context >::self_type = polynomialset<Context> |
Definition at line 57 of file polynomialset.hh.
using vcsn::polynomialset< Context >::value_t = std::map<label_t, weight_t, vcsn::less<labelset_t>> |
Definition at line 69 of file polynomialset.hh.
using vcsn::polynomialset< Context >::weight_t = weight_t_of<context_t> |
Definition at line 67 of file polynomialset.hh.
using vcsn::polynomialset< Context >::weightset_ptr = typename context_t::weightset_ptr |
Definition at line 64 of file polynomialset.hh.
using vcsn::polynomialset< Context >::weightset_t = weightset_t_of<context_t> |
Definition at line 60 of file polynomialset.hh.
|
delete |
|
default |
|
inline |
Definition at line 75 of file polynomialset.hh.
|
inline |
The sum of polynomials l and r.
Definition at line 167 of file polynomialset.hh.
Referenced by vcsn::rat::split_visitor< RatExpSet >::product(), and vcsn::rat::expand_visitor< RatExpSet >::VCSN_RAT_VISIT().
|
inline |
v += p.
Definition at line 116 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::add(), vcsn::polynomialset< ratexpset_t >::add_here(), vcsn::rat::split_visitor< RatExpSet >::conjunction(), vcsn::polynomialset< ratexpset_t >::conjunction(), vcsn::polynomialset< ratexpset_t >::conv(), vcsn::rat::expansionset< ratexpset_t >::denormalize_(), vcsn::detail::enumerater< Aut >::enumerate(), vcsn::polynomialset< ratexpset_t >::lmul(), vcsn::polynomialset< ratexpset_t >::mul(), vcsn::rat::split_visitor< RatExpSet >::product(), vcsn::detail::enumerater< Aut >::propagate_(), vcsn::polynomialset< ratexpset_t >::rmul(), vcsn::detail::enumerater< Aut >::shortest(), vcsn::rat::derivation_visitor< RatExpSet >::VCSN_RAT_VISIT(), vcsn::rat::expand_visitor< RatExpSet >::VCSN_RAT_VISIT(), vcsn::rat::split_visitor< RatExpSet >::VCSN_RAT_VISIT(), vcsn::rat::to_expansion_visitor< RatExpSet >::VCSN_RAT_VISIT(), and vcsn::rat::to_expansion_visitor< RatExpSet >::visit_complement().
|
inline |
v += m.
Definition at line 125 of file polynomialset.hh.
|
inline |
v += (l, k).
Definition at line 132 of file polynomialset.hh.
|
inline |
The conjunction of polynomials l and r.
Not valid for all the labelsets.
Definition at line 190 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::conjunction(), and vcsn::rat::derivation_visitor< RatExpSet >::VCSN_RAT_VISIT().
|
inline |
Definition at line 91 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::vname().
|
inlinestatic |
Conversion from (this and) other weightsets.
Definition at line 402 of file polynomialset.hh.
|
inline |
FIXME: use enable_if to prevent this from being instantiated when WS is a polynomialset.
Then use this same technique for ratexps.
Definition at line 412 of file polynomialset.hh.
|
inline |
Convert from another polynomialset to type_t.
Definition at line 420 of file polynomialset.hh.
|
inline |
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.
i | the stream to parse |
sep | the separator between monomials. |
Definition at line 525 of file polynomialset.hh.
|
inline |
Remove the monomial of w in v.
Definition at line 97 of file polynomialset.hh.
Referenced by vcsn::rat::split_visitor< RatExpSet >::conjunction(), vcsn::rat::split_visitor< RatExpSet >::product(), and vcsn::polynomialset< ratexpset_t >::set_weight().
|
inlinestatic |
Definition at line 349 of file polynomialset.hh.
|
inline |
Definition at line 156 of file polynomialset.hh.
Referenced by vcsn::rat::split_visitor< RatExpSet >::conjunction(), and vcsn::rat::split_visitor< RatExpSet >::product().
|
inlinestatic |
Definition at line 464 of file polynomialset.hh.
|
inlinestatic |
Definition at line 473 of file polynomialset.hh.
|
inline |
Definition at line 371 of file polynomialset.hh.
|
inline |
|
inline |
Definition at line 92 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::add_here(), vcsn::polynomialset< ratexpset_t >::conjunction(), vcsn::polynomialset< ratexpset_t >::conv(), vcsn::polynomialset< ratexpset_t >::is_one(), vcsn::polynomialset< ratexpset_t >::lmul(), vcsn::polynomialset< ratexpset_t >::monomial_one(), vcsn::polynomialset< ratexpset_t >::mul(), vcsn::polynomialset< ratexpset_t >::rmul(), vcsn::polynomialset< ratexpset_t >::star(), and vcsn::polynomialset< ratexpset_t >::transpose().
|
inlinestatic |
Definition at line 285 of file polynomialset.hh.
|
inline |
Left exterior division.
Definition at line 292 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::normalize_here().
|
inlinestatic |
Definition at line 446 of file polynomialset.hh.
|
inline |
Left exterior product.
Definition at line 233 of file polynomialset.hh.
Referenced by vcsn::rat::split_visitor< RatExpSet >::conjunction(), vcsn::rat::split_visitor< RatExpSet >::product(), vcsn::rat::derivation_visitor< RatExpSet >::VCSN_RAT_VISIT(), vcsn::rat::expand_visitor< RatExpSet >::VCSN_RAT_VISIT(), vcsn::rat::to_expansion_visitor< RatExpSet >::VCSN_RAT_VISIT(), and vcsn::rat::split_visitor< RatExpSet >::VCSN_RAT_VISIT().
|
inline |
Left product by a label.
Definition at line 244 of file polynomialset.hh.
|
inlinestatic |
Build from the description in is.
Definition at line 485 of file polynomialset.hh.
|
inlinestatic |
Definition at line 341 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::equals().
|
inlinestatic |
Definition at line 435 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::less_than().
|
inline |
Definition at line 364 of file polynomialset.hh.
Referenced by vcsn::detail::enumerater< Aut >::enumerate(), vcsn::polynomialset< ratexpset_t >::one(), and vcsn::detail::enumerater< Aut >::shortest().
|
inline |
The product of polynomials l and r.
Definition at line 176 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::conjunction(), vcsn::polynomialset< ratexpset_t >::lmul(), vcsn::polynomialset< ratexpset_t >::mul(), vcsn::polynomialset< ratexpset_t >::rmul(), vcsn::polynomialset< ratexpset_t >::scalar_product(), and vcsn::rat::expand_visitor< RatExpSet >::VCSN_RAT_VISIT().
|
inline |
In the general case, normalize by the first (non null) weight.
Definition at line 312 of file polynomialset.hh.
|
inline |
For Z, take the GCD, with the sign of the first value.
Definition at line 321 of file polynomialset.hh.
|
inline |
Normalize v in place, and return the factor which was divided.
Definition at line 333 of file polynomialset.hh.
|
inline |
Definition at line 357 of file polynomialset.hh.
Referenced by vcsn::detail::enumerater< Aut >::enumerater(), vcsn::polynomialset< ratexpset_t >::is_one(), vcsn::polynomialset< ratexpset_t >::star(), vcsn::rat::derivation_visitor< RatExpSet >::VCSN_RAT_VISIT(), and vcsn::rat::expand_visitor< RatExpSet >::VCSN_RAT_VISIT().
|
inline |
Print a monomial.
Definition at line 617 of file polynomialset.hh.
Referenced by vcsn::detail::outputter< Aut >::print_entry_().
|
inline |
Print a value (a polynomial).
v | the polynomial |
out | the output stream |
format | the format: "text" or "latex" |
sep | the separator between monomials |
Definition at line 637 of file polynomialset.hh.
|
inlineprivate |
Print a non-null value for neither LAL nor LAN.
Definition at line 746 of file polynomialset.hh.
|
inlineprivate |
Print a non-null value for LAL or LAN.
Definition at line 757 of file polynomialset.hh.
|
inline |
Definition at line 495 of file polynomialset.hh.
|
inlineprivate |
Print a weight.
Definition at line 653 of file polynomialset.hh.
|
inlineprivate |
Print a polynomial value with ranges.
Definition at line 685 of file polynomialset.hh.
|
inlineprivate |
Print a polynomial value without ranges.
Definition at line 668 of file polynomialset.hh.
|
inlinestatic |
Definition at line 279 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::ldiv().
|
inline |
Right exterior division.
Definition at line 301 of file polynomialset.hh.
|
inline |
Right exterior product.
Definition at line 257 of file polynomialset.hh.
Referenced by vcsn::rat::split_visitor< RatExpSet >::product(), vcsn::rat::derivation_visitor< RatExpSet >::VCSN_RAT_VISIT(), vcsn::rat::expand_visitor< RatExpSet >::VCSN_RAT_VISIT(), and vcsn::rat::split_visitor< RatExpSet >::VCSN_RAT_VISIT().
|
inline |
Right product.
Definition at line 268 of file polynomialset.hh.
|
inline |
The sum of the weights of the common labels.
Definition at line 203 of file polynomialset.hh.
|
inline |
Set the monomial of w in v to weight k.
Definition at line 105 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::add_here().
|
inlinestatic |
Definition at line 394 of file polynomialset.hh.
|
inlinestatic |
The static name.
Definition at line 80 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::conv(), and vcsn::polynomialset< ratexpset_t >::star().
|
inline |
The star of polynomial v.
Definition at line 215 of file polynomialset.hh.
|
inlinestatic |
Definition at line 395 of file polynomialset.hh.
|
inline |
Definition at line 455 of file polynomialset.hh.
|
inline |
The dynamic name.
Definition at line 86 of file polynomialset.hh.
|
inline |
Definition at line 93 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::add_here(), vcsn::polynomialset< ratexpset_t >::conjunction(), vcsn::polynomialset< ratexpset_t >::conv(), vcsn::polynomialset< ratexpset_t >::get_weight(), vcsn::polynomialset< ratexpset_t >::is_one(), vcsn::polynomialset< ratexpset_t >::ldiv_here(), vcsn::polynomialset< ratexpset_t >::lmul(), vcsn::polynomialset< ratexpset_t >::monomial_one(), vcsn::polynomialset< ratexpset_t >::mul(), vcsn::polynomialset< ratexpset_t >::rdiv_here(), vcsn::polynomialset< ratexpset_t >::rmul(), vcsn::polynomialset< ratexpset_t >::scalar_product(), vcsn::polynomialset< ratexpset_t >::set_weight(), vcsn::polynomialset< ratexpset_t >::star(), and vcsn::polynomialset< ratexpset_t >::transpose().
|
inline |
Definition at line 382 of file polynomialset.hh.
Referenced by vcsn::rat::expand_visitor< RatExpSet >::VCSN_RAT_VISIT(), vcsn::rat::derivation_visitor< RatExpSet >::VCSN_RAT_VISIT(), and vcsn::rat::split_visitor< RatExpSet >::VCSN_RAT_VISIT().
|
private |
Definition at line 766 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::context(), vcsn::polynomialset< ratexpset_t >::labelset(), and vcsn::polynomialset< ratexpset_t >::weightset().
|
staticprivate |
Left marker for weight in concrete syntax.
Definition at line 769 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::conv().
|
staticprivate |
Right marker for weight in concrete syntax.
Definition at line 771 of file polynomialset.hh.
Referenced by vcsn::polynomialset< ratexpset_t >::conv().