pairwise vectorization