Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cythoneuclideandistance-0.11.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

cythoneuclideandistance-0.11-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file cythoneuclideandistance-0.11.tar.gz.

File metadata

File hashes

Hashes for cythoneuclideandistance-0.11.tar.gz
Algorithm Hash digest
SHA256 768a2bab45157265e87ce6f7d4386cfce2b47ec1e39bce31526757b38927373a
MD5 7f0d60a8d68b559006f927403b4de004
BLAKE2b-256 d142b3bfd1163595560a60636757e31eccc6c885206869336331449d0a78834f

See more details on using hashes here.

File details

Details for the file cythoneuclideandistance-0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for cythoneuclideandistance-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 0fcdf6b9bfaa74e4232bd3c5b617a7a7afef53d80bdd596a01ebf03fb4e254f7
MD5 a66b47318a70a10be81eae387daa0172
BLAKE2b-256 745ae617eb8abe727b54cc554fd8d8415d0ab20a7ede9dcbc5f8699a6804c6bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page