Distances (v1.8.0)
Fast and generic distance functions for high-dimensional data.
Usage
Add this to your project:
> cargo add distances@1.8.0
Use it in your project:
use Number;
use euclidean;
let a = ;
let b = ;
let distance: f32 = euclidean;
assert!;
Features
- A
Numbertrait to abstract over different numeric types.- Distance functions are generic over the return type implementing
Number. - Distance functions may also be generic over the input type being a collection of
Numbers.
- Distance functions are generic over the return type implementing
- SIMD accelerated implementations for float types.
- Python bindings with
maturinandpyo3. -
no_stdsupport.
Available Distance Functions
- Vectors (high-dimensional data):
-
euclidean -
squared_euclidean -
manhattan -
chebyshev -
minkowski- General Lp-norm.
-
minkowski_p- General Lp-norm to the
pth power.
- General Lp-norm to the
-
cosine -
hamming -
canberra -
bray_curtis -
pearson1.0 - rwhereris the Pearson Correlation Coefficient
-
- Probability distributions:
-
wasserstein -
bhattacharyya -
hellinger
-
- String data, e.g. for genomic sequences:
-
levenshtein -
needleman_wunsch -
smith_waterman -
hamming - Normalized versions of the above.
-
- Sets:
-
jaccard -
dice -
kulsinski -
hausdorff
-
- Graphs:
-
tanamoto
-
- Time series:
Contributing
Contributions are welcome, encouraged, and appreciated! See CONTRIBUTING.md.
License
Licensed under the MIT license.