
    ik                         U d Z ddlmZmZmZmZ ddlZddlm	Z	m
Z
 ddlmZ ed   Zeed<   d	dd
dedededededdfdZdededefdZddee   dedefdZddee   dedefdZy)zHelpers for test code.    )AnyLiteralSequence	TypeAliasN   )_is_cupy_alikeimport_cupy)DMatrix)cpucudaDevicegHz>)rtolatoldeviceabr   r   returnc                    | dk(  r:t        |      s/t        |      s$t        j                  j                  ||||       yt	               }|j                  j                  ||||       y)z)Dispatch the assert_allclose for devices.r   )r   r   N)r   nptestingassert_allcloser	   )r   r   r   r   r   cps         [/home/ubuntu/crypto_trading_bot/.venv/lib/python3.12/site-packages/xgboost/testing/utils.pyr   r      sV     ~a09J


""1ad">]


""1ad">    lhsrhsc                 N   | j                         }|j                         }t        t        j                  |j                  |j                        t        j                  |j
                  |j
                        t        j                  |j                  |j                        f      S )z9Assert whether two DMatrices contain the same predictors.)get_dataallr   array_equaldataindicesindptr)r   r   lcsrrcsrs       r   predictor_equalr&      sl    <<>D<<>DNN499dii0NN4<<6NN4;;4	
 r   L	tolerancec           	      F    t        fdt        | | dd       D              S )z*Values in the sequence are not increasing.c              3   4   K   | ]  \  }}||z
  k    y wN .0xyr(   s      r   	<genexpr>z!non_increasing.<locals>.<genexpr>'   s     =tq!A"=s      Nr   zipr'   r(   s    `r   non_increasingr6   %   s     =s1ae}===r   c           	      F    t        fdt        | | dd       D              S )z*Values in the sequence are not decreasing.c              3   6   K   | ]  \  }}||z
   k\    y wr+   r,   r-   s      r   r1   z!non_decreasing.<locals>.<genexpr>,   s      ?AA9*$?s   r2   Nr3   r5   s    `r   non_decreasingr9   *   s     ?Q!"???r   )g-C6?)__doc__typingr   r   r   r   numpyr   compatr   r	   corer
   r   __annotations__floatr   boolr&   r6   r9   r,   r   r   <module>rB      s     4 4  0 M*	 * 6:???"?-2?AF?	?
 
w 
4 
>huo >% >4 >
@huo @% @4 @r   