Calculate Euclidean distances between two sets of coordinates (Cython and Numexpr)
Project description
Calculate Euclidean distances between two sets of coordinates (Cython and Numexpr)
Tested against Windows / Python 3.11 / Anaconda
pip install cythoneuclideandistance
Calculate Euclidean distances between two sets of coordinates.
This function computes the Euclidean distance matrix between two sets of coordinates.
Args:
coords1 (numpy.ndarray): An array of shape (n, 2) containing the first set of coordinates.
coords2 (numpy.ndarray): An array of shape (m, 2) containing the second set of coordinates.
Returns:
numpy.ndarray: A 2D array of shape (n, m) containing the Euclidean distances between all pairs of coordinates.
Example:
import random
import cythoneuclideandistance
import numpy as np
coords1 = np.array(
[[random.randint(1, 1000), random.randint(1, 1000)] for _ in range(23000)],
dtype=np.int32,
)
coords2 = np.array(
[[random.randint(1, 1000), random.randint(1, 1000)] for _ in range(22150)],
dtype=np.int32,
)
distance_matrix = cythoneuclideandistance.calculate_euc_distance(coords1, coords2)
print(distance_matrix)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cythoneuclideandistance-0.11.tar.gz.
File metadata
- Download URL: cythoneuclideandistance-0.11.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
768a2bab45157265e87ce6f7d4386cfce2b47ec1e39bce31526757b38927373a
|
|
| MD5 |
7f0d60a8d68b559006f927403b4de004
|
|
| BLAKE2b-256 |
d142b3bfd1163595560a60636757e31eccc6c885206869336331449d0a78834f
|
File details
Details for the file cythoneuclideandistance-0.11-py3-none-any.whl.
File metadata
- Download URL: cythoneuclideandistance-0.11-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fcdf6b9bfaa74e4232bd3c5b617a7a7afef53d80bdd596a01ebf03fb4e254f7
|
|
| MD5 |
a66b47318a70a10be81eae387daa0172
|
|
| BLAKE2b-256 |
745ae617eb8abe727b54cc554fd8d8415d0ab20a7ede9dcbc5f8699a6804c6bb
|