
    `ij                     R    d dl Zd dlZ	 	 ddZddZdd	Zdd
ZddZddZddZ	dS )    NHz> Tc                     t           j                            t          j        |           t          j        |          ||||           dS )a9  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`

    )rtolatolerr_msgverboseN)numpytestingassert_allclosecupyasnumpy)actualdesiredr   r   r   r	   s         g/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cupy/testing/_array.pyr   r      sT      
M!!Vdl733gw " @ @ @ @ @       c                     t           j                            t          j        |           t          j        |          |||           dS )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   )xyr   r   r	   s        r   r   r      sI     
M++Qa' , * * * * *r      c                     t           j                            t          j        |           t          j        |          |           dS )af  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   )r   r   r   s      r   r   r   /   sD     
M00Qat 1 5 5 5 5 5r   c                     t           j                            t          j        |           t          j        |          ||           dS )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    =   sK     
M&&Qau ' F F F F Fr   Fc                    t          j        j        t          j        |           t          j        |          f||d| |r| j        |j        k    rdg}|r|d         dz   |z   g}|rZ|                    d                    | j                             |                    d                    |j                             t          d	                    |                    dS dS )	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`
    r   r	   zStrides are not equal:r    z x: {}z y: {}
N)
r
   r   assert_array_equalr   r   stridesappendformatAssertionErrorjoin)r   r   r   r	   strides_checkkwargsmsgs          r   r'   r'   M   s    $ 
M$Qa#29# #!# # #  19	!!+,C /1v|g-. 7

8??1955666

8??1955666 30001 1!!r   c                    t          |           }t          |          }||ur#t          d                    ||                    |t          t          fvr"t          d                    |                    t          |           t          |          k    rt          d          t          | |          D ]L\  }}t          j        	                    t          j        |          t          j        |          ||           MdS )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)typer+   r*   listtuplelenzipr
   r   r'   r   r   )xlistylistr   r	   x_typey_typer   r   s           r   assert_array_list_equalr:   n   s   & %[[F%[[FV""(&"8"8: : 	: dE]""3::6BBD D 	D
5zzSZZ5666E5!!  1((LOOT\!__g 	) 	 	 	 	 r   c                     t           j                            t          j        |           t          j        |          ||           dS )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$   N)r
   r   assert_array_lessr   r   )r   r   r   r	   s       r   r<   r<      sG     
M##Qa' $     r   )r   r   r   T)r   r   T)r   )r   N)r   TF)r   T)
numpy.testingr
   r   r   r   r   r    r'   r:   r<    r   r   <module>r?      s        
 AC @ @ @ @** * * *$5 5 5 5F F F F 1 1 1 1B" " " "J     r   