44 return std::numeric_limits<value_t>::infinity();
62 return std::numeric_limits<value_t>::max();
70 return r - std::log1p(std::exp(-diff));
72 return l - std::log1p(std::exp(diff));
79 return -
std::log(std::exp(-l) - std::exp(-r));
105 return std::log1p(-std::exp(-v));
173 conv(std::istream& i,
bool =
true)
const 181 else if (! (i >> res))
202 o <<
"\\mathrm{Log}";
220 template <
typename RandomGenerator>
228 using super_t::super_t;
234 std::uniform_real_distribution<log::value_t>(super_t::min_, super_t::max_);
235 return dis(super_t::gen_);
static value_t zero()
The zero for the log semiring is +oo.
Print as a parsable type string.
static value_t mul(const value_t l, const value_t r)
weightset_mixin< detail::r_impl > r
static value_t transpose(const value_t v)
value_t rdivide(const value_t l, const value_t r) const
ATTRIBUTE_NORETURN void raise_invalid_value(const ValueSet &vs, Args &&... args)
Cannot make a value from this.
static bool equal(const value_t l, const value_t r)
Whether l == r.
value_t pick_value_() const
char eat(std::istream &is, char c)
Check lookahead character and advance.
static constexpr star_status_t star_status()
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
static value_t one()
The neutral element for the log semiring is 0.
static constexpr bool is_special(const value_t)
static int compare(const value_t l, const value_t r)
Three-way comparison between l and r.
static size_t hash(const value_t v)
static constexpr bool show_one()
static std::ostream & print(const value_t v, std::ostream &o=std::cout, format fmt={})
Print as rich UTF-8 text, escaped.
An input/output format for valuesets.
Abstract class for random weight generation.
Provide a variadic mul on top of a binary mul(), and one().
static bool less(const value_t l, const value_t r)
Whether l < r.
static value_t conv(self_t, const value_t v)
auto hash_value(const T &v) -> decltype(std::hash< T >
Following the naming convention of Boost.
static bool is_one(const value_t v)
weightset_mixin< detail::log_impl > log
static constexpr bool is_commutative()
typename super_t::weight_t value_t
Print as plain (ASCII) text, escaped.
static constexpr bool is_idempotent()
static value_t add(const value_t l, const value_t r)
static log make(std::istream &is)
Build from the description in is.
ATTRIBUTE_NORETURN void raise_not_starrable(const WeightSet &ws, const typename WeightSet::value_t &w)
This value is not starrable.
Print as is. For instance, don't try to escape labels.
std::ostream & print_set(std::ostream &o, format fmt={}) const
Generic declaration of the class which is specialized in each weightset.
void require(Bool b, Args &&... args)
If b is not verified, raise an error with args as message.
value_t conv(std::istream &i, bool=true) const
static bool is_zero(const value_t v)
value_t star(const value_t v) const
static value_t sub(const value_t l, const value_t r)
typename weightset_t::value_t weight_t
static constexpr bool has_lightening_weights()
value_t ldivide(const value_t l, const value_t r) const