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