added code for all pair similarity computations