speed up transition probability calculation