With regards to my comment below, I would therefore replace this part of the code with:

```
for p in range(start, end):
    Xf[p] = X[X_sample_stride * samples[p] + X_fx_stride * current_feature]
qsort(Xf + start, samples + start, end - start)
```