Add a hack so that pair-wise similarities are only computed once.