added sparse matrix version; added transitional prob tweak function