Transition matrix code