Taking inspiration from the answer posted by jin-pendragon, I found a solution using np.minimum.reduceat
. You need an array of length m
containing the slice starting points (so the first element is always 0
), let's call it start_indices
, and then you can do:
mins = np.minimum.reduceat(myarray, start_indices)