Port make_compatible_distance_matrices; add basic tests