code: def _generate_a_indptr(num_states, s_indices, out):
      idx = 0
      out[0] = 0
      for s in range(num_states-1):
          while(s_indices[idx] == s):
              idx += 1
          out[s+1] = idx
      out[num_states] = len(s_indices)