Implemented forward-backward and viterbi in log-domain.