I have an array A, which is x-by-y-by-z-by-w dimensional. I would like to get a z dimensional vector v, where each element of v is the sum of the elements of A controling for the coordinate of v. Is there a way I can do this w/o loops using numpy?
Here is how I would do it with a loop
for i in range(z):
v[i] = np.sum(A[:,:,i,:])