Faster accessing 2D numpy/array or Large 1D numpy/array

476 Views Asked by At

I am performing prioritized sweeping for which I have a matrix which has 1000*1000 cells (gridworld) whose cells I have to access repeatedly in a while true loop for assignment (I am not essentially iterating over the list but all cells are accessed more than once). Right now I'm mapping my positions (i,j) of matrix to store in a 1D array. So my 1000*1000 matrix is one large 1*(1000000) list. I am wondering if this is going to slow down fetch time and I am better off using 1000*1000 matrix. Also which is faster numpy or using lists ? It would be great if you could help me out with this!

0

There are 0 best solutions below