rep_dyn function

Replicate a scan in the dynamic dimension.