Is it possible to sequentially index points in a numpy array when the number of dimensions n is arbitrary?
Example of desired behavior when n=4 :
>>> A = np.mgrid[[slice(0,11,1)]*4]
>>> A[XXX_0] # The "first" point in A
array([0,0,0,0])
>>> A[XXX_1] # The "second" point in A
array([0,0,0,1])
>>> A[XXX_11]
array([0,0,1,0])
>>> A[XXX_14640] # The "last" point in A
array([10,10,10,10])
What should replace the above XXX in order to get the above output?
I do not want to convert A to a 2D array, (e.g., using A = A.T.reshape(-1,n)) because this removes the grid structure (produced by mgrid) that is necessary for my application.