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
Close
Hashes for cythoneuclideandistance-0.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03ccdc05efec5e18b96698399a8ec00bd6bc7f6f88503fa0fed245880b5e2019 |
|
MD5 | 7bb6062787cd3c589572349fe63ecb65 |
|
BLAKE2b-256 | 5aade4d70c86a810ff7a97f519089dc454818e21405ae5b6108e77b6332f8906 |
Close
Hashes for cythoneuclideandistance-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4128fc35c2e3f479cb1c20a13244528a6543404cf4c1a38a11af1100af1db73 |
|
MD5 | 51a40d5f0a0284477c3ca221a54a5dbc |
|
BLAKE2b-256 | 70b55118542d1cb6a9eda290427e9fc5825dc5233f38313997bf037ea89ec214 |