problem with computing R marginal

value was being reused for every trajectory in the sweep
should be computed new for each trajectory.