Updating the pairwise metrics.

Updating the pairwise metrics including new tests and sparse matrices support for several distances.