1 #ifndef VCSN_WEIGHTSET_QMP_HH
2 # define VCSN_WEIGHTSET_QMP_HH
35 std::string
vname(
bool =
true)
const
53 return value_t{mpz_class(0), 1};
91 if (
abs(v.get_num()) < v.get_den())
93 return {v.get_den(), v.get_den() - v.get_num()};
105 return v.get_num() == 0;
111 return v.get_num() == 1 && v.get_den() == 1;
178 if (format ==
"latex")
180 if (v.get_den() == 1)
183 o <<
"\\frac{" << v.get_num() <<
"}{" << v.get_den() <<
'}';
193 if (format ==
"latex")
194 o <<
"\\mathbb{Q}_{\\text{mp}}";
195 else if (format ==
"text")
198 raise(
"invalid format: ", format);
214 #endif // !VCSN_WEIGHTSET_QMP_HH
static bool less_than(value_t l, value_t r)
Whether < r.
static std::ostream & print(const value_t v, std::ostream &o, symbol format=symbol{"text"})
static constexpr star_status_t star_status()
static value_t abs(const value_t v)
static qmp make(std::istream &is)
Build from the description in is.
std::string vname(bool=true) const
static value_t conv(self_type, value_t v)
variadic_mul_mixin< detail::qmp_impl > qmp
static value_t conv(z, z::value_t v)
boost::flyweight< std::string, boost::flyweights::no_tracking > symbol
An internalized string.
variadic_mul_mixin< detail::b_impl > b
static value_t sub(const value_t l, const value_t r)
variadic_mul_mixin< detail::q_impl > q
static value_t rdiv(const value_t l, const value_t r)
std::size_t hash_value(const T &v)
static value_t mul(const value_t l, const value_t r)
static bool is_zero(const value_t v)
static value_t transpose(const value_t v)
variadic_mul_mixin< detail::z_impl > z
static value_t add(const value_t l, const value_t r)
static bool is_special(const value_t)
static std::string sname()
static value_t conv(std::istream &i)
static value_t ldiv(const value_t l, const value_t r)
std::istringstream is
The input stream: the specification to translate.
static constexpr bool is_commutative()
static bool equals(const value_t l, const value_t r)
static bool is_one(const value_t v)
Provide a variadic mul on top of a binary mul(), and one().
std::ostream & print_set(std::ostream &o, symbol format=symbol{"text"}) const
char eat(std::istream &is, char c)
Check lookahead character and advance.
static value_t conv(b, b::value_t v)
value_t star(const value_t v) const
static size_t hash(value_t v)
variadic_mul_mixin< detail::r_impl > r
void require(bool b, Args &&...args)
If b is not verified, raise an error with args as message.
static constexpr bool show_one()
std::string to_string(direction d)
Conversion to string.