Precomputing similarities

Now we pre-compute the similarity matrix, and this takes up a lot of
memory.