title: Euclidean distance in Python
body: <p>I have two 3000x3 vectors and I'd like to compute 1-to-1 Euclidean distance between them. For example, vec1 is</p>
  
  <pre><code>1 1 1  
  2 2 2    
  3 3 3  
  4 4 4  
  ...
  </code></pre>
  
  <p>The vec2 is</p>
  
  <pre><code>2 2 2
  3 3 3  
  4 4 4  
  5 5 5  
  ...
  </code></pre>
  
  <p>I'd like to get the results as</p>
  
  <pre><code>1.73205081  
  1.73205081
  1.73205081
  1.73205081
  ...
  </code></pre>
  
  <p>I tried<code>scipy.spatial.distance.cdist(vec1,vec2)</code>, and it returns a 3000x3000 matrix whereas I only need the main diagonal. I also tried <code>np.sqrt(np.sum((vec1-vec2)**2 for vec1,vec2 in zip(vec1,vec2)))</code> and it didn't work for my purpose. Is there any way to compute the distances please? I'd appreciate any comments.</p>