cosine similarity implemented, working on n-sim