title: Fortran calculate distance of many points to fixed point
body: <p>Is there a more elegant and concise way to calculate the distances between a set of points and a fixed point than doing this?</p>
  
  <pre><code>real, dimension(3, numPoints) :: points
  real, dimension(3) :: source
  real, dimension(numPoints) :: r
  
  r = sqrt((points(1,:) - source(1))**2 + &amp;
           (points(2,:) - source(2))**2 + 
           (points(3,:) - source(3))**2)
  </code></pre>
  
  <p>I tried</p>
  
  <pre><code>r = sqrt(sum((points - source)**2,1))
  </code></pre>
  
  <p>but this - unsurprisingly - does not work.</p>