I have a project in python where I want to get a 2D matrix filled with coordinates:
First, I use the meshgrid function to get my coordinates in 2 arrays:
X, Y = np.meshgrid(np.arange(5), np.arange(5))
I get:
X = 0 1 2 3 4 Y = 0 0 0 0 0
0 1 2 3 4 1 1 1 1 1
0 1 2 3 4 2 2 2 2 2
0 1 2 3 4 3 3 3 3 3
0 1 2 3 4 4 4 4 4 4
Now, I'd like to merge the two arrays into a single array of tuples like this:
Coordinates = (0,0) (1,0) (2,0) (3,0) (4,0)
(0,1) (1,1) (2,1) (3,1) (4,1)
(0,2) (1,2) (2,2) (3,2) (4,2)
(0,3) (1,3) (2,3) (3,3) (4,3)
(0,4) (1,4) (2,4) (3,4) (4,4)
And I want to create a really big matrix, like 10 000 x 10 000 , so it has to be really fast (as fast as possible in fact) ...