Used sparse array representation for similarity calculations