I'm not sure if this is possible to do in numpy but what I would like is to create a tuple of coordinates.
For example, for 3x3 matrix I want the matrix to be:
[[(0,0), (0,1), (0,2)],
[(1,0), (1,1), (1,2)],
[(2,0), (2,1), (2,2)]]
Because ultimately I want to pass the coordinates into a function and create a matrix of the func result
So if the function was called myfunc had type (i,j) -> k I would want the result matrix to look like this
[[myfunc(0,0), myfunc(0,1), myfunc(0,2)],
[myfunc(1,0), myfunc(1,1), myfunc(1,2)],
[myfunc(2,0), myfunc(2,1), myfunc(2,2)]]
And I've looked at solutions like np.meshgrid:
i_indices, j_indices = np.meshgrid(np.arange(3),np.arange(3),indexing='ij')
But then I'm still stuck b/c I don't know how to iterate through those coordinate matrices i_index and j_index without a for loop to create the resultant matrix I want.
Basically is this possible to do in numpy? If so, how? Or will have have to use a for loop?
Aand I realized I just needed to use
np.vectorize