
    `i                        d dl Z d dlZd dlmZ d dlmZ d dlmZ  ej        dddd          Z ej        d	dd
d          Z ej        dddd          Z	 ej        dddd          Z
 ej        dddd          Z ej        dddd          Z ej        dddd          Z ej        dddd          Z ej        dd d!d"#          Z ej        d$d d%d&#          Zd*de j        z  d(d)ZeZeZdS )+    N)_core)sumprod)ufuncsin   cupy_sinzDElementwise sine function.

    .. seealso:: :data:`numpy.sin`

    coscupy_coszFElementwise cosine function.

    .. seealso:: :data:`numpy.cos`

    tancupy_tanzGElementwise tangent function.

    .. seealso:: :data:`numpy.tan`

    asincupy_arcsinziElementwise inverse-sine function (a.k.a. arcsine function).

    .. seealso:: :data:`numpy.arcsin`

    acoscupy_arccoszmElementwise inverse-cosine function (a.k.a. arccosine function).

    .. seealso:: :data:`numpy.arccos`

    atancupy_arctanzoElementwise inverse-tangent function (a.k.a. arctangent function).

    .. seealso:: :data:`numpy.arctan`

    hypot   
cupy_hypotzComputes the hypoteneous of orthogonal vectors of given length.

    This is equivalent to ``sqrt(x1 **2 + x2 ** 2)``, while this function is
    more efficient.

    .. seealso:: :data:`numpy.hypot`

    atan2cupy_arctan2zeElementwise inverse-tangent of the ratio of two arrays.

    .. seealso:: :data:`numpy.arctan2`

    cupy_deg2rad)ze->ezf->fzd->dz$out0 = in0 * (out0_type)(M_PI / 180)zyConverts angles from degrees to radians elementwise.

    .. seealso:: :data:`numpy.deg2rad`, :data:`numpy.radians`

    )doccupy_rad2degz$out0 = in0 * (out0_type)(180 / M_PI)zyConverts angles from radians to degrees elementwise.

    .. seealso:: :data:`numpy.rad2deg`, :data:`numpy.degrees`

    )periodc                   t          j        |           } | j        }t          j        | |          }||dz  }t          dd          g|z  }t          dd          ||<   t          |          }t          j        |j	        |          }t          j
        |t          j                  rt          |d          \  }}	|	dk    }
n|dz  }d}
| }t          j        ||z
  |          |z   }|
r"t          j        ||||k    |dk    z             ||z
  }t          j        |dt          |          |k                t          j        | d|          }| |         t          j        ||          z   ||<   |S )	a  Unwrap by taking the complement of large deltas w.r.t. the period.

    This unwraps a signal `p` by changing elements which have an absolute
    difference from their predecessor of more than ``max(discont, period/2)``
    to their `period`-complementary values.

    For the default case where `period` is :math:`2\pi` and is ``discont``
    is :math:`\pi`, this unwraps a radian phase `p` such that adjacent
    differences are never greater than :math:`\pi` by adding :math:`2k\pi`
    for some integer :math:`k`.

    Args:
        p (cupy.ndarray): Input array.
            discont (float): Maximum discontinuity between values, default is
            ``period/2``. Values below ``period/2`` are treated as if they were
            ``period/2``. To have an effect different from the default,
            ``discont`` should be larger than ``period/2``.
        axis (int): Axis along which unwrap will operate, default is the last
            axis.
        period: float, optional
            Size of the range over which the input wraps. By default, it is
            :math:`2\pi`.
    Returns:
        cupy.ndarray: The result array.

    .. seealso:: :func:`numpy.unwrap`
    )axisNr   r   r   T)where)copydtype)cupyasarrayndimr   diffslicetuplenumpyresult_typer!   
issubdtypeintegerdivmodmodcopytoabsarraycumsum)pdiscontr   r   ndddslice1r!   interval_highremboundary_ambiguousinterval_lowddmod
ph_correctups                  l/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cupy/_math/trigonometric.pyunwrapr?   j   s   : 	QA	
B	ad	#	#	#B(D$ #FD>>F4L6]]Fbh//Eu}-- "#FA..s AX
!!>LHR,&//,>E /E=\!b1f1. 	/ 	/ 	/ 	/JK
ASWWw%67777	AD	.	.	.B6T[$????BvJI    )Nr   )r(   r"   r   
cupy._mathr   r   create_math_ufuncr   r	   r   arcsinarccosarctanr   arctan2create_ufuncdeg2radrad2degpir?   degreesradians r@   r>   <module>rN      s                       e	1j	 	 e	1j	 	 e	1j	 	 
!	 
A}
	 
	 
!	 
A}
	 
	 
!	 
A}
	 
	 	 Q			 			 "%
!Q	 	 %
*			 	 	 %
*			 	 	5qz 5 5 5 5 5p 
r@   