I\'ve been working on speeding up a resampling calculation for a particle filter. As python has many ways to speed it up, I though I\'d try them all. Unfortunately, the numba ve
Faster numpy version (10x speedup compared to numpy_resample)
numpy
numpy_resample
def numpy_faster(qs, xs, rands): lookup = np.cumsum(qs) mm = lookup[None,:]>rands[:,None] I = np.argmax(mm,1) return xs[I]