a
    –§»a¹%  ã                   @   sd  d dl Z d dlZd dlmZ d dlmZmZmZmZ d dl	m
Z
 d dlmZmZmZmZ d dlmZ e
ƒ ZejZg Zedde jfg7 Zed	d
e jfg7 Zedde jfg7 Zg Zedde jfg7 Zedde jfg7 Zedde jfg7 Zedde jfg7 Zedde jfg7 Zedde jfg7 Zedde jfg7 Zedde j fg7 Zedde j!fg7 Zedd e j"fg7 Zed!d"e j#fg7 Zed#d$e j$fg7 Zed%d&e j%fg7 Zed'd(e j&fg7 Zed)d*e j'fg7 Zed+d,e j(fg7 Zed-d.e j)fg7 Zed/d0e j*fg7 Zed1d2e j+fg7 Zed3d4e j,fg7 Zed5d6e j-fg7 Zed7d8e j.fg7 Zed9d:e j/fg7 Zed;d<e j0fg7 Zed=d>e j1fg7 Zed?d@e j2fg7 Zi Z3dAe3d.< dBe3d6< dCe3d>< dDe3d< dEe3d$< dFe3d&< dGe3d"< g Z4e4dHdIe j5fg7 Z4e4dJdKe j6fg7 Z4e4dLdMe j7fg7 Z4e4dNdOe j8fg7 Z4e4dPdQe j9fg7 Z4ej:dRk�r:e4dSdTe j;fg7 Z4i Z<dUe<dM< ee jej=ƒee jej=ƒdVdW„ ƒƒZ>eej?ejejƒdXdY„ ƒZ@ee jej=ƒdZd[„ ƒZAd\d]„ ZBd^d_„ ZCd`da„ ZDdbdc„ ZEddde„ ZFeD ]8\ZGZHZIeJeeHƒZKeJeeGƒZLeBeIeeKƒ eBeIeeLƒ �qÆeD ]P\ZGZHZIeJeeHƒZKeJeeGƒZLeCeIeeKƒ eCeIeeLƒ eDeIeeLƒ eDeIeeLƒ �qe4D ]P\ZGZHZIeJeeHƒZKeJeeGƒZLeEeIeeKƒ eEeIeeLƒ eFeIeeLƒ eFeIeeLƒ �qZdfdg„ ZMeMejejNƒ eMejejOƒ dhdi„ ZPePejejQƒ ePejejRƒ djdk„ ZSeSejejTƒ eSejejUƒ dldm„ ZVeVejejWƒ eVejejXƒ dndo„ ZYeYejejZƒ eYejej[ƒ dS )pé    N)Úir)ÚtypesÚtypingÚutilsÚcgutils)ÚRegistry)Úfloat32Úfloat64Úint64Úuint64)Ú	libdeviceZisnandZisnanfZisinfdZisinffZ	isfinitedZfinitefÚceilZceilfÚfloorZfloorfÚfabsZfabsfÚexpZexpfÚexpm1Zexpm1fÚerfZerffÚerfcZerfcfZtgammaZtgammafÚlgammaZlgammafÚsqrtZsqrtfÚlogZlogfÚlog2Zlog2fÚlog10Zlog10fÚlog1pZlog1pfÚacoshZacoshfÚacosZacosfÚcosZcosfÚcoshZcoshfÚasinhZasinhfÚasinZasinfÚsinZsinfÚsinhZsinhfÚatanZatanfÚatanhZatanhfÚtanZtanfÚtanhZtanhfZ	fast_cosfZ	fast_sinfZ	fast_tanfZ	fast_expfZ
fast_log2fZfast_log10fZ	fast_logfÚcopysignZ	copysignfÚatan2Zatan2fÚpowZpowfÚfmodZfmodfÚhypotZhypotf)é   é   Ú	remainderZ
remainderfZ	fast_powfc                 C   s   |   tjd¡S )Nr   ©Zget_constantr   Úboolean©ÚcontextÚbuilderÚsigÚargs© r5   úM/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/numba/cuda/mathimpl.pyÚmath_isinf_isnan_intD   s    r7   c                 C   s|   | j r,t ttt¡}|  tj|¡}|||ƒS t ||d ¡� | j	 
|d¡ W d   ƒ n1 s`0    Y  |j|Ž }|S d S )Né   )zdivision by zero)Úfastmathr   Ú	signaturer   Úget_functionr   Zfast_fdividefr   Zif_zeroZerror_modelZfp_zero_divisionZfdiv)r1   r2   r3   r4   ÚimplÚresr5   r5   r6   Úmaybe_fast_truedivJ   s    
,
r>   c                 C   s   |   tjd¡S )Nr8   r.   r0   r5   r5   r6   Úmath_isfinite_intW   s    r?   c                    s    ‡ ‡fdd„}t | ˆƒ|ƒ d S )Nc                    s4   |   ˆ t tjˆ¡¡}|||ƒ}|  ||tjtj¡S ©N)r;   r   r:   r   Úint32Úcastr/   )r1   r2   r3   r4   Úlibfunc_implÚresult©ÚlibfuncÚtyr5   r6   Úlower_boolean_impl]   s
    ÿ
z(impl_boolean.<locals>.lower_boolean_impl©Úlower)ÚkeyrG   rF   rH   r5   rE   r6   Úimpl_boolean\   s    rL   c                    s    ‡ ‡fdd„}t | ˆƒ|ƒ d S )Nc                    sR   ˆ }d }ˆt kr"| jr"t ˆ j¡}|d ur4tt|ƒ}|  |t 	ˆˆ¡¡}|||ƒS r@   )
r   r9   Úunarys_fastmathÚgetÚ__name__Úgetattrr   r;   r   r:   ©r1   r2   r3   r4   Zactual_libfuncZfast_replacementrC   rE   r5   r6   Úlower_unary_implg   s    

ÿz$impl_unary.<locals>.lower_unary_implrI   )rK   rG   rF   rR   r5   rE   r6   Ú
impl_unaryf   s    rS   c                    s   ‡ fdd„}t | |ƒ|ƒ d S )Nc                    sn   |j d tkr|j}n"|j d tkr,|j}nd}t|ƒ‚||d t ¡ ƒ}t 	t
t
¡}|  ˆ |¡}|||gƒS )Nr   z<Only 64-bit integers are supported for generic unary int ops)r4   r
   Úsitofpr   ÚuitofpÚ	TypeErrorr   Ú
DoubleTyper   r:   r	   r;   )r1   r2   r3   r4   ÚconvertÚmÚargrC   ©rF   r5   r6   Úlower_unary_int_implx   s    z,impl_unary_int.<locals>.lower_unary_int_implrI   )rK   rG   rF   r\   r5   r[   r6   Úimpl_unary_intw   s    r]   c                    s"   ‡ ‡fdd„}t | ˆˆƒ|ƒ d S )Nc                    sT   ˆ }d }ˆt kr"| jr"t ˆ j¡}|d ur4tt|ƒ}|  |t 	ˆˆˆ¡¡}|||ƒS r@   )
r   r9   Úbinarys_fastmathrN   rO   rP   r   r;   r   r:   rQ   rE   r5   r6   Úlower_binary_implŠ   s    
ÿz&impl_binary.<locals>.lower_binary_implrI   )rK   rG   rF   r_   r5   rE   r6   Úimpl_binary‰   s    r`   c                    s    ‡ fdd„}t | ||ƒ|ƒ d S )Nc                    sn   |j d tkr|j‰ n"|j d tkr,|j‰ nd}t|ƒ‚‡ fdd„|D ƒ}t ttt¡}|  	ˆ|¡}|||ƒS )Nr   z=Only 64-bit integers are supported for generic binary int opsc                    s   g | ]}ˆ |t  ¡ ƒ‘qS r5   )r   rW   )Ú.0rZ   ©rX   r5   r6   Ú
<listcomp>¤   ó    zBimpl_binary_int.<locals>.lower_binary_int_impl.<locals>.<listcomp>)
r4   r
   rT   r   rU   rV   r   r:   r	   r;   )r1   r2   r3   r4   rY   rC   r[   rb   r6   Úlower_binary_int_impl›   s    z.impl_binary_int.<locals>.lower_binary_int_implrI   )rK   rG   rF   re   r5   r[   r6   Úimpl_binary_intš   s    rf   c                    s&   ‡ ‡fdd„}t tjˆtjƒ|ƒ d S )Nc                    s&   t  ˆˆtj¡}|  ˆ |¡}|||ƒS r@   ©r   r:   r   rA   r;   )r1   r2   r3   r4   Zpowi_sigrC   rE   r5   r6   Úlower_pow_impl_intÆ   s    z(impl_pow_int.<locals>.lower_pow_impl_int)rJ   Úmathr(   r   rA   )rG   rF   rh   r5   rE   r6   Úimpl_pow_intÅ   s    rj   c                    s0   t  ˆd¡‰‡ ‡‡fdd„}ttjˆƒ|ƒ d S )Né   c                    s"   t  ˆˆ¡}|  ˆ |¡}|||ƒS r@   ©r   r:   r;   )r1   r2   r3   r4   Zmodf_sigrC   ©rF   ZrettyrG   r5   r6   Úlower_modf_implÕ   s    z"impl_modf.<locals>.lower_modf_impl)r   ZUniTuplerJ   ri   Úmodf)rG   rF   rn   r5   rm   r6   Ú	impl_modfÒ   s    rp   c                    s4   t  ˆt jf¡‰‡ ‡‡fdd„}ttjˆƒ|ƒ d S )Nc                    s"   t  ˆˆ¡}|  ˆ |¡}|||ƒS r@   rl   )r1   r2   r3   r4   Z	frexp_sigrC   rm   r5   r6   Úlower_frexp_implä   s    z$impl_frexp.<locals>.lower_frexp_impl)r   ÚTuplerA   rJ   ri   Úfrexp)rG   rF   rq   r5   rm   r6   Ú
impl_frexpá   s    rt   c                    s&   ‡ ‡fdd„}t tjˆtjƒ|ƒ d S )Nc                    s&   t  ˆˆtj¡}|  ˆ |¡}|||ƒS r@   rg   )r1   r2   r3   r4   Z	ldexp_sigrC   rE   r5   r6   Úlower_ldexp_implñ   s    z$impl_ldexp.<locals>.lower_ldexp_impl)rJ   ri   Úldexpr   rA   )rG   rF   ru   r5   rE   r6   Ú
impl_ldexpð   s    rw   c                    sF   ‡ ‡fdd„}t tjˆ ˆ ƒ|ƒ t tjˆ ˆ ƒ|ƒ t tˆ ˆ ƒ|ƒ d S )Nc                    s   ‡ ‡fdd„}|   ||||¡S )Nc                    sî   |j ˆdƒkr,|jˆdƒkr,ˆ dƒˆ dƒ S | j ˆdƒkrX|j ˆdƒkrXˆ dƒˆ dƒ S t | j | j¡}t ||j ¡}t | j| j ¡}||j  }|jˆdƒkrÆ|t ||j ¡ }||jt |¡ 7 }|ˆ t |¡ƒˆ t 	|¡ˆ dƒ ƒ  S )Ng        g      ð?y                y              ð?)
ÚrealÚimagri   r*   r(   r'   r   r   r   r    )ÚaÚbZvabsÚlenÚatÚphase©ÚctyÚftyr5   r6   Úcpow_internal  s    
ÿz3cpow_implement.<locals>.core.<locals>.cpow_internal)Zcompile_internal)r1   r2   r3   r4   r‚   r   r5   r6   Úcore  s    zcpow_implement.<locals>.core)rJ   Úoperatorr(   Úipow)r�   r€   rƒ   r5   r   r6   Úcpow_implement  s    r†   )\ri   r„   Zllvmliter   Z
numba.corer   r   r   r   Znumba.core.imputilsr   Znumba.typesr   r	   r
   r   Z
numba.cudar   ÚregistryrJ   ZbooleansÚisnanÚisinfÚisfiniteZunarysr   r   r   r   r   r   r   Úgammar   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   rM   Zbinarysr&   r'   r(   r)   r*   Z	PYVERSIONr-   r^   ZIntegerr7   Útruedivr>   r?   rL   rS   r]   r`   rf   Zfname64Zfname32rK   rP   Zimpl32Zimpl64rj   ZpowifZpowirp   Zmodffro   rt   Zfrexpfrs   rw   Zldexpfrv   r†   Z	complex64Z
complex128r5   r5   r5   r6   Ú<module>   sÎ   








		
