States vs Subclasses

Normally, each signal class corresponds to a different Markov state. However, it is possible for the same signal class to appear more than once in a pre-defined sequence. In this case, there will be more states than signal classes (See Section 14.3.1). For this purpose, we define the variable state_to_subclass, which is of length N states and carries the signal class index of each state. For example, if the data is such that signal classes 1 and 2 repeat twice, there will be nstate=4 states and we might define
   state_to_subclass = [1 2 1 2];
The transitioning of states can also be constrained using the nstate-by-nstate matrix A_mask which is used as a mask for the state transition matrix. For example, setting
   A_mask = [1 1 1 1;
             0 1 1 1;
             0 0 1 1;
             0 0 0 1];
will result in a forward-only state transition matrix. The variables Pi_mask, beta_end are vectors of length nstate that define the states in which MR-HMM can start and end, respectively. Leaving any of these A_mask, Pi_mask, beta_end empty or not supplying them assumes that they are full (all states and state transitions allowed).