
    >ie.              	      ^   d dl mZ d dlZd dlZej        j        Zd dlm	Z
 d dlmZmZ  ej        d          Zd Zej                            d          d             Zd	 Zd
 Zej                            ddd ej        d           ej        d          g          d             Zd ZdS )    )annotationsN)	assert_eq	same_keyscupyc                 z   t          j        t                              d          d          } t	          j        g d          }t          j        | |d          }t          |t	          j        g d| j                  d	
           t                              g d          }t          j        |d          } t          j        | |d          }t          |t	          j        g d|j                  d	
           t          t          j        | |d          t          j        | ddgd                    rJ d S )N      chunksr   2   d   midpointmethod   r   r   dtypeF
check_type)r   r      r   r   r      r   )   )r   r   r   r   r   )
da
from_arrayr   onesnparray
percentiler   r   r   )dqsresultxs       Elib/python3.11/site-packages/dask/array/tests/test_cupy_percentile.pytest_percentiler(      s-   
dii&&t444A	,,,		B]1b444Ffbhyyy888UKKKK

---..A
a%%%A]1b444Ffbhzzz>>>5QQQQ
aZ((
a!R*--          zYNon-deterministic tokenize(cupy.array(...)), see https://github.com/dask/dask/issues/6718)reasonc                     t          j        t                              d          d          } t	          j        g d          }t          t          j        | |          t          j        | |                    sJ d S )Nr   r
   r   r   )r   r   r   r   r    r!   r   r"   )r#   r$   s     r'   test_percentile_tokenizer,   !   sk    
 	dii&&t444A	,,,		BR]1b))2=B+?+?@@@@@@@r)   c                 V   t          j        t                              d          d          } t          j        | g dd          }t          |j                  t          j        k    sJ t          ||           t          |t          j
        g d| j                  d	
           d S )N
   )r   r   r   r   )r.   r   Z   r   r   r   r   Fr   r   r   r   r   r"   type_metandarrayr   r    r!   r   r&   r%   s     r'   "test_percentiles_with_empty_arraysr6   +   s    
diimmL999A]1lll:>>>F----fffbhyyy888UKKKKKKr)   c                 N   t          j        t                              d          d          } t          j        | g d          }t          |j                  t          j        k    sJ t          ||           t          |t          j
        g | j                  d           d S )	Nr.   r/   r   r   r   r   Fr   r1   r5   s     r'   test_percentiles_with_empty_qr8   3   s    
diimmL999A]1b444F----fffbhr111eDDDDDDr)   qr   g      @c                P   t          j        t                              d          d          }t          j        || d          }t          |j                  t          j        k    sJ t          ||           t          |t          j
        dg|j                  d	           d S )
Nr   r
   r   r   r   r   r   Fr   r1   )r9   r#   r%   s      r'   'test_percentiles_with_scaler_percentiler;   ;   s     	dii&&t444A]1a
333F----fffbhs!'222uEEEEEEr)   c                    t           j                            t          j                                                  } |                     dd          }t          j        fdz  f|_        t          j        |dd                                          }t          |          t          j
        k    sJ d|cxk     rd	k     sn J t          j        |d
dgd                                          \  }}t          |          t          j
        k    sJ t          |          t          j
        k    sJ d|cxk     rd	k     sn J d|cxk     rd	k     sn J ||k     sJ d S )Ni  )r   r   r.   r   r   r   g?g?(   <   )r   randomdefault_rngr   r    nan_chunksr"   computer2   r4   )rngr&   r%   abs        r'   )test_percentiles_with_unknown_chunk_sizesrG   F   sO   
)

 7 7 9 9
:
:C

4
''A&R!AI]1b444<<>>F<<4<''''#=RHZ888@@BBDAq77dl""""77dl""""====S==========S======q555555r)   )
__future__r   numpyr    pytestmarkgpu
pytestmark
dask.arrayr!   r   dask.array.utilsr   r   importorskipr   r(   xfailr,   r6   r8   parametrizeint64float64r;   rG    r)   r'   <module>rV      sI   " " " " " "     [_
       1 1 1 1 1 1 1 1v6""  & 3   A A	 AL L LE E E q#xrx{{JBJqMMBCCF F DCF    r)   