Calculating similarity matrices over all entity pairs for each distance measure.