viterbi_p function

Viterbi algorithm for state decoding in periodically inhomogeneous HMMs