11
I've got a large one-dimensional array of integers I need to take slices off. That's trivial, I'd just do a[start:end]. The problem is that I need more of these slices. a[start:end] does not work if start and end are arrays. For loop could be used for this, but I need it to be as fast as possible (it is a bottleneck), so a native numpy solution would be welcome.
To further illustrate, I have this:
a = numpy.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], numpy.int16)
start = numpy.array([1, 5, 7], numpy.int16)
end = numpy.array([2, 10, 9], numpy.int16)
And need to somehow make it into this:
[[1], [5, 6, 7, 8, 9], [7, 8]]