viterbi function

Viterbi algorithm for state decoding in homogeneous HMMs