Computing transition matrices