1 #ifndef VCSN_WEIGHTSET_Q_HH
2 # define VCSN_WEIGHTSET_Q_HH
32 std::string
vname(
bool =
true)
const
64 static unsigned int abs(
int a)
66 return a < 0 ? -a : a;
137 return v.
num == 1 && v.
den == 1;
204 if ((maybe_slash = i.peek()) !=
'/')
232 if (format ==
"latex")
237 o <<
"\\frac{" << v.
num <<
"}{" << v.
den <<
'}';
251 if (format ==
"latex")
253 else if (format ==
"text")
256 raise(
"invalid format: ", format);
271 #endif // !VCSN_WEIGHTSET_Q_HH
static unsigned int abs(int a)
static constexpr bool is_commutative()
ATTRIBUTE_PURE unsigned int lcm(unsigned int a, unsigned int b)
static q make(std::istream &is)
Build from the description in is.
value_t & reduce()
Put it in normal form.
static constexpr bool show_one()
static bool equals(const value_t l, const value_t r)
static size_t hash(value_t v)
ATTRIBUTE_PURE unsigned int gcd(unsigned int a, unsigned int b)
static bool is_zero(const value_t v)
boost::flyweight< std::string, boost::flyweights::no_tracking > symbol
An internalized string.
variadic_mul_mixin< detail::b_impl > b
static constexpr star_status_t star_status()
variadic_mul_mixin< detail::q_impl > q
std::ostream & print_set(std::ostream &o, symbol format=symbol{"text"}) const
value_t star(const value_t v) const
std::size_t hash_value(const T &v)
static value_t conv(b, b::value_t v)
static std::ostream & print(const value_t v, std::ostream &o, symbol format=symbol{"text"})
static bool is_one(const value_t v)
static std::string sname()
variadic_mul_mixin< detail::z_impl > z
static bool less_than(value_t lhs, value_t rhs)
Whether lhs < rhs.
static value_t abs(const value_t v)
static value_t conv(z, z::value_t v)
value_t(int n=0, unsigned d=1)
static value_t ldiv(const value_t l, const value_t r)
static value_t sub(const value_t l, const value_t r)
std::string vname(bool=true) const
std::istringstream is
The input stream: the specification to translate.
static value_t add(const value_t l, const value_t r)
Provide a variadic mul on top of a binary mul(), and one().
static value_t mul(const value_t l, const value_t r)
char eat(std::istream &is, char c)
Check lookahead character and advance.
static bool is_special(const value_t)
ATTRIBUTE_NORETURN void fail_reading(std::istream &is, std::string explanation)
Throw an exception after failing to read from is.
static value_t rdiv(const value_t l, const value_t r)
static value_t conv(self_type, value_t v)
void require(bool b, Args &&...args)
If b is not verified, raise an error with args as message.
static value_t transpose(const value_t v)
static value_t conv(std::istream &i)
std::string to_string(direction d)
Conversion to string.