In the following case:
a = np.zeros(35)
# create a view
av = a[3:10]
assert np.may_share_memory(a, av)
some_ind = array([0,5,6,24])
# trying to create a second view of another slice of a
av2 = a[some_ind] # or a[np.where(some_ind)]
assert np.may_share_memory(a, av2) # raise AssertionError
What would be the procedure such that av2 would be a view of the slice of a corresponding to the indices some_ind?
I thought about creating a mask array but found in the doc that copies were made using mask arrays.
In other words, my aim, if it is possible, is to be able to create a view of a slice of an array with indices from the initial array not regularly spaced.