totally vectorize forward/backward prob function