Basic HMM implementation completed.

TODO: smoothing, working in log space.