Crates.io | distances |
lib.rs | distances |
version | 1.8.0 |
source | src |
created_at | 2020-04-22 14:18:32.415103 |
updated_at | 2024-10-12 16:28:40.623462 |
description | Fast and generic distance functions for high-dimensional data. |
homepage | |
repository | |
max_upload_size | |
id | 232947 |
size | 151,164 |
Fast and generic distance functions for high-dimensional data.
Add this to your project:
> cargo add distances@1.8.0
Use it in your project:
use distances::Number;
use distances::vectors::euclidean;
let a = [1.0_f32, 2.0, 3.0];
let b = [4.0_f32, 5.0, 6.0];
let distance: f32 = euclidean(&a, &b);
assert!((distance - (27.0_f32).sqrt()).abs() < 1e-6);
Number
trait to abstract over different numeric types.
Number
.Number
s.maturin
and pyo3
.no_std
support.euclidean
squared_euclidean
manhattan
chebyshev
minkowski
minkowski_p
p
th power.cosine
hamming
canberra
bray_curtis
pearson
1.0 - r
where r
is the Pearson Correlation Coefficientwasserstein
bhattacharyya
hellinger
levenshtein
needleman_wunsch
smith_waterman
hamming
jaccard
dice
kulsinski
hausdorff
tanamoto
Contributions are welcome, encouraged, and appreciated! See CONTRIBUTING.md.
Licensed under the MIT license.