# 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.

## Licence and copyright¶

Copyright 2019 Inria

This work is founded by the grant *ADT-193* from Inria and developed within the Cognitive Machine
Learning research team.

libdistance is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

libdistance is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with libdistance. If not, see http://www.gnu.org/licenses/.