17 #ifndef AWALI_WEIGHTSET_PMAX_HH
18 # define AWALI_WEIGHTSET_PMAX_HH
50 std::string
vname(
bool =
true)
const
95 raise(
sname(),
": star: invalid value: ",
format(*
this, v));
181 parse(
const std::string & s,
size_t& p) {
183 for(; i>0 && ((s[i-1]>=
'0' && s[i-1]<=
'9') || s[i-1]==
'e' || s[i-1]==
'E' || s[i-1]==
'.' || s[i-1]==
'+' || s[i-1]==
'-'); --i)
187 std::istringstream st(s.substr(i, p-i));
196 const std::string&
format =
"text")
210 o <<
"\\mathbb{R}_{max,*}";
211 else if (
format ==
"text")
214 raise(
"invalid format: ",
format);
218 template<
unsigned version = version::fsm_json>
221 version::check_fsmjson<version>();
230 template<
unsigned version = version::fsm_json>
234 version::check_fsmjson<version>();
244 template<
unsigned version = version::fsm_json>
248 version::check_fsmjson<version>();
virtual double to_double() const
Coerces this node_t to a double
Definition: node.hh:343
The Boolean semring.
Definition: b.hh:38
bool value_t
Definition: b.hh:56
The semiring of maximum probabilities.
Definition: pmax.hh:41
static value_t one()
Definition: pmax.hh:99
static value_t rdiv(const value_t l, const value_t r)
Definition: pmax.hh:77
std::string vname(bool=true) const
Definition: pmax.hh:50
static value_t mul(const value_t l, const value_t r)
Definition: pmax.hh:71
static value_t conv(std::istream &i)
Definition: pmax.hh:168
double value_t
Definition: pmax.hh:62
static std::string sname()
Definition: pmax.hh:45
value_t value_from_json(json::node_t const *p) const
Definition: pmax.hh:220
static value_t conv(self_type, value_t v)
Definition: pmax.hh:156
static value_t parse(const std::string &s, size_t &p)
Definition: pmax.hh:181
static json::node_t * to_json()
Definition: pmax.hh:232
static bool equals(const value_t l, const value_t r)
Definition: pmax.hh:111
static bool is_zero(const value_t v)
Definition: pmax.hh:128
static value_t transpose(const value_t v)
Definition: pmax.hh:145
static constexpr star_status_t star_status()
Definition: pmax.hh:142
static bool is_one(const value_t v)
Definition: pmax.hh:134
static size_t hash(value_t v)
Definition: pmax.hh:150
static constexpr bool show_one()
Definition: pmax.hh:141
static std::ostream & print(const value_t v, std::ostream &o, const std::string &format="text")
Definition: pmax.hh:195
json::node_t * value_to_json(value_t v) const
Definition: pmax.hh:245
static value_t zero()
Definition: pmax.hh:105
static constexpr bool is_commutative_semiring()
Definition: pmax.hh:139
static value_t conv(b, b::value_t v)
Definition: pmax.hh:162
static value_t add(const value_t l, const value_t r)
Definition: pmax.hh:65
value_t star(const value_t v) const
Definition: pmax.hh:90
static bool less_than(value_t lhs, value_t rhs)
Whether lhs < rhs.
Definition: pmax.hh:117
static pmax make(std::istream &is)
Build from the description in is.
Definition: pmax.hh:56
constexpr static bool is_special(value_t)
Definition: pmax.hh:122
std::ostream & print_set(std::ostream &o, const std::string &format="text") const
Definition: pmax.hh:207
static value_t ldiv(const value_t l, const value_t r)
Definition: pmax.hh:84
The semiring of floating Numbers.
Definition: r.hh:35
star_status_t
The different behaviours a weightset may have with respect to the star.
Definition: enums.hh:163
@ TOPS
Definition: enums.hh:167
void eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.hh:62
ATTRIBUTE_NORETURN void fail_reading(std::istream &is, std::string explanation)
Throw an exception after failing to read from is.
Definition: stream.hh:93
auto join(const ratexpset< Ctx1 > &a, const ratexpset< Ctx2 > &b) -> ratexpset< join_t< Ctx1, Ctx2 >>
The union of two ratexpsets.
Definition: ratexpset.hh:445
auto format(const ValueSet &vs, const typename ValueSet::value_t &v, Args &&... args) -> std::string
Format v via vs.print.
Definition: stream.hh:109
void require(bool b, Args &&... args)
If b is not verified, raise an error with args as message.
Definition: raise.hh:55
std::size_t hash_value(const T &v)
Definition: hash.hh:76
ATTRIBUTE_CONST int max(int a, int b)
Definition: arith.hh:54
Main namespace of Awali.
Definition: ato.hh:22
Exceptions thrown during parsing.
Definition: parse_exception.hh:26