title: Numpy Broadcast to perform euclidean distance vectorized
body: <p>I have matrices that are 2 x 4 and 3 x 4. I want to find the euclidean distance across rows, and get a 2 x 3 matrix at the end. Here is the code with one for loop that computes the euclidean distance for every row vector in a against all b row vectors. How do I do the same without using for loops?</p>
  
  <pre><code> import numpy as np
  a = np.array([[1,1,1,1],[2,2,2,2]])
  b = np.array([[1,2,3,4],[1,1,1,1],[1,2,1,9]])
  dists = np.zeros((2, 3))
  for i in range(2):
        dists[i] = np.sqrt(np.sum(np.square(a[i] - b), axis=1))
  </code></pre>