Pairwise cosine distance

In fact, it does not work for a 5D input.