title: Adding all elements of a multi-dimensional array in Python
body: <p>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?</p>
  
  <p>Here is how I would do it with a loop</p>
  
  <pre><code>for i in range(z):
     v[i] = np.sum(A[:,:,i,:])
  </code></pre>