Generalise bindings to compute 'dissimilarity' instead of 'distance'.

'dissimilarity' is a generic term that generalises distance and scalar
product. This way we can use the same bindings for both cases, by just
adding an extra 'mode' parameter that is used to choose between them.