a
    J5d                     @   sF   d Z ddlmZ ddlZddlmZ d	ejeej ejdddZdS )
zEuclidean distance    )OptionalN   )process_input)sourcesdestinationsreturnc                 C   sN   t | |\} }t| dddddf |dddddf j d jddS )af  Distance matrix using the Euclidean distance

    Parameters
    ----------
    sources, destinations
        Arrays with each row containing the coordinates of a point. If
        ``destinations`` is None, compute the distance between each source in
        ``sources`` and outputs a square distance matrix.

    Returns
    -------
    distance_matrix
        Array with the (i, j) entry indicating the Euclidean distance between
        the i-th row in ``sources`` and the j-th row in ``destinations``.

    Notes
    -----
    The Euclidean distance between points x = (x1, x2, ..., xn) and
    y = (y1, y2, ..., yn), with n coordinates each, is given by:

        sqrt((y1 - x1)**2 + (y2 - x2)**2 + ... + (yn - xn)**2)

    If the user requires the distance between each point in a single array,
    call this this function with ``destinations`` set to `None`.
    N   r   )Zaxis)r   npsqrtTsum)r   r    r   c/var/www/html/django/DPS/env/lib/python3.9/site-packages/python_tsp/distances/euclidean_distance.pyeuclidean_distance_matrix	   s    8r   )N)	__doc__typingr   numpyr	   Zdata_processingr   Zndarrayr   r   r   r   r   <module>   s    