added batch pairwise computation