update calculation of sum of cosine similarity