RepDis with similarity matrix