libdistance documentation

  • The libdistance library provides an efficient implementation of usual (and more unusal) mathematical distance functions.

  • It relies on the ArrayFire library for parallel computing on CPUs as well as GPUs (CUDA and OpenCL).

  • It implements the following core functions:

    • The distance between the two vectors x and y:

      distance::dist(x, y, metric)
    • The distances between each pair of the two collections of inputs (function similar to scipy.spatial.distance.cdist):

      distance::cdist(X, Y, metric)
    • The pairwise distances between observations in n-dimensional space (function similar to scipy.spatial.distance.pdist):

      distance::pdist(X, metric)
    • The Dynamic Time Wrapping cost and path of a distance matrix:

      C = distance::dtw::cost(D)
      P = distance::dtw::path(C)
  • The following metrics are proposed:

    • Euclidean

    • Cosine similarity

    • Kullback-Leibler

    • etc…

    See Metrics for a full list.