
    
9j                        S SK Jr  S SKrS SKrS SKrS SKr  SSS.S jjr SS jrSS jrSS jr	 SSSS	.S
 jjr
SS jrSSS.S jjrg)    )annotationsNF)strictc                  [         R                  R                  [         R                  5      S:  aJ  [         R                  R                  [        R                  " U 5      [        R                  " U5      X#XEXgS9  gU(       a  [        R                  " S[        5        [         R                  R                  [        R                  " U 5      [        R                  " U5      X#XEUS9  g)a  Raises an AssertionError if objects are not equal up to desired tolerance.

Args:
     actual(numpy.ndarray or cupy.ndarray): The actual object to check.
     desired(numpy.ndarray or cupy.ndarray): The desired, expected object.
     rtol(float): Relative tolerance.
     atol(float): Absolute tolerance.
     err_msg(str): The error message to be printed in case of failure.
     verbose(bool): If ``True``, the conflicting
         values are appended to the error message.

.. seealso:: :func:`numpy.testing.assert_allclose`

2.0.0)rtolatol	equal_nanerr_msgverboser   N`cupy.testing.assert_allclose` does not support `strict` option with NumPy v1.)r   r   r	   r
   r   N)numpylibNumpyVersion__version__testingassert_allclosecupyasnumpywarningswarnRuntimeWarning)actualdesiredr   r   r	   r
   r   r   s           M/home/wildlama/miniconda3/lib/python3.13/site-packages/cupy/testing/_array.pyr   r      s    $ yye//0G;%%LL $,,w"7I 	& 	
 MM(
 	%%LL $,,w"7I 	& 	
    c                    [         R                  R                  [        R                  " U 5      [        R                  " U5      UX4S9  g)a  Raises an AssertionError if objects are not equal up to desired precision.

Args:
     x(numpy.ndarray or cupy.ndarray): The actual object to check.
     y(numpy.ndarray or cupy.ndarray): The desired, expected object.
     decimal(int): Desired precision.
     err_msg(str): The error message to be printed in case of failure.
     verbose(bool): If ``True``, the conflicting
         values are appended to the error message.

.. seealso:: :func:`numpy.testing.assert_array_almost_equal`
)decimalr
   r   N)r   r   assert_array_almost_equalr   r   )r   r   r   r
   r   s        r   r   r   3   s7     
MM++Vdll73W , r   c                    [         R                  R                  [        R                  " U 5      [        R                  " U5      US9  g)aN  Compare two arrays relatively to their spacing.

Args:
     x(numpy.ndarray or cupy.ndarray): The actual object to check.
     y(numpy.ndarray or cupy.ndarray): The desired, expected object.
     nulp(int): The maximum number of unit in the last place for tolerance.

.. seealso:: :func:`numpy.testing.assert_array_almost_equal_nulp`
)nulpN)r   r   assert_array_almost_equal_nulpr   r   )xyr    s      r   r!   r!   H   s2     
MM00Qat 1 5r   c                    [         R                  R                  [        R                  " U 5      [        R                  " U5      X#S9  g)a  Check that all items of arrays differ in at most N Units in the Last Place.

Args:
     a(numpy.ndarray or cupy.ndarray): The actual object to check.
     b(numpy.ndarray or cupy.ndarray): The desired, expected object.
     maxulp(int): The maximum number of units in the last place
         that elements of ``a`` and ``b`` can differ.
     dtype(numpy.dtype): Data-type to convert ``a`` and ``b`` to if given.

.. seealso:: :func:`numpy.testing.assert_array_max_ulp`
)maxulpdtypeN)r   r   assert_array_max_ulpr   r   )abr%   r&   s       r   r'   r'   V   s3     
MM&&Qa ' Fr   )r   strides_checkc               &   [         R                  R                  [         R                  5      S:  aI  [         R                  R                  [        R                  " U 5      [        R                  " U5      UX4S9  OjU(       a  [        R                  " S[        5        [         R                  R                  [        R                  " U 5      [        R                  " U5      UUS9  U(       a  U R                  UR                  :w  a  S/nU(       a  US   S-   U-   /nU(       aT  UR                  SR                  U R                  5      5        UR                  S	R                  UR                  5      5        [        S
R                  U5      5      egg)a  Raises an AssertionError if two array_like objects are not equal.

Args:
     x(numpy.ndarray or cupy.ndarray): The actual object to check.
     y(numpy.ndarray or cupy.ndarray): The desired, expected object.
     strides_check(bool): If ``True``, consistency of strides is also
         checked.
     err_msg(str): The error message to be printed in case of failure.
     verbose(bool): If ``True``, the conflicting values
         are appended to the error message.
     strict(bool): If ``True``, raise an AssertionError when either
         the shape or the data type of the array_like objects does not
         match. Requires NumPy version 1.24 or above.

.. seealso:: :func:`numpy.testing.assert_array_equal`
z1.24.0r
   r   r   r   r
   r   zStrides are not equal:r    z x: {}z y: {}
N)r   r   r   r   r   assert_array_equalr   r   r   r   r   stridesappendformatAssertionErrorjoin)r   r   r
   r   r   r*   msgs          r   r0   r0   f   s)   ( yye//0H<((LL $,,w"7 	) 	

 MM(
 	((LL $,,w"7 	) 	

 >>W__,+,C1v|g-.

8??6>>:;

8??7??;< 300 - r   c                   [        U 5      n[        U5      nXELa  [        SR                  XE5      5      eU[        [        4;  a  [        SR                  U5      5      e[        U 5      [        U5      :w  a  [        S5      e[        X5       HM  u  pg[        R                  R                  [        R                  " U5      [        R                  " U5      UUS9  MO     g)a  Compares lists of arrays pairwise with ``assert_array_equal``.

Args:
     x(array_like): Array of the actual objects.
     y(array_like): Array of the desired, expected objects.
     err_msg(str): The error message to be printed in case of failure.
     verbose(bool): If ``True``, the conflicting values
         are appended to the error message.

Each element of ``x`` and ``y`` must be either :class:`numpy.ndarray`
or :class:`cupy.ndarray`. ``x`` and ``y`` must have same length.
Otherwise, this function raises ``AssertionError``.
It compares elements of ``x`` and ``y`` pairwise
with :func:`assert_array_equal` and raises error if at least one
pair is not equal.

.. seealso:: :func:`numpy.testing.assert_array_equal`
zZMatching types of list or tuple are expected, but were different types (xlist:{} ylist:{})z%List or tuple is expected, but was {}zList size is differentr-   N)typer4   r3   listtuplelenzipr   r   r0   r   r   )xlistylistr
   r   x_typey_typer"   r#   s           r   assert_array_list_equalrA      s    & %[F%[F""(&"8: 	: dE]"3::6BD 	D
5zSZ566E!((LLOT\\!_g 	) 	 "r   c                  [         R                  R                  [         R                  5      S:  aI  [         R                  R                  [        R                  " U 5      [        R                  " U5      UX4S9  gU(       a  [        R                  " S[        5        [         R                  R                  [        R                  " U 5      [        R                  " U5      UUS9  g)a  Raises an AssertionError if array_like objects are not ordered by less than.

Args:
     x(numpy.ndarray or cupy.ndarray): The smaller object to check.
     y(numpy.ndarray or cupy.ndarray): The larger object to compare.
     err_msg(str): The error message to be printed in case of failure.
     verbose(bool): If ``True``, the conflicting values
         are appended to the error message.

.. seealso:: :func:`numpy.testing.assert_array_less`
r   r,   r   r-   N)r   r   r   r   r   assert_array_lessr   r   r   r   r   )r"   r#   r
   r   r   s        r   rC   rC      s     yye//0G;''LLOT\\!_g 	( 	

 MM(
 	''LLOT\\!_g 	( 	
r   )gHz>r   T T)   rD   T)   )rF   N)rD   T)
__future__r   r   r   numpy.testingr   r   r   r!   r'   r0   rA   rC    r   r   <module>rJ      sf    "     7; #
,1#
N 9=*5F" .2-1E-1`"J
 
r   