| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Python312/Lib/site-packages/numpy/lib/__pycache__/ |
Upload File : |
�
�gL� � �� � d Z ddlZddlZddlmZ ddlZddlmZ ddl m
Z
ej ej d�� Zg d�Z
d.d �Z ee� d.d
�� Zd� Z d/dd�d
�Z ee� d0dd�d�� Z d1dddd�d�Z G d� de� Z G d� de� Z G d� de� Zd� Z ee� d� � Zd� Z ee� d� � Zd� Z ee� d� � Zd� Z ee� d� � Z d.d �Z ee� d2d!�� Z d3d"�Z! ee!� d4d#�� Z"d.dd$�d%�Z# ee#� d2dd$�d&�� Z$d2dd$�d'�Z%d.dd$�d(�Z& ee&� d2dd$�d)�� Z'd*� Z( ee(� d+� � Z)d3d,�Z* ee*� d4d-�� Z+y)5a~
Set operations for arrays based on sorting.
Notes
-----
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point comparison issues.
Speed could be gained in some operations by an implementation of
`numpy.sort`, that can provide directly the permutation vectors, thus avoiding
calls to `numpy.argsort`.
Original author: Robert Cimrman
� N)�
NamedTuple)� overrides)�_array_converter�numpy)�module)�ediff1d�in1d�intersect1d�isin� setdiff1d�setxor1d�union1d�unique�
unique_all�
unique_counts�unique_inverse�
unique_valuesc � � | ||fS �N� )�ary�to_end�to_begins �=C:\Python312\Lib\site-packages\numpy/lib/_arraysetops_impl.py�_ediff1d_dispatcherr % s � ����"�"� c �� � t | � }|d j � } | j }|�
|�| dd | dd z
S |�d}nSt j |� }t j
||d�� st
d� �|j � }t |� }|�d}nSt j |� }t j
||d�� st
d� �|j � }t |� }t t | � dz
d� }t j | ||z |z � � }|dkD r||d| |dkD r||||z d t j | dd | dd ||||z � |j |� S )
aZ
The differences between consecutive elements of an array.
Parameters
----------
ary : array_like
If necessary, will be flattened before the differences are taken.
to_end : array_like, optional
Number(s) to append at the end of the returned differences.
to_begin : array_like, optional
Number(s) to prepend at the beginning of the returned differences.
Returns
-------
ediff1d : ndarray
The differences. Loosely, this is ``ary.flat[1:] - ary.flat[:-1]``.
See Also
--------
diff, gradient
Notes
-----
When applied to masked arrays, this function drops the mask information
if the `to_begin` and/or `to_end` parameters are used.
Examples
--------
>>> import numpy as np
>>> x = np.array([1, 2, 4, 7, 0])
>>> np.ediff1d(x)
array([ 1, 2, 3, -7])
>>> np.ediff1d(x, to_begin=-99, to_end=np.array([88, 99]))
array([-99, 1, 2, ..., -7, 88, 99])
The returned array is always 1D.
>>> y = [[1, 2, 4], [1, 6, 24]]
>>> np.ediff1d(y)
array([ 1, 2, -3, 5, 18])
r N� ���� same_kind)�castingzSdtype of `to_begin` must be compatible with input `ary` under the `same_kind` rule.zQdtype of `to_end` must be compatible with input `ary` under the `same_kind` rule.)�shape)r �ravel�dtype�np�
asanyarray�can_cast� TypeError�len�max�
empty_like�subtract�wrap) r r r �conv� dtype_req�l_begin�l_end�l_diff�results r r r ) s� � �Z �C� �D�
�q�'�-�-�/�C� � � �I� ��F�N��1�2�w��S�b��!�!������=�=��*���{�{�8�Y��D�� K� L�
L� �>�>�#���h�-��
�~������v�&���{�{�6�9�k�B�� K� L�
L� ������F��� ��S��A��q�
!�F�
�]�]�3�f�w�&6��&>�
?�F���{�#��x����q�y�$*��w��� �!��K�K��A�B���S�b��6�'�'�F�2B�#C�D��9�9�V��r c �, � t | � dk( r| d S | S )z5 Unpacks one-element tuples for use as return values r r )r) ��xs r �
_unpack_tupler7 � s � �
�1�v��{���t���r )� equal_nanc � � | fS r r )�ar�return_index�return_inverse�
return_counts�axisr8 s r �_unique_dispatcherr? � s � ��5�Lr Tc �V ���� t j | � } ��'t | ||||| j d�� }t |� S t j
| �d� } dg| j z }| j d |�<