def calculate_dist_vincenty(latitudes, longitudes):
 assert (len(latitudes) == len(longitudes)), 'latitudes and longitudes must be lists of exactly the same size'
 size = len(latitudes)
 dtx_mtx = zeros([size, size])
 for i in range(size):
  for j in range(i, size):
   dtx_mtx[(i, j)] = dtx_mtx[(j, i)] = dist_vincenty(latitudes[i], longitudes[i], latitudes[j], longitudes[j])
 return dtx_mtx

def calculate_dist_vincenty ( latitudes , longitudes ) : assert ( len ( latitudes ) == len ( longitudes ) ) , 'latitudes and longitudes must be lists of exactly the same size' size = len ( latitudes ) dtx_mtx = zeros ( [ size , size ] ) for i in range ( size ) : for j in range ( i , size ) : dtx_mtx [ ( i , j ) ] = dtx_mtx [ ( j , i ) ] = dist_vincenty ( latitudes [ i ] , longitudes [ i ] , latitudes [ j ] , longitudes [ j ] ) return dtx_mtx
returns the distance matrix from calculating dist_vicenty latitudes .