Added Similarity Matrix function and SSE calculation function