modification of the auxiliary particle filter and of the resample routine that can return either the resampled particles or the resampling index depending on the input (particles = 0 or not)