title: Is there a faster way to perform this operation?
body: <p>I am calculating the distance between every point of an array and a certain point, is there a faster way than to create a loop? This calculation can take me up to an hour for 3D matrices of size 100x100x100 I'm sure there's a faster way to do it, I just can't figure it out.</p>
  <pre><code>phi = np.zeros_like(i).astype(float)
  ri2 = np.array((int(2*N/5) , int(N/2), int(N/2)))
  ri1 = np.array((int(3*N/5) , int(N/2), int(N/2)))
  for index, a in np.ndenumerate(phi):
      x,y,z = index
      phi[(i==x)&amp;(j==y)&amp;(k==z)] = 1/np.linalg.norm(index-ri2) + 1/np.linalg.norm(np.array(index - ri1))
  </code></pre>