Name | abd-distances JSON |
Version |
1.0.3
JSON |
| download |
home_page | None |
Summary | Distance functions: A drop-in replacement for, and a super-set of the scipy.spatial.distance module. |
upload_time | 2024-03-22 19:39:43 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
distance
metric
simd
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Algorithms for Big Data: Distances (v1.0.3)
This package contains algorithms for computing distances between data points.
It is a thin Python wrapper around the `distances` crate, in Rust.
It provides drop-in replacements for the distance functions in `scipy.spatial.distance`.
## Supported Distance Functions
## Installation
```bash
pip install abd-distances
```
## Usage
```python
import math
import numpy
import abd_distances.simd as distance
a = numpy.array([i for i in range(10_000)], dtype=numpy.float32)
b = a + 1.0
dist = distance.euclidean(a, b)
assert math.fabs(dist - 100.0) < 1e-6
print(dist)
# 100.0
```
### Vector Distances
- [x] Bray-Curtis: `abd_distances.vector.braycurtis`
- [x] Canberra: `abd_distances.vector.canberra`
- [x] Chebyshev: `abd_distances.vector.chebyshev`
- [ ] Correlation
- [x] Cosine: `abd_distances.vector.cosine`
- [x] Euclidean: `abd_distances.vector.euclidean`
- [ ] Jensen-Shannon
- [ ] Mahalanobis
- [x] Manhattan: `abd_distances.vector.manhattan` and `abd_distances.vector.cityblock`
- [x] Minkowski: `abd_distances.vector.minkowski`
- [ ] Standardized Euclidean
- [x] Squared Euclidean: `abd_distances.vector.sqeuclidean`
- [x] Pairwise Distances: `abd_distances.vector.cdist` and `abd_distances.vector.pdist`
- [ ] ...
#### Boolean Distances
- [ ] Dice
- [ ] Hamming
- [ ] Jaccard
- [ ] Kulczynski 1D
- [ ] Rogers-Tanimoto
- [ ] Russell-Rao
- [ ] Sokal-Michener
- [ ] Sokal-Sneath
- [ ] Yule
- [ ] ...
### SIMD-Accelerated Vector Distances
- [x] Euclidean: `abd_distances.simd.euclidean`
- [x] Squared Euclidean: `abd_distances.simd.sqeuclidean`
- [x] Cosine: `abd_distances.simd.cosine`
- [x] Pairwise Distances: `abd_distances.simd.cdist` and `abd_distances.simd.pdist`
- [ ] ...
### String Distances
- [x] Hamming: `abd_distances.strings.hamming`
- [x] Levenshtein: `abd_distances.strings.levenshtein`
- [x] Needleman-Wunsch: `abd_distances.strings.needleman_wunsch`
- [ ] Smith-Waterman
- [ ] Pairwise Distances
- [ ] ...
## Benchmarks
### SIMD-Accelerated Vector Distance Benchmarks
These benchmarks were run on an Intel Core i7-11700KF CPU @ 4.900GHz, using **a single thread**.
The OS was Arch Linux, with kernel version 6.7.4-arch1-1.
The "Min", "Max", and "Mean" columns show the minimum, maximum, and mean times (in seconds), respectively, taken to compute the pairwise distances using the functions from `scipy.spatial.distance`.
The "Min (+)", "Max (+)", and "Mean (+)" columns show the speedup of the this package's functions over the `scipy` functions.
All pairwise distances (`cdist` and `pdist`) were computed for 200x200 vectors of 500 dimensions, and the average time was taken over 100 runs.
All individual distances were computed for 20x20 vectors of 500 dimensions, and the average time was taken over 100 runs.
| Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
|-------------------------|---------|---------|---------|-----------------|-----------------|-----------------|
| cdist, euclidean, f32 | 2.560 | 2.576 | 2.566 | 0.185 (13.9x) | 0.196 (13.2x) | 0.188 (13.7x) |
| cdist, euclidean, f64 | 2.398 | 2.406 | 2.401 | 0.292 (8.2x) | 0.307 (7.8x) | 0.298 (8.0x) |
| cdist, sqeuclidean, f32 | 2.519 | 2.527 | 2.523 | 0.182 (13.9x) | 0.197 (12.8x) | 0.187 (13.5x) |
| cdist, sqeuclidean, f64 | 2.381 | 2.393 | 2.389 | 0.293 (8.1x) | 0.318 (7.5x) | 0.301 (7.9x) |
| cdist, cosine, f32 | 4.011 | 4.021 | 4.016 | 0.625 (6.4x) | 0.637 (6.3x) | 0.632 (6.4x) |
| cdist, cosine, f64 | 3.978 | 4.009 | 3.992 | 0.626 (6.4x) | 0.666 (6.0x) | 0.638 (6.3x) |
| pdist, euclidean, f32 | 1.235 | 1.249 | 1.241 | 0.252 (4.9x) | 0.263 (4.7x) | 0.257 (4.8x) |
| pdist, euclidean, f64 | 1.216 | 1.262 | 1.234 | 0.302 (4.0x) | 0.312 (4.0x) | 0.308 (4.0x) |
| pdist, sqeuclidean, f32 | 1.229 | 1.250 | 1.237 | 0.251 (4.9x) | 0.303 (4.1x) | 0.265 (4.7x) |
| pdist, sqeuclidean, f64 | 1.209 | 1.213 | 1.211 | 0.306 (3.9x) | 0.313 (3.9x) | 0.310 (3.9x) |
| pdist, cosine, f32 | 2.001 | 2.017 | 2.006 | 0.468 (4.3x) | 0.484 (4.2x) | 0.478 (4.2x) |
| pdist, cosine, f64 | 1.991 | 2.004 | 1.996 | 0.461 (4.3x) | 0.476 (4.2x) | 0.471 (4.2x) |
| euclidean, f32 | 0.644 | 0.670 | 0.654 | 0.076 (8.5x) | 0.080 (8.4x) | 0.078 (8.3x) |
| euclidean, f64 | 0.672 | 0.701 | 0.682 | 0.097 (6.9x) | 0.102 (6.9x) | 0.100 (6.8x) |
| sqeuclidean, f32 | 0.506 | 0.512 | 0.508 | 0.076 (6.6x) | 0.079 (6.5x) | 0.078 (6.5x) |
| sqeuclidean, f64 | 0.515 | 0.519 | 0.518 | 0.100 (5.1x) | 0.104 (5.0x) | 0.103 (5.0x) |
| cosine, f32 | 0.668 | 0.687 | 0.677 | 0.110 (6.1x) | 0.113 (6.1x) | 0.111 (6.1x) |
| cosine, f64 | 0.465 | 0.472 | 0.469 | 0.127 (3.7x) | 0.130 (3.6x) | 0.129 (3.6x) |
<table>
<tr>
<th> f32 </th>
<th> f64 </th>
</tr>
<tr>
<td>
![Euclidean f32](images/SIMD-Euclidean_f32.png)
![Squared Euclidean f32](images/SIMD-Squared-Euclidean_f32.png)
![Cosine f32](images/SIMD-Cosine_f32.png)
</td>
<td>
![Euclidean f64](images/SIMD-Euclidean_f64.png)
![Squared Euclidean f64](images/SIMD-Squared-Euclidean_f64.png)
![Cosine f64](images/SIMD-Cosine_f64.png)
</td>
</tr>
</table>
### Vector Distance Benchmarks (No SIMD)
These benchmarks were run on an Intel Core i7-11700KF CPU @ 4.900GHz, using **a single thread**.
The OS was Arch Linux, with kernel version 6.7.4-arch1-1.
The "Min", "Max", and "Mean" columns show the minimum, maximum, and mean times (in seconds), respectively, taken to compute the pairwise distances using the functions from `scipy.spatial.distance`.
The "Min (+)", "Max (+)", and "Mean (+)" columns show the speedup of the this package's functions over the `scipy` functions.
All pairwise distances (`cdist` and `pdist`) were computed for 200x200 vectors of 500 dimensions, and the average time was taken over 100 runs.
All individual distances were computed for 20x20 vectors of 500 dimensions, and the average time was taken over 100 runs.
These benchmarks were run using the `richbench` package.
| Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
|-------------------------|---------|---------|---------|-----------------|-----------------|-----------------|
| braycurtis, f32 | 1.103 | 1.134 | 1.114 | 0.323 (3.4x) | 0.324 (3.5x) | 0.323 (3.4x) |
| braycurtis, f64 | 0.834 | 0.843 | 0.838 | 0.170 (4.9x) | 0.173 (4.9x) | 0.171 (4.9x) |
| canberra, f32 | 2.524 | 2.529 | 2.526 | 0.153 (16.5x) | 0.155 (16.3x) | 0.154 (16.4x) |
| canberra, f64 | 2.216 | 2.260 | 2.235 | 0.168 (13.2x) | 0.170 (13.3x) | 0.169 (13.2x) |
| chebyshev, f32 | 2.738 | 2.774 | 2.753 | 0.149 (18.3x) | 0.151 (18.4x) | 0.150 (18.4x) |
| chebyshev, f64 | 2.777 | 2.784 | 2.781 | 0.165 (16.8x) | 0.166 (16.8x) | 0.165 (16.8x) |
| euclidean, f32 | 0.641 | 0.641 | 0.641 | 0.150 (4.3x) | 0.150 (4.3x) | 0.150 (4.3x) |
| euclidean, f64 | 0.657 | 0.662 | 0.660 | 0.167 (3.9x) | 0.168 (3.9x) | 0.168 (3.9x) |
| sqeuclidean, f32 | 0.506 | 0.509 | 0.507 | 0.149 (3.4x) | 0.149 (3.4x) | 0.149 (3.4x) |
| sqeuclidean, f64 | 0.514 | 0.518 | 0.516 | 0.165 (3.1x) | 0.173 (3.0x) | 0.170 (3.0x) |
| cityblock, f32 | 0.437 | 0.443 | 0.440 | 0.150 (2.9x) | 0.150 (2.9x) | 0.150 (2.9x) |
| cityblock, f64 | 0.444 | 0.451 | 0.447 | 0.167 (2.7x) | 0.168 (2.7x) | 0.168 (2.7x) |
| cosine, f32 | 0.659 | 0.668 | 0.664 | 0.314 (2.1x) | 0.315 (2.1x) | 0.314 (2.1x) |
| cosine, f64 | 0.459 | 0.471 | 0.465 | 0.321 (1.4x) | 0.325 (1.4x) | 0.324 (1.4x) |
| cdist, braycurtis, f32 | 4.902 | 4.906 | 4.904 | 1.802 (2.7x) | 1.875 (2.6x) | 1.833 (2.7x) |
| cdist, braycurtis, f64 | 4.765 | 4.775 | 4.768 | 0.710 (6.7x) | 0.735 (6.5x) | 0.725 (6.6x) |
| cdist, canberra, f32 | 6.914 | 6.943 | 6.930 | 1.356 (5.1x) | 1.385 (5.0x) | 1.367 (5.1x) |
| cdist, canberra, f64 | 6.782 | 6.813 | 6.797 | 0.684 (9.9x) | 0.701 (9.7x) | 0.692 (9.8x) |
| cdist, chebyshev, f32 | 2.763 | 2.768 | 2.765 | 0.640 (4.3x) | 0.663 (4.2x) | 0.649 (4.3x) |
| cdist, chebyshev, f64 | 2.659 | 2.677 | 2.664 | 0.647 (4.1x) | 0.662 (4.0x) | 0.655 (4.1x) |
| cdist, euclidean, f32 | 2.563 | 2.570 | 2.564 | 0.644 (4.0x) | 0.658 (3.9x) | 0.653 (3.9x) |
| cdist, euclidean, f64 | 2.378 | 2.400 | 2.388 | 0.630 (3.8x) | 0.649 (3.7x) | 0.640 (3.7x) |
| cdist, sqeuclidean, f32 | 2.516 | 2.523 | 2.519 | 0.648 (3.9x) | 0.660 (3.8x) | 0.652 (3.9x) |
| cdist, sqeuclidean, f64 | 2.412 | 2.423 | 2.417 | 0.631 (3.8x) | 0.645 (3.8x) | 0.638 (3.8x) |
| cdist, cityblock, f32 | 4.545 | 4.552 | 4.548 | 0.647 (7.0x) | 0.671 (6.8x) | 0.658 (6.9x) |
| cdist, cityblock, f64 | 4.406 | 4.407 | 4.407 | 0.633 (7.0x) | 0.657 (6.7x) | 0.647 (6.8x) |
| cdist, cosine, f32 | 4.010 | 4.020 | 4.013 | 2.254 (1.8x) | 2.292 (1.8x) | 2.270 (1.8x) |
| cdist, cosine, f64 | 3.987 | 3.992 | 3.990 | 2.241 (1.8x) | 2.288 (1.7x) | 2.258 (1.8x) |
| pdist, braycurtis, f32 | 2.382 | 2.387 | 2.385 | 1.062 (2.2x) | 1.074 (2.2x) | 1.069 (2.2x) |
| pdist, braycurtis, f64 | 2.368 | 2.378 | 2.371 | 0.510 (4.6x) | 0.523 (4.5x) | 0.516 (4.6x) |
| pdist, canberra, f32 | 3.374 | 3.411 | 3.389 | 0.831 (4.1x) | 0.841 (4.1x) | 0.835 (4.1x) |
| pdist, canberra, f64 | 3.369 | 3.411 | 3.396 | 0.504 (6.7x) | 0.515 (6.6x) | 0.509 (6.7x) |
| pdist, chebyshev, f32 | 1.362 | 1.364 | 1.363 | 0.478 (2.9x) | 0.488 (2.8x) | 0.484 (2.8x) |
| pdist, chebyshev, f64 | 1.338 | 1.343 | 1.341 | 0.476 (2.8x) | 0.485 (2.8x) | 0.481 (2.8x) |
| pdist, euclidean, f32 | 1.241 | 1.250 | 1.246 | 0.482 (2.6x) | 0.487 (2.6x) | 0.484 (2.6x) |
| pdist, euclidean, f64 | 1.222 | 1.228 | 1.225 | 0.474 (2.6x) | 0.503 (2.4x) | 0.482 (2.5x) |
| pdist, sqeuclidean, f32 | 1.224 | 1.247 | 1.233 | 0.477 (2.6x) | 0.490 (2.5x) | 0.481 (2.6x) |
| pdist, sqeuclidean, f64 | 1.211 | 1.214 | 1.213 | 0.470 (2.6x) | 0.478 (2.5x) | 0.475 (2.6x) |
| pdist, cityblock, f32 | 2.204 | 2.207 | 2.205 | 0.483 (4.6x) | 0.491 (4.5x) | 0.486 (4.5x) |
| pdist, cityblock, f64 | 2.189 | 2.198 | 2.192 | 0.476 (4.6x) | 0.483 (4.5x) | 0.481 (4.6x) |
| pdist, cosine, f32 | 2.000 | 2.004 | 2.002 | 1.292 (1.5x) | 1.302 (1.5x) | 1.296 (1.5x) |
| pdist, cosine, f64 | 1.988 | 1.992 | 1.990 | 1.288 (1.5x) | 1.296 (1.5x) | 1.292 (1.5x) |
<table>
<tr>
<th> F32 </th>
<th> F64 </th>
</tr>
<tr>
<td>
![Chebyshev f32](images/Chebyshev_f32.png)
![Euclidean f32](images/Euclidean_f32.png)
![Squared Euclidean f32](images/Squared-Euclidean_f32.png)
![Manhattan f32](images/Manhattan_f32.png)
![Canberra f32](images/Canberra_f32.png)
![Cosine f32](images/Cosine_f32.png)
</td>
<td>
![Chebyshev f64](images/Chebyshev_f64.png)
![Euclidean f64](images/Euclidean_f64.png)
![Squared Euclidean f64](images/Squared-Euclidean_f64.png)
![Manhattan f64](images/Manhattan_f64.png)
![Canberra f64](images/Canberra_f64.png)
![Cosine f64](images/Cosine_f64.png)
</td>
</tr>
</table>
<table>
<tr>
<th> u32 </th>
<th> u64 </th>
</tr>
<tr>
<td>
![Bray-Curtis u32](images/Bray-Curtis_u32.png)
</td>
<td>
![Bray-Curtis u64](images/Bray-Curtis_u64.png)
</td>
</tr>
</table>
</table>
### String Distance Benchmarks
These benchmarks were run on an Intel Core i7-11700KF CPU @ 4.900GHz, using **a single thread**.
The OS was Arch Linux, with kernel version 6.7.4-arch1-1.
All string distances were computed 100 times each, among different pairs of strings, and the average time was taken.
<table>
<tr>
<td>
![Hamming](images/Hamming_str.png)
![Levenshtein](images/Levenshtein_str.png)
![Needleman-Wunsch](images/Needleman-Wunsch_str.png)
</td>
</tr>
</table>
## License
This package is licensed under the MIT license.
Raw data
{
"_id": null,
"home_page": null,
"name": "abd-distances",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "distance, metric, simd",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/aa/c7/e394242ec3deb38d8e1452e2bcfad5376abe8ecae17c3c119324ad0a5db6/abd_distances-1.0.3.tar.gz",
"platform": null,
"description": "# Algorithms for Big Data: Distances (v1.0.3)\n\nThis package contains algorithms for computing distances between data points.\nIt is a thin Python wrapper around the `distances` crate, in Rust.\nIt provides drop-in replacements for the distance functions in `scipy.spatial.distance`.\n\n## Supported Distance Functions\n\n## Installation\n\n```bash\npip install abd-distances\n```\n\n## Usage\n\n```python\nimport math\n\nimport numpy\nimport abd_distances.simd as distance\n\na = numpy.array([i for i in range(10_000)], dtype=numpy.float32)\nb = a + 1.0\n\ndist = distance.euclidean(a, b)\n\nassert math.fabs(dist - 100.0) < 1e-6\n\nprint(dist)\n# 100.0\n```\n\n### Vector Distances\n\n- [x] Bray-Curtis: `abd_distances.vector.braycurtis`\n- [x] Canberra: `abd_distances.vector.canberra`\n- [x] Chebyshev: `abd_distances.vector.chebyshev`\n- [ ] Correlation\n- [x] Cosine: `abd_distances.vector.cosine`\n- [x] Euclidean: `abd_distances.vector.euclidean`\n- [ ] Jensen-Shannon\n- [ ] Mahalanobis\n- [x] Manhattan: `abd_distances.vector.manhattan` and `abd_distances.vector.cityblock`\n- [x] Minkowski: `abd_distances.vector.minkowski`\n- [ ] Standardized Euclidean\n- [x] Squared Euclidean: `abd_distances.vector.sqeuclidean`\n- [x] Pairwise Distances: `abd_distances.vector.cdist` and `abd_distances.vector.pdist`\n- [ ] ...\n\n#### Boolean Distances\n\n- [ ] Dice\n- [ ] Hamming\n- [ ] Jaccard\n- [ ] Kulczynski 1D\n- [ ] Rogers-Tanimoto\n- [ ] Russell-Rao\n- [ ] Sokal-Michener\n- [ ] Sokal-Sneath\n- [ ] Yule\n- [ ] ...\n\n### SIMD-Accelerated Vector Distances\n\n- [x] Euclidean: `abd_distances.simd.euclidean`\n- [x] Squared Euclidean: `abd_distances.simd.sqeuclidean`\n- [x] Cosine: `abd_distances.simd.cosine`\n- [x] Pairwise Distances: `abd_distances.simd.cdist` and `abd_distances.simd.pdist`\n- [ ] ...\n\n### String Distances\n\n- [x] Hamming: `abd_distances.strings.hamming`\n- [x] Levenshtein: `abd_distances.strings.levenshtein`\n- [x] Needleman-Wunsch: `abd_distances.strings.needleman_wunsch`\n- [ ] Smith-Waterman\n- [ ] Pairwise Distances\n- [ ] ...\n\n## Benchmarks\n\n### SIMD-Accelerated Vector Distance Benchmarks\n\nThese benchmarks were run on an Intel Core i7-11700KF CPU @ 4.900GHz, using **a single thread**.\nThe OS was Arch Linux, with kernel version 6.7.4-arch1-1.\n\nThe \"Min\", \"Max\", and \"Mean\" columns show the minimum, maximum, and mean times (in seconds), respectively, taken to compute the pairwise distances using the functions from `scipy.spatial.distance`.\nThe \"Min (+)\", \"Max (+)\", and \"Mean (+)\" columns show the speedup of the this package's functions over the `scipy` functions.\nAll pairwise distances (`cdist` and `pdist`) were computed for 200x200 vectors of 500 dimensions, and the average time was taken over 100 runs.\nAll individual distances were computed for 20x20 vectors of 500 dimensions, and the average time was taken over 100 runs.\n\n| Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |\n|-------------------------|---------|---------|---------|-----------------|-----------------|-----------------|\n| cdist, euclidean, f32 | 2.560 | 2.576 | 2.566 | 0.185 (13.9x) | 0.196 (13.2x) | 0.188 (13.7x) |\n| cdist, euclidean, f64 | 2.398 | 2.406 | 2.401 | 0.292 (8.2x) | 0.307 (7.8x) | 0.298 (8.0x) |\n| cdist, sqeuclidean, f32 | 2.519 | 2.527 | 2.523 | 0.182 (13.9x) | 0.197 (12.8x) | 0.187 (13.5x) |\n| cdist, sqeuclidean, f64 | 2.381 | 2.393 | 2.389 | 0.293 (8.1x) | 0.318 (7.5x) | 0.301 (7.9x) |\n| cdist, cosine, f32 | 4.011 | 4.021 | 4.016 | 0.625 (6.4x) | 0.637 (6.3x) | 0.632 (6.4x) |\n| cdist, cosine, f64 | 3.978 | 4.009 | 3.992 | 0.626 (6.4x) | 0.666 (6.0x) | 0.638 (6.3x) |\n| pdist, euclidean, f32 | 1.235 | 1.249 | 1.241 | 0.252 (4.9x) | 0.263 (4.7x) | 0.257 (4.8x) |\n| pdist, euclidean, f64 | 1.216 | 1.262 | 1.234 | 0.302 (4.0x) | 0.312 (4.0x) | 0.308 (4.0x) |\n| pdist, sqeuclidean, f32 | 1.229 | 1.250 | 1.237 | 0.251 (4.9x) | 0.303 (4.1x) | 0.265 (4.7x) |\n| pdist, sqeuclidean, f64 | 1.209 | 1.213 | 1.211 | 0.306 (3.9x) | 0.313 (3.9x) | 0.310 (3.9x) |\n| pdist, cosine, f32 | 2.001 | 2.017 | 2.006 | 0.468 (4.3x) | 0.484 (4.2x) | 0.478 (4.2x) |\n| pdist, cosine, f64 | 1.991 | 2.004 | 1.996 | 0.461 (4.3x) | 0.476 (4.2x) | 0.471 (4.2x) |\n| euclidean, f32 | 0.644 | 0.670 | 0.654 | 0.076 (8.5x) | 0.080 (8.4x) | 0.078 (8.3x) |\n| euclidean, f64 | 0.672 | 0.701 | 0.682 | 0.097 (6.9x) | 0.102 (6.9x) | 0.100 (6.8x) |\n| sqeuclidean, f32 | 0.506 | 0.512 | 0.508 | 0.076 (6.6x) | 0.079 (6.5x) | 0.078 (6.5x) |\n| sqeuclidean, f64 | 0.515 | 0.519 | 0.518 | 0.100 (5.1x) | 0.104 (5.0x) | 0.103 (5.0x) |\n| cosine, f32 | 0.668 | 0.687 | 0.677 | 0.110 (6.1x) | 0.113 (6.1x) | 0.111 (6.1x) |\n| cosine, f64 | 0.465 | 0.472 | 0.469 | 0.127 (3.7x) | 0.130 (3.6x) | 0.129 (3.6x) |\n\n<table>\n<tr>\n<th> f32 </th>\n<th> f64 </th>\n</tr>\n<tr>\n<td>\n\n![Euclidean f32](images/SIMD-Euclidean_f32.png)\n![Squared Euclidean f32](images/SIMD-Squared-Euclidean_f32.png)\n![Cosine f32](images/SIMD-Cosine_f32.png)\n\n</td>\n<td>\n\n![Euclidean f64](images/SIMD-Euclidean_f64.png)\n![Squared Euclidean f64](images/SIMD-Squared-Euclidean_f64.png)\n![Cosine f64](images/SIMD-Cosine_f64.png)\n\n</td>\n</tr>\n</table>\n\n### Vector Distance Benchmarks (No SIMD)\n\nThese benchmarks were run on an Intel Core i7-11700KF CPU @ 4.900GHz, using **a single thread**.\nThe OS was Arch Linux, with kernel version 6.7.4-arch1-1.\n\nThe \"Min\", \"Max\", and \"Mean\" columns show the minimum, maximum, and mean times (in seconds), respectively, taken to compute the pairwise distances using the functions from `scipy.spatial.distance`.\nThe \"Min (+)\", \"Max (+)\", and \"Mean (+)\" columns show the speedup of the this package's functions over the `scipy` functions.\nAll pairwise distances (`cdist` and `pdist`) were computed for 200x200 vectors of 500 dimensions, and the average time was taken over 100 runs.\nAll individual distances were computed for 20x20 vectors of 500 dimensions, and the average time was taken over 100 runs.\n\nThese benchmarks were run using the `richbench` package.\n\n| Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |\n|-------------------------|---------|---------|---------|-----------------|-----------------|-----------------|\n| braycurtis, f32 | 1.103 | 1.134 | 1.114 | 0.323 (3.4x) | 0.324 (3.5x) | 0.323 (3.4x) |\n| braycurtis, f64 | 0.834 | 0.843 | 0.838 | 0.170 (4.9x) | 0.173 (4.9x) | 0.171 (4.9x) |\n| canberra, f32 | 2.524 | 2.529 | 2.526 | 0.153 (16.5x) | 0.155 (16.3x) | 0.154 (16.4x) |\n| canberra, f64 | 2.216 | 2.260 | 2.235 | 0.168 (13.2x) | 0.170 (13.3x) | 0.169 (13.2x) |\n| chebyshev, f32 | 2.738 | 2.774 | 2.753 | 0.149 (18.3x) | 0.151 (18.4x) | 0.150 (18.4x) |\n| chebyshev, f64 | 2.777 | 2.784 | 2.781 | 0.165 (16.8x) | 0.166 (16.8x) | 0.165 (16.8x) |\n| euclidean, f32 | 0.641 | 0.641 | 0.641 | 0.150 (4.3x) | 0.150 (4.3x) | 0.150 (4.3x) |\n| euclidean, f64 | 0.657 | 0.662 | 0.660 | 0.167 (3.9x) | 0.168 (3.9x) | 0.168 (3.9x) |\n| sqeuclidean, f32 | 0.506 | 0.509 | 0.507 | 0.149 (3.4x) | 0.149 (3.4x) | 0.149 (3.4x) |\n| sqeuclidean, f64 | 0.514 | 0.518 | 0.516 | 0.165 (3.1x) | 0.173 (3.0x) | 0.170 (3.0x) |\n| cityblock, f32 | 0.437 | 0.443 | 0.440 | 0.150 (2.9x) | 0.150 (2.9x) | 0.150 (2.9x) |\n| cityblock, f64 | 0.444 | 0.451 | 0.447 | 0.167 (2.7x) | 0.168 (2.7x) | 0.168 (2.7x) |\n| cosine, f32 | 0.659 | 0.668 | 0.664 | 0.314 (2.1x) | 0.315 (2.1x) | 0.314 (2.1x) |\n| cosine, f64 | 0.459 | 0.471 | 0.465 | 0.321 (1.4x) | 0.325 (1.4x) | 0.324 (1.4x) |\n| cdist, braycurtis, f32 | 4.902 | 4.906 | 4.904 | 1.802 (2.7x) | 1.875 (2.6x) | 1.833 (2.7x) |\n| cdist, braycurtis, f64 | 4.765 | 4.775 | 4.768 | 0.710 (6.7x) | 0.735 (6.5x) | 0.725 (6.6x) |\n| cdist, canberra, f32 | 6.914 | 6.943 | 6.930 | 1.356 (5.1x) | 1.385 (5.0x) | 1.367 (5.1x) |\n| cdist, canberra, f64 | 6.782 | 6.813 | 6.797 | 0.684 (9.9x) | 0.701 (9.7x) | 0.692 (9.8x) |\n| cdist, chebyshev, f32 | 2.763 | 2.768 | 2.765 | 0.640 (4.3x) | 0.663 (4.2x) | 0.649 (4.3x) |\n| cdist, chebyshev, f64 | 2.659 | 2.677 | 2.664 | 0.647 (4.1x) | 0.662 (4.0x) | 0.655 (4.1x) |\n| cdist, euclidean, f32 | 2.563 | 2.570 | 2.564 | 0.644 (4.0x) | 0.658 (3.9x) | 0.653 (3.9x) |\n| cdist, euclidean, f64 | 2.378 | 2.400 | 2.388 | 0.630 (3.8x) | 0.649 (3.7x) | 0.640 (3.7x) |\n| cdist, sqeuclidean, f32 | 2.516 | 2.523 | 2.519 | 0.648 (3.9x) | 0.660 (3.8x) | 0.652 (3.9x) |\n| cdist, sqeuclidean, f64 | 2.412 | 2.423 | 2.417 | 0.631 (3.8x) | 0.645 (3.8x) | 0.638 (3.8x) |\n| cdist, cityblock, f32 | 4.545 | 4.552 | 4.548 | 0.647 (7.0x) | 0.671 (6.8x) | 0.658 (6.9x) |\n| cdist, cityblock, f64 | 4.406 | 4.407 | 4.407 | 0.633 (7.0x) | 0.657 (6.7x) | 0.647 (6.8x) |\n| cdist, cosine, f32 | 4.010 | 4.020 | 4.013 | 2.254 (1.8x) | 2.292 (1.8x) | 2.270 (1.8x) |\n| cdist, cosine, f64 | 3.987 | 3.992 | 3.990 | 2.241 (1.8x) | 2.288 (1.7x) | 2.258 (1.8x) |\n| pdist, braycurtis, f32 | 2.382 | 2.387 | 2.385 | 1.062 (2.2x) | 1.074 (2.2x) | 1.069 (2.2x) |\n| pdist, braycurtis, f64 | 2.368 | 2.378 | 2.371 | 0.510 (4.6x) | 0.523 (4.5x) | 0.516 (4.6x) |\n| pdist, canberra, f32 | 3.374 | 3.411 | 3.389 | 0.831 (4.1x) | 0.841 (4.1x) | 0.835 (4.1x) |\n| pdist, canberra, f64 | 3.369 | 3.411 | 3.396 | 0.504 (6.7x) | 0.515 (6.6x) | 0.509 (6.7x) |\n| pdist, chebyshev, f32 | 1.362 | 1.364 | 1.363 | 0.478 (2.9x) | 0.488 (2.8x) | 0.484 (2.8x) |\n| pdist, chebyshev, f64 | 1.338 | 1.343 | 1.341 | 0.476 (2.8x) | 0.485 (2.8x) | 0.481 (2.8x) |\n| pdist, euclidean, f32 | 1.241 | 1.250 | 1.246 | 0.482 (2.6x) | 0.487 (2.6x) | 0.484 (2.6x) |\n| pdist, euclidean, f64 | 1.222 | 1.228 | 1.225 | 0.474 (2.6x) | 0.503 (2.4x) | 0.482 (2.5x) |\n| pdist, sqeuclidean, f32 | 1.224 | 1.247 | 1.233 | 0.477 (2.6x) | 0.490 (2.5x) | 0.481 (2.6x) |\n| pdist, sqeuclidean, f64 | 1.211 | 1.214 | 1.213 | 0.470 (2.6x) | 0.478 (2.5x) | 0.475 (2.6x) |\n| pdist, cityblock, f32 | 2.204 | 2.207 | 2.205 | 0.483 (4.6x) | 0.491 (4.5x) | 0.486 (4.5x) |\n| pdist, cityblock, f64 | 2.189 | 2.198 | 2.192 | 0.476 (4.6x) | 0.483 (4.5x) | 0.481 (4.6x) |\n| pdist, cosine, f32 | 2.000 | 2.004 | 2.002 | 1.292 (1.5x) | 1.302 (1.5x) | 1.296 (1.5x) |\n| pdist, cosine, f64 | 1.988 | 1.992 | 1.990 | 1.288 (1.5x) | 1.296 (1.5x) | 1.292 (1.5x) |\n\n\n<table>\n<tr>\n<th> F32 </th>\n<th> F64 </th>\n</tr>\n<tr>\n<td>\n\n![Chebyshev f32](images/Chebyshev_f32.png)\n![Euclidean f32](images/Euclidean_f32.png)\n![Squared Euclidean f32](images/Squared-Euclidean_f32.png)\n![Manhattan f32](images/Manhattan_f32.png)\n![Canberra f32](images/Canberra_f32.png)\n![Cosine f32](images/Cosine_f32.png)\n\n</td>\n<td>\n\n![Chebyshev f64](images/Chebyshev_f64.png)\n![Euclidean f64](images/Euclidean_f64.png)\n![Squared Euclidean f64](images/Squared-Euclidean_f64.png)\n![Manhattan f64](images/Manhattan_f64.png)\n![Canberra f64](images/Canberra_f64.png)\n![Cosine f64](images/Cosine_f64.png)\n\n</td>\n</tr>\n</table>\n\n<table>\n<tr>\n<th> u32 </th>\n<th> u64 </th>\n</tr>\n<tr>\n<td>\n\n![Bray-Curtis u32](images/Bray-Curtis_u32.png)\n\n</td>\n<td>\n\n![Bray-Curtis u64](images/Bray-Curtis_u64.png)\n\n</td>\n</tr>\n</table>\n</table>\n\n### String Distance Benchmarks\n\nThese benchmarks were run on an Intel Core i7-11700KF CPU @ 4.900GHz, using **a single thread**.\nThe OS was Arch Linux, with kernel version 6.7.4-arch1-1.\n\nAll string distances were computed 100 times each, among different pairs of strings, and the average time was taken.\n\n<table>\n<tr>\n<td>\n\n![Hamming](images/Hamming_str.png)\n![Levenshtein](images/Levenshtein_str.png)\n![Needleman-Wunsch](images/Needleman-Wunsch_str.png)\n\n</td>\n</tr>\n</table>\n\n## License\n\nThis package is licensed under the MIT license.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Distance functions: A drop-in replacement for, and a super-set of the scipy.spatial.distance module.",
"version": "1.0.3",
"project_urls": null,
"split_keywords": [
"distance",
" metric",
" simd"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "613d06123835c9d7ed9a8f85705c7054b29572c6242293da9663092c649df77c",
"md5": "3af5e0462d4453df3a761477fe14d551",
"sha256": "a5d9609f08f28f0ab2f1adf3a6af74180c124f56b55e334ae76429ed07ccafb0"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "3af5e0462d4453df3a761477fe14d551",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 475740,
"upload_time": "2024-03-22T19:39:22",
"upload_time_iso_8601": "2024-03-22T19:39:22.382595Z",
"url": "https://files.pythonhosted.org/packages/61/3d/06123835c9d7ed9a8f85705c7054b29572c6242293da9663092c649df77c/abd_distances-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e439d23b890eddd1897aa629dc5ee6a2be2fa384b5ac74365989a61470df1861",
"md5": "c7798bd768a5cf6b671365a10dfde10c",
"sha256": "e06d35919a29264f771f5dfe714577f6732391a9571de76f1c56bf8cb6fe131a"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "c7798bd768a5cf6b671365a10dfde10c",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 438501,
"upload_time": "2024-03-22T19:39:24",
"upload_time_iso_8601": "2024-03-22T19:39:24.904080Z",
"url": "https://files.pythonhosted.org/packages/e4/39/d23b890eddd1897aa629dc5ee6a2be2fa384b5ac74365989a61470df1861/abd_distances-1.0.3-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a95a278600e5e0b36bb84cd77bcc1143404f9e93cecda9b8e02acdaed4233f58",
"md5": "e180952bf0677a9f228fe87e0b0f1691",
"sha256": "d300b48a1d7e77bd176c77c5e5e1bdbfb647da4d6afc135a9099951f99863f29"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-manylinux_2_12_i686.manylinux2010_i686.whl",
"has_sig": false,
"md5_digest": "e180952bf0677a9f228fe87e0b0f1691",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 490564,
"upload_time": "2024-03-22T19:39:26",
"upload_time_iso_8601": "2024-03-22T19:39:26.521727Z",
"url": "https://files.pythonhosted.org/packages/a9/5a/278600e5e0b36bb84cd77bcc1143404f9e93cecda9b8e02acdaed4233f58/abd_distances-1.0.3-cp39-abi3-manylinux_2_12_i686.manylinux2010_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "bc659e6645fdcc37fba19f26a060464f0d74ab892035125ff1615ab1758e8451",
"md5": "92bcae20650062bbbea9b98c3d309bc8",
"sha256": "98c6a76c48610b8be8e250e387f2a82ffee8812eb76a25ebdd2211caa168816d"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "92bcae20650062bbbea9b98c3d309bc8",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 451501,
"upload_time": "2024-03-22T19:39:28",
"upload_time_iso_8601": "2024-03-22T19:39:28.312399Z",
"url": "https://files.pythonhosted.org/packages/bc/65/9e6645fdcc37fba19f26a060464f0d74ab892035125ff1615ab1758e8451/abd_distances-1.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cceeaa329abc36eca19cdbcf6274c5ffb97e8cf12f484c3de8e680f6abd5b367",
"md5": "27e7c7bd356dc055b48bc72a85080019",
"sha256": "8ae3a71cfe9813d6cdb4e3cb0ff6d860a1489b33ee5cede7eec8bb31d542b156"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"has_sig": false,
"md5_digest": "27e7c7bd356dc055b48bc72a85080019",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 440125,
"upload_time": "2024-03-22T19:39:30",
"upload_time_iso_8601": "2024-03-22T19:39:30.689331Z",
"url": "https://files.pythonhosted.org/packages/cc/ee/aa329abc36eca19cdbcf6274c5ffb97e8cf12f484c3de8e680f6abd5b367/abd_distances-1.0.3-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d0cc5a23aef2cff52b40be5bd5bab976d9f1b56c578d514686564703211a4aad",
"md5": "5c2cb9ad0ea09e9b43f0b067b1eb3a68",
"sha256": "641da031a4474bc67db00f36587576038378ff6b12fdab40f54c721e304ebe16"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"has_sig": false,
"md5_digest": "5c2cb9ad0ea09e9b43f0b067b1eb3a68",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 523557,
"upload_time": "2024-03-22T19:39:33",
"upload_time_iso_8601": "2024-03-22T19:39:33.067923Z",
"url": "https://files.pythonhosted.org/packages/d0/cc/5a23aef2cff52b40be5bd5bab976d9f1b56c578d514686564703211a4aad/abd_distances-1.0.3-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7cbf2a62236c9adcb2f3ff50a44306f0fb1230c5f26603051b18146dbc020662",
"md5": "0e39d31874257f9684995bccadeda70d",
"sha256": "07d6cc9c679e1ff876c5223a8671d2dc5a32b9584a5fef2d663f0ca51d93f75e"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"has_sig": false,
"md5_digest": "0e39d31874257f9684995bccadeda70d",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1250330,
"upload_time": "2024-03-22T19:39:35",
"upload_time_iso_8601": "2024-03-22T19:39:35.283906Z",
"url": "https://files.pythonhosted.org/packages/7c/bf/2a62236c9adcb2f3ff50a44306f0fb1230c5f26603051b18146dbc020662/abd_distances-1.0.3-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6a2a293b36e649de61296a48979eb26df02d15ef070a7def4f7bb24215244cd2",
"md5": "b0b480fc59d69b75ae9c109f3e7d0856",
"sha256": "844cc8ab7e851908adcfb58c71ed6559cf71d44b1bf0c8ec702152f4b11a8c85"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "b0b480fc59d69b75ae9c109f3e7d0856",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 502416,
"upload_time": "2024-03-22T19:39:37",
"upload_time_iso_8601": "2024-03-22T19:39:37.607783Z",
"url": "https://files.pythonhosted.org/packages/6a/2a/293b36e649de61296a48979eb26df02d15ef070a7def4f7bb24215244cd2/abd_distances-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fc19c7bebc7fd6fb0ddf9e8a1bc567ededbe22b6dfaf9181bee40b10984ac396",
"md5": "693563005cb7982ea53bed50ae4e09a1",
"sha256": "6e6d54c4e146db8af381b297ad25b7576522ec39038d4a76e8be4c9ba57ad5ae"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-win32.whl",
"has_sig": false,
"md5_digest": "693563005cb7982ea53bed50ae4e09a1",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 344194,
"upload_time": "2024-03-22T19:39:39",
"upload_time_iso_8601": "2024-03-22T19:39:39.272237Z",
"url": "https://files.pythonhosted.org/packages/fc/19/c7bebc7fd6fb0ddf9e8a1bc567ededbe22b6dfaf9181bee40b10984ac396/abd_distances-1.0.3-cp39-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1d2978f34755527be461047a92906fd9ab8b4f1b3dbe04b51f605cb08f9bca53",
"md5": "269e40ebd9396f8ceec6a2ed9d9beced",
"sha256": "dc2d6ef07f5fc779c2b508f76497297554d24ec222dde9dcb9775ab590110310"
},
"downloads": -1,
"filename": "abd_distances-1.0.3-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "269e40ebd9396f8ceec6a2ed9d9beced",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 392152,
"upload_time": "2024-03-22T19:39:41",
"upload_time_iso_8601": "2024-03-22T19:39:41.321406Z",
"url": "https://files.pythonhosted.org/packages/1d/29/78f34755527be461047a92906fd9ab8b4f1b3dbe04b51f605cb08f9bca53/abd_distances-1.0.3-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "aac7e394242ec3deb38d8e1452e2bcfad5376abe8ecae17c3c119324ad0a5db6",
"md5": "d70b69a026e890237873ff55cd8eefc5",
"sha256": "ed5169152605bf785a5780be36310589d3899ff032d7f7b8d7d834dd4357896b"
},
"downloads": -1,
"filename": "abd_distances-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "d70b69a026e890237873ff55cd8eefc5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 1681736,
"upload_time": "2024-03-22T19:39:43",
"upload_time_iso_8601": "2024-03-22T19:39:43.494297Z",
"url": "https://files.pythonhosted.org/packages/aa/c7/e394242ec3deb38d8e1452e2bcfad5376abe8ecae17c3c119324ad0a5db6/abd_distances-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-22 19:39:43",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "abd-distances"
}