17 #ifndef AWALI_ALGOS_DIVKBASEB_HH 
   18 # define AWALI_ALGOS_DIVKBASEB_HH 
   26 namespace awali { 
namespace sttc {
 
   46   template <
typename Context>
 
   47   mutable_automaton<Context>
 
   48   divkbaseb(
const Context& ctx, 
unsigned divisor, 
unsigned base)
 
   50     using context_t = Context;
 
   52     const auto& gens = ctx.labelset()->genset();
 
   53     std::vector<typename context_t::labelset_t::letter_t> letters
 
   54       {std::begin(gens), std::end(gens)};
 
   57             "divkbaseb: divisor cannot be 0");
 
   60             + 
") must be at least 2");
 
   63             + 
") must be less than or equal to the alphabet size (" 
   66     automaton_t res = make_shared_ptr<automaton_t>(ctx);
 
   72     std::vector<state_t> 
states;
 
   73     for (
unsigned i = 0; i < divisor; ++i)
 
   74       states.emplace_back(res->add_state());
 
   76     res->set_initial(
states[0]);
 
   79     for (
unsigned i = 0; i < divisor; ++i)
 
   82         for (
unsigned l = 0; l < base; ++l)
 
   84             int d = (e + l) % divisor;
 
std::vector< state_t > states(abstract_automaton_t const *aut, bool all)
std::string to_string(identities i)
std::shared_ptr< internal::mutable_automaton_impl< Context > > mutable_automaton
Definition: mutable_automaton.hh:45
void require(bool b, Args &&... args)
If b is not verified, raise an error with args as message.
Definition: raise.hh:55
mutable_automaton< Context > divkbaseb(const Context &ctx, unsigned divisor, unsigned base)
Returns an automaton which recognizes numbers in the given base which are multiple of divisor.
Definition: divkbaseb.hh:48
Main namespace of Awali.
Definition: ato.hh:22