Common framework for calculating distance matrices

WWW: https://blasern.github.io/rdist
