code: public double logp(int[] o, int[] s) {
          if (o.length != s.length) {
              throw new IllegalArgumentException("The observation sequence and state sequence are not the same length.");
          }
  
          int n = s.length;
          double p = log(pi[s[0]]) + log(b[s[0]][o[0]]);
          for (int i = 1; i < n; i++) {
              p += log(a[s[i - 1]][s[i]]) + log(b[s[i]][o[i]]);
          }
  
          return p;
      }
docs: Returns the log joint probability of an observation sequence along a
  state sequence given this HMM.
  
  @param o an observation sequence.
  @param s a state sequence.
  @return the log joint probability P(o, s | H) given the model H.