compute_distance_matrix function

Compute distance matrix