The following snippet of code takes 0.7s. I would like to improve the speed. Basically, the code adds all values in b with the same index as a, and stores them in the same position, found in a's index, but in a different array. So basically array a holds values ranging from 0-255, which represent the indexes of temp array.
a = np.random.randint(256, size=(40000,2))
b= np.arange(1280000).reshape(40000, 32)
temp = np.zeros((1,32,256,256))
for indx, pnt in enumerate(a):
temp[0,:,pnt[0],pnt[1]] += b[indx,:]
Thanks.
temp[0,:,pnt[0],pnt[1]]sincetempis a 2D array.temp = np.zeros((32,256,256))...