U
    ?h                     @   s   d dl Zdd ZdS )    Nc                 C   s^   | j dkrtd| j  t| } | d| j| jd   }tj|dd\}}| | }|S )a'  Remove repeated rows from a 2D array.

    In particular, if given an array of coordinates of shape
    (Npoints, Ndim), it will remove repeated points.

    Parameters
    ----------
    ar : 2-D ndarray
        The input array.

    Returns
    -------
    ar_out : 2-D ndarray
        A copy of the input array with repeated rows removed.

    Raises
    ------
    ValueError : if `ar` is not two-dimensional.

    Notes
    -----
    The function will generate a copy of `ar` if it is not
    C-contiguous, which will negatively affect performance for large
    input arrays.

    Examples
    --------
    >>> ar = np.array([[1, 0, 1],
    ...                [0, 1, 0],
    ...                [1, 0, 1]], np.uint8)
    >>> unique_rows(ar)
    array([[0, 1, 0],
           [1, 0, 1]], dtype=uint8)
       z2unique_rows() only makes sense for 2D arrays, got z|S   T)Zreturn_index)ndim
ValueErrornpZascontiguousarrayviewitemsizeshapeunique)arZar_row_view_Zunique_row_indicesZar_out r   E/var/www/html/venv/lib/python3.8/site-packages/skimage/util/unique.pyunique_rows   s    #

r   )numpyr   r   r   r   r   r   <module>   s   