Variation of distance matrix