o
    ְi                     @   s   U d dl Z d dlZd dlmZ d dlmZ edddZeddd	ZdddZdddZ	dddZ
dd ZejZejed< ejZejed< ejZejed< ejZejed< ejZejed< ejZejed< dS )    N)_core)contentcupy_is_close)zeeee?->?zffff?->?zdddd?->?a  
    bool equal_nan = in4;
    if (isfinite(in0) && isfinite(in1)) {
      out0 = fabs(in0 - in1) <= in3 + in2 * fabs(in1);
    } else if (equal_nan) {
      out0 = (in0 == in1) || (isnan(in0) && isnan(in1));
    } else {
      out0 = (in0 == in1);
    }
    cupy_is_close_complex)zFFff?->?zDDdd?->?a  
    bool equal_nan = in4;
    if (isfinite(in0) && isfinite(in1)) {
      out0 = abs(in0 - in1) <= in3 + in2 * abs(in1);
    } else if (equal_nan) {
      out0 = (in0 == in1) || (isnan(in0) && isnan(in1));
    } else {
      out0 = (in0 == in1);
    }
    Fc                 C   sj   | j |j krtdS |s| |k S t| t|}}||k s)tdS | |  ||  k S )a  Returns ``True`` if two arrays are element-wise exactly equal.

    Args:
        a1 (cupy.ndarray): Input array to compare.
        a2 (cupy.ndarray): Input array to compare.
        equal_nan (bool): If ``True``, NaN's in ``a1`` will be considered equal
            to NaN's in ``a2``.

    Returns:
        cupy.ndarray: A boolean 0-dim array.
        If its value is ``True``, two arrays are element-wise equal.

    .. seealso:: :func:`numpy.array_equal`

    F)shapecupyarrayallr   isnan)a1a2	equal_nana1nana2nan r   J/home/ubuntu/.local/lib/python3.10/site-packages/cupy/_logic/comparison.pyarray_equal*   s   

r   h㈵>:0yE>c                 C   s   t | ||||d S )a  Returns True if two arrays are element-wise equal within a tolerance.

    Two values in ``a`` and ``b`` are  considiered equal when the following
    equation is satisfied.

    .. math::

       |a - b| \le \mathrm{atol} + \mathrm{rtol} |b|

    Args:
        a (cupy.ndarray): Input array to compare.
        b (cupy.ndarray): Input array to compare.
        rtol (float): The relative tolerance.
        atol (float): The absolute tolerance.
        equal_nan (bool): If ``True``, NaN's in ``a`` will be considered equal
            to NaN's in ``b``.

    Returns:
        cupy.ndarray: A boolean 0-dim array.
        If its value is ``True``, two arrays are element-wise equal within
        a tolerance.

    .. seealso:: :func:`numpy.allclose`

    )rtolatolr   )iscloser	   abr   r   r   r   r   r   allcloseG   s   r   c                 C   sX   t | } t |}| jtjtjfv s|jtjtjfv r$t| ||||S t| ||||S )a  Returns a boolean array where two arrays are equal within a tolerance.

    Two values in ``a`` and ``b`` are  considiered equal when the following
    equation is satisfied.

    .. math::

       |a - b| \le \mathrm{atol} + \mathrm{rtol} |b|

    Args:
        a (cupy.ndarray): Input array to compare.
        b (cupy.ndarray): Input array to compare.
        rtol (float): The relative tolerance.
        atol (float): The absolute tolerance.
        equal_nan (bool): If ``True``, NaN's in ``a`` will be considered equal
            to NaN's in ``b``.

    Returns:
        cupy.ndarray: A boolean array storing where ``a`` and ``b`` are equal.

    .. seealso:: :func:`numpy.isclose`

    )r   
asanyarraydtypenumpy	complex64
complex128_is_close_complex	_is_closer   r   r   r   r   d   s   

r   c                 C   s:   zt | | W n ty   t d Y S w | |k S )a  
    Returns ``True`` if all elements are equal or shape consistent,
    i.e., one input array can be broadcasted to create the same
    shape as the other.

    Args:
        a1 (cupy.ndarray): Input array.
        a2 (cupy.ndarray): Input array.

    Returns:
        cupy.ndarray: A boolean 0-dim array.
            ``True`` if equivalent, otherwise ``False``.

    .. seealso:: :func:`numpy.array_equiv`

    F)r   	broadcast	Exceptionr   r	   )r   r   r   r   r   array_equiv   s   r%   greatergreater_equalless
less_equalequal	not_equal)F)r   r   F)r   r   r   cupy._logicr   create_ufuncr"   r!   r   r   r   r%   r&   ufunc__annotations__r'   r(   r)   r*   r+   r   r   r   r   <module>   s0   
 


!