get_dist function

Get a distance matrix