61 static unsigned int abs(
int a)
63 return a < 0 ? -a : a;
148 return v.
num == 1 && v.
den == 1;
159 return lhs.
num *
static_cast<long>(rhs.
den)
160 < rhs.
num * static_cast<long>(lhs.
den);
208 conv(std::istream& i,
bool =
true)
const
212 raise(*
this,
": invalid numerator: ", i);
231 raise(*
this,
": invalid denominator: ", i);
233 require(den, *
this,
": null denominator");
249 o <<
"\\frac{" << v.
num <<
"}{" << v.
den <<
'}';
static value_t transpose(const value_t v)
static bool less(const value_t lhs, const value_t rhs)
Whether lhs < rhs.
weightset_mixin< detail::q_impl > q
static std::ostream & print(const value_t v, std::ostream &o=std::cout, format fmt={})
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
static unsigned int abs(int a)
static bool is_special(const value_t)
static constexpr bool is_commutative()
ATTRIBUTE_NORETURN void raise_not_starrable(const WeightSet &ws, const typename WeightSet::value_t &w)
This value is not starrable.
static bool is_one(const value_t v)
ATTRIBUTE_PURE unsigned int lcm(unsigned int a, unsigned int b)
Lowest common multiple.
Print as a parsable type string.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
static value_t conv(b, const b::value_t v)
auto hash_value(const T &v) -> decltype(std::hash< T >
Following the naming convention of Boost.
static value_t mul(const value_t l, const value_t r)
static constexpr star_status_t star_status()
static bool equal(const value_t l, const value_t r)
static value_t add(const value_t l, const value_t r)
value_t(int n=0, unsigned d=1)
value_t lgcd(const value_t l, const value_t r) const
GCD: arbitrarily the first argument.
std::ostream & print_set(std::ostream &o, format fmt={}) const
static q make(std::istream &is)
Build from the description in is.
static value_t sub(const value_t l, const value_t r)
An input/output format for valuesets.
static value_t conv(self_t, const value_t v)
Print as is. For instance, don't try to escape labels.
static size_t hash(const value_t v)
value_t ldivide(const value_t l, const value_t r) const
value_t star(const value_t v) const
static value_t conv(z, const z::value_t v)
Print as rich UTF-8 text, escaped.
void hash_combine(std::size_t &seed, const T &v)
static constexpr bool has_lightening_weights()
weightset_mixin< detail::z_impl > z
value_t rgcd(const value_t l, const value_t r) const
weightset_mixin< detail::b_impl > b
ATTRIBUTE_PURE unsigned int gcd(unsigned int a, unsigned int b)
Greatest common divisor.
static bool is_zero(const value_t v)
Provide a variadic mul on top of a binary mul(), and one().
Print as plain (ASCII) text, escaped.
static constexpr bool show_one()
valid iff proper succeeds on the "absolute value" of the automaton
static value_t abs(const value_t v)
char eat(std::istream &is, char c)
Check lookahead character and advance.
value_t conv(std::istream &i, bool=true) const
value_t rdivide(const value_t l, const value_t r) const
value_t & reduce()
Put it in normal form.