adding pairwise computation