Added write similarity matrix to file