a
    ¢º”hKP  ã                   @   sx   d dl Z d dlmZ d dlZd dlmZmZ d dlmZ dZ	dZ
dZG dd	„ d	eƒZG d
d„ deƒZG dd„ deƒZdS )é    N)ÚOptional)Ú
PRECEDENCEÚ
precedence)Ú
StrPrinterZint64_tl   ÿÿÿÿ ìûÿÿÿ         c                   @   s¶  e Zd ZdZejedœdd„Zd3ejee edœdd„Z	ejedœd	d
„Z
ejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd „Zejedœd!d"„Zejedœd#d$„Zejedœd%d&„Zejedœd'd(„Zejedœd)d*„Zejedœd+d,„Zejedœd-d.„Zejedœd/d0„Zejedœd1d2„ZdS )4ÚExprPrinterZ_torch_sympystr©ÚexprÚreturnc                 C   s   |   |jdt|ƒ¡S )NÚ*©Ú	stringifyÚargsr   ©Úselfr	   © r   úI/var/www/auris/lib/python3.9/site-packages/torch/utils/_sympy/printers.pyÚ
_print_Mul   s    zExprPrinter._print_MulN)r	   Úorderr
   c                 C   s   |   |jdt|ƒ¡S )Nz + r   )r   r	   r   r   r   r   Ú
_print_Add   s    zExprPrinter._print_Addc                 C   s   |   |jd|j› dt|ƒ¡S )Nú )r   r   Zrel_opr   r   r   r   r   Ú_print_Relational   s    zExprPrinter._print_Relationalc                 C   s   |   |jdtd ¡S )Nz & Z
BitwiseAnd©r   r   r   r   r   r   r   Ú_print_BitwiseFn_bitwise_and   s    z(ExprPrinter._print_BitwiseFn_bitwise_andc                 C   s   |   |jdtd ¡S )Nz | Z	BitwiseOrr   r   r   r   r   Ú_print_BitwiseFn_bitwise_or    s    z'ExprPrinter._print_BitwiseFn_bitwise_orc                 C   s   |   |jdtd d ¡S ©Nú % ÚAtomç      à?r   r   r   r   r   Ú
_print_Mod%   s    zExprPrinter._print_Modc                 C   s$   |   |jdtd d ¡}d|› dS )Nú / r   r   ú(ú)r   )r   r	   Úsr   r   r   Ú_print_FloatTrueDiv(   s    zExprPrinter._print_FloatTrueDivc                 C   s
   |   |¡S )N)Ú_print_FloorDivr   r   r   r   Ú_print_CleanDiv,   s    zExprPrinter._print_CleanDivc                 C   s   |   |jd ¡S ©Nr   ©Ú_printr   r   r   r   r   Ú_print_Identity/   s    zExprPrinter._print_Identityc                 C   s(   |j dkrttj|ddƒS t|ƒS d S )Né5   é   )Zdps)Z_precÚstrÚsympyZFloatr   r   r   r   Ú_print_Float2   s    
zExprPrinter._print_Floatc                 C   sV   |j \}}|t|ƒksJ |ƒ‚t|ƒ}|dks2J ‚|dkrR|  |g| dtd ¡S dS )Nr   r   ÚMulÚ1)r   Úintr   r   ©r   r	   ÚbaseÚexpr   r   r   Ú
_print_PowB   s    
zExprPrinter._print_Powc                 C   s   t dt| ƒ› ƒ‚d S )Nz#_print_ToFloat not implemented for ©ÚNotImplementedErrorÚtyper   r   r   r   Ú_print_ToFloatP   s    zExprPrinter._print_ToFloatc                 C   s   t dt| ƒ› ƒ‚d S )Nz$_print_Infinity not implemented for r7   r   r   r   r   Ú_print_InfinityS   s    zExprPrinter._print_Infinityc                 C   s   t dt| ƒ› ƒ‚d S )Nz,_print_NegativeInfinity not implemented for r7   r   r   r   r   Ú_print_NegativeInfinityV   s    ÿz#ExprPrinter._print_NegativeInfinityc                 C   s   t dt| ƒ› ƒ‚d S )Nz$_print_FloorDiv not implemented for r7   r   r   r   r   r%   [   s    zExprPrinter._print_FloorDivc                 C   s   t dt| ƒ› ƒ‚d S )Nz%_print_PythonMod not implemented for r7   r   r   r   r   Ú_print_PythonMod^   s    zExprPrinter._print_PythonModc                 C   s   t dt| ƒ› ƒ‚d S )Nz&_print_IntTrueDiv not implemented for r7   r   r   r   r   Ú_print_IntTrueDiva   s    zExprPrinter._print_IntTrueDivc                 C   s   t dt| ƒ› ƒ‚d S )Nú(_print_PowByNatural not implemented for r7   r   r   r   r   Ú_print_PowByNaturald   s    ÿzExprPrinter._print_PowByNaturalc                 C   s   t dt| ƒ› ƒ‚d S )Nz$_print_FloatPow not implemented for r7   r   r   r   r   Ú_print_FloatPowi   s    zExprPrinter._print_FloatPowc                 C   s   t dt| ƒ› ƒ‚d S )Nz&_print_TruncToInt not implemented for r7   r   r   r   r   Ú_print_TruncToIntl   s    zExprPrinter._print_TruncToIntc                 C   s   t dt| ƒ› ƒ‚d S )Nz&_print_RoundToInt not implemented for r7   r   r   r   r   Ú_print_RoundToInto   s    zExprPrinter._print_RoundToIntc                 C   s   t dt| ƒ› ƒ‚d S )Nz(_print_RoundDecimal not implemented for r7   r   r   r   r   Ú_print_RoundDecimalr   s    ÿzExprPrinter._print_RoundDecimalc                 C   s   t dt| ƒ› ƒ‚d S )Nz(_print_TruncToFloat not implemented for r7   r   r   r   r   Ú_print_TruncToFloat|   s    ÿzExprPrinter._print_TruncToFloat)N)Ú__name__Ú
__module__Ú__qualname__Zprintmethodr.   ÚExprr-   r   r   r   r   r   r   r   r$   r&   r*   r/   r6   r:   r;   r<   r%   r=   r>   r@   rA   rB   rC   rD   rE   r   r   r   r   r      s0   
r   c                   @   s^  e Zd Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd	„Z	ejedœd
d„Z
ejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœd d!„Zejedœd"d#„Zejedœd$d%„Zejedœd&d'„Zejedœd(d)„Zejedœd*d+„Zejedœd,d-„Zejedœd.d/„Zejedœd0d1„Zejedœd2d3„Zejedœd4d5„Zejedœd6d7„Z ejedœd8d9„Z!ejedœd:d;„Z"ejedœd<d=„Z#ejedœd>d?„Z$ejedœd@dA„Z%ejedœdBdC„Z&dDS )EÚPythonPrinterr   c                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )Né   ztorch.sym_float(r   r"   ©Úlenr   r)   r   r   r   r   r:   ƒ   s    zPythonPrinter._print_ToFloatc                 C   s   |   |jdt|ƒ¡S )Nz and r   r   r   r   r   Ú
_print_And”   s    zPythonPrinter._print_Andc                 C   s   |   |jdt|ƒ¡S )Nz or r   r   r   r   r   Ú	_print_Or—   s    zPythonPrinter._print_Orc                    sF   ‡ fdd„|j D ƒ\}}}|dkr4d|› d|› d}d|› d|› dS )Nc                 3   s"   | ]}ˆ   |td  d ¡V  qdS ©r   r   N©Úparenthesizer   ©Ú.0Úarg©r   r   r   Ú	<genexpr>›   s   z7PythonPrinter._print_ModularIndexing.<locals>.<genexpr>r1   r!   ú // r"   r   ©r   ©r   r	   ÚxÚdivÚmodr   rV   r   Ú_print_ModularIndexingš   s    
ÿz$PythonPrinter._print_ModularIndexingc                 C   s   dS )Nzmath.infr   r   r   r   r   r;   ¢   s    zPythonPrinter._print_Infinityc                 C   s   dS )Nz	-math.infr   r   r   r   r   r<   ¥   s    z%PythonPrinter._print_NegativeInfinityc                 C   s   |   |jdtd d ¡S r   r   r   r   r   r   r=   ©   s    zPythonPrinter._print_PythonModc                    s&   ‡ fdd„|j D ƒ\}}|› d|› S )Nc                 3   s"   | ]}ˆ   |td  d ¡V  qdS rP   rQ   rS   rV   r   r   rW   ®   ó    z0PythonPrinter._print_FloorDiv.<locals>.<genexpr>rX   rY   ©r   r	   r[   r\   r   rV   r   r%   ­   s    zPythonPrinter._print_FloorDivc                 C   s   |   |jdtd d ¡S )Nr    r   r   r   r   r   r   r   r>   ³   s    zPythonPrinter._print_IntTrueDivc                 C   s   d|   |¡› dS )Nz
math.sqrt(r"   ©r)   r   r   r   r   Ú_helper_sqrt¶   s    zPythonPrinter._helper_sqrtc                 C   s   |   |jd ¡S r'   )rb   r   r   r   r   r   Ú_print_OpaqueUnaryFn_sqrt¹   s    z'PythonPrinter._print_OpaqueUnaryFn_sqrtc                 C   s   |   |jdtd ¡S ©Nz ** ÚPowr   r   r   r   r   rA   ¼   s    zPythonPrinter._print_FloatPowc                 C   s   |   |jdtd ¡S rd   r   r   r   r   r   r@   À   s    z!PythonPrinter._print_PowByNaturalc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS ©NrK   zmath.floor(r   r"   rL   r   r   r   r   Ú_print_floorÃ   s    zPythonPrinter._print_floorc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS rf   rL   r   r   r   r   Ú_print_FloorToIntÇ   s    zPythonPrinter._print_FloorToIntc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   zmath.trunc(r   r"   rL   r   r   r   r   rB   Ë   s    zPythonPrinter._print_TruncToIntc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS ©NrK   z
math.ceil(r   r"   rL   r   r   r   r   Ú_print_ceilingÐ   s    zPythonPrinter._print_ceilingc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS ri   rL   r   r   r   r   Ú_print_CeilToIntÔ   s    zPythonPrinter._print_CeilToIntc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   zabs(r   r"   rL   r   r   r   r   Ú
_print_AbsØ   s    zPythonPrinter._print_Absc                 C   s.   t |jƒdksJ ‚dd t| j|jƒ¡› dS )Né   zmax(ú, r"   ©rM   r   ÚjoinÚmapr)   r   r   r   r   Ú
_print_Maxß   s    zPythonPrinter._print_Maxc                 C   s.   t |jƒdksJ ‚dd t| j|jƒ¡› dS )Nrm   zmin(rn   r"   ro   r   r   r   r   Ú
_print_Minã   s    zPythonPrinter._print_Minc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z	math.cos(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_cosç   s    z&PythonPrinter._print_OpaqueUnaryFn_cosc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
math.cosh(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_coshë   s    z'PythonPrinter._print_OpaqueUnaryFn_coshc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
math.acos(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_acosï   s    z'PythonPrinter._print_OpaqueUnaryFn_acosc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z	math.sin(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_sinó   s    z&PythonPrinter._print_OpaqueUnaryFn_sinc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
math.sinh(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_sinh÷   s    z'PythonPrinter._print_OpaqueUnaryFn_sinhc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
math.asin(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_asinû   s    z'PythonPrinter._print_OpaqueUnaryFn_asinc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z	math.tan(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_tanÿ   s    z&PythonPrinter._print_OpaqueUnaryFn_tanc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
math.tanh(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_tanh  s    z'PythonPrinter._print_OpaqueUnaryFn_tanhc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
math.atan(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_atan  s    z'PythonPrinter._print_OpaqueUnaryFn_atanc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
math.log2(r   r"   rL   r   r   r   r   Ú_print_OpaqueUnaryFn_log2  s    z'PythonPrinter._print_OpaqueUnaryFn_log2c                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   úround(r   r"   rL   r   r   r   r   rC     s    zPythonPrinter._print_RoundToIntc                 C   sD   t |jƒdksJ ‚|j\}}t|tjƒs,J ‚d|  |¡› d|› dS )Nrm   r~   rn   r"   )rM   r   Ú
isinstancer.   ZIntegerr)   )r   r	   ÚnumberÚndigitsr   r   r   rD     s    
z!PythonPrinter._print_RoundDecimalN)'rF   rG   rH   r.   rI   r-   r:   rN   rO   r^   r;   r<   r=   r%   r>   rb   rc   rA   r@   rg   rh   rB   rj   rk   rl   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   rC   rD   r   r   r   r   rJ   ‚   sB   rJ   c                   @   s¦  e Zd Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd	„Z	ejedœd
d„Z
ejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœdd„Zejedœd d!„Zejedœd"d#„Zejedœd$d%„Zejedœd&d'„Zejedœd(d)„Zejedœd*d+„Zejedœd,d-„Zejedœd.d/„Zejedœd0d1„Zejedœd2d3„Zejedœd4d5„Zejedœd6d7„Z ejedœd8d9„Z!ejedœd:d;„Z"ejedœd<d=„Z#ejedœd>d?„Z$ejedœd@dA„Z%ejedœdBdC„Z&ejedœdDdE„Z'ejedœdFdG„Z(ejedœdHdI„Z)ejedœdJdK„Z*dLS )MÚ
CppPrinterr   c                 C   sj   t jdv rdnd}t|ƒ}|tks*|tk r>t|› dt› ƒ‚n |tkr^|dksRJ ‚d|› dS |› |› S )N)ÚdarwinÚwin32ZLLÚLz too big to convert to r   z(-1z << 63))ÚsysÚplatformr2   ÚINDEX_TYPE_MAXÚINDEX_TYPE_MINÚOverflowErrorÚ
INDEX_TYPE)r   r	   ÚsuffixÚir   r   r   Ú_print_Integer  s    zCppPrinter._print_Integerc                    s.   ‡ fdd„|j D ƒ\}}}|› d|› d|› S )Nc                 3   s"   | ]}ˆ   |td  d ¡V  qdS rP   rQ   rS   rV   r   r   rW   (  s   z*CppPrinter._print_Where.<locals>.<genexpr>z ? z : rY   )r   r	   ÚcÚpÚqr   rV   r   Ú_print_Where'  s    
ÿzCppPrinter._print_Wherec              	   C   s|   |j \}}}|  |¡}|dkrT|  |¡}|jrBd|› d|› d}nd|› d|› d}|  |¡}dt› d|› d	t› d|› d	S )
NrK   ú,c10::div_floor_integer(static_cast<int64_t>(ú), static_cast<int64_t>(ú))ú,c10::div_floor_floating(static_cast<double>(ú), static_cast<double>(z(static_cast<ú>(z) % static_cast<)r   ÚdoprintÚ
is_integerr‹   rZ   r   r   r   r^   -  s    


z!CppPrinter._print_ModularIndexingc                 C   sH   |j \}}|  |¡}|  |¡}|jr6d|› d|› dS d|› d|› dS )Nr“   r”   r•   r–   r—   )r   r™   rš   r`   r   r   r   r%   9  s    


zCppPrinter._print_FloorDivc                 C   sF   t |jƒdksJ ‚d|  |jd ¡› d}|jrBdt› d|› dS |S ©NrK   zstd::floor(r   r"   ústatic_cast<r˜   ©rM   r   r)   rš   r‹   ©r   r	   Úrr   r   r   rg   A  s    zCppPrinter._print_floorc                 C   sF   t |jƒdksJ ‚d|  |jd ¡› d}|jrBdt› d|› dS |S r›   r   rž   r   r   r   rh   F  s    zCppPrinter._print_FloorToIntc                 C   s<   t |jƒdksJ ‚d|  |jd ¡› d}dt› d|› dS )NrK   ústd::trunc(r   r"   rœ   r˜   )rM   r   r)   r‹   rž   r   r   r   rB   K  s    zCppPrinter._print_TruncToIntc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   r    r   r"   rL   r   r   r   r   rE   P  s    zCppPrinter._print_TruncToFloatc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   ústatic_cast<double>(r   r"   rL   r   r   r   r   r:   T  s    zCppPrinter._print_ToFloatc                 C   s0   |j \}}|  |¡}|  |¡}d|› d|› dS )Nzc10::div_mod(rn   r"   )r   r™   r`   r   r   r   r=   X  s    


zCppPrinter._print_PythonModc                 C   s(   |j \}}d|  |¡› d|  |¡› dS )Nr¡   z) / static_cast<double>(r"   ©r   r)   )r   r	   ÚlhsÚrhsr   r   r   r>   ^  s    
zCppPrinter._print_IntTrueDivc                 C   s:   |j \}}|dkr$d|  |¡› dS tdt| ƒ› ƒ‚d S )Nrm   z(1 << (r•   r?   )r   r)   r8   r9   r3   r   r   r   r@   e  s    
ÿzCppPrinter._print_PowByNaturalc                 C   s(   |j \}}d|  |¡› d|  |¡› dS )Nú	std::pow(rn   r"   r¢   r3   r   r   r   rA   n  s    
zCppPrinter._print_FloatPowc                 C   sô   |j \}}|dks|dkrD|  |¡}|dkr8d|› dS d|› dS |jrÚt|ƒ}|dkrt|  |g| dtd ¡}nJ|d	k r¢d
|  |gt|ƒ dtd ¡ d }n|d	krºd|  |¡ }nd}|jrÖdt› d|› dS |S d|› dt|ƒ› dS d S )Nr   g      à¿ú
std::sqrt(r"   z1.0/std::sqrt(r   r   r0   éÿÿÿÿz1.0/(z1.0/z1.0rœ   r˜   r¥   rn   )	r   r)   rš   r2   r   r   Úabsr‹   Úfloat)r   r	   r4   r5   rŸ   r   r   r   r6   r  s(    

 ÿþÿzCppPrinter._print_Powc                 C   sD   |j dkr|j› }n|j› d|j › d}|jr@dt› d|› dS |S )NrK   z.0/z.0rœ   r˜   r"   )r‘   r   rš   r‹   rž   r   r   r   Ú_print_Rational  s    

zCppPrinter._print_Rationalc                 C   sF   t |jƒdksJ ‚d|  |jd ¡› d}|jrBdt› d|› dS |S ©NrK   z
std::ceil(r   r"   rœ   r˜   r   rž   r   r   r   rj   •  s    zCppPrinter._print_ceilingc                 C   sF   t |jƒdksJ ‚d|  |jd ¡› d}|jrBdt› d|› dS |S r«   r   rž   r   r   r   rk   š  s    zCppPrinter._print_CeilToIntc              	      sn   ‡ fdd„|j D ƒ}t|ƒdkrFdt› d|d › dt› d|d › d		S d
d |¡ d }dt› d|› dS d S )Nc                    s   g | ]}ˆ   |¡‘qS r   ra   ©rT   ÚarV   r   r   Ú
<listcomp>   r_   z)CppPrinter._print_Min.<locals>.<listcomp>rm   zstd::min(static_cast<r˜   r   ú), static_cast<rK   r•   Ú{rn   Ú}z	std::min<r"   ©r   rM   r‹   rp   ©r   r	   r   Zilr   rV   r   rs   Ÿ  s
    &zCppPrinter._print_Minc              	      sn   ‡ fdd„|j D ƒ}t|ƒdkrFdt› d|d › dt› d|d › d		S d
d |¡ d }dt› d|› dS d S )Nc                    s   g | ]}ˆ   |¡‘qS r   ra   r¬   rV   r   r   r®   ©  r_   z)CppPrinter._print_Max.<locals>.<listcomp>rm   zstd::max(static_cast<r˜   r   r¯   rK   r•   r°   rn   r±   z	std::max<r"   r²   r³   r   rV   r   rr   ¨  s
    &zCppPrinter._print_Maxc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z	std::abs(r   r"   rL   r   r   r   r   rl   ±  s    zCppPrinter._print_Absc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z	std::cos(r   r"   rL   r   r   r   r   rt   µ  s    z#CppPrinter._print_OpaqueUnaryFn_cosc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
std::cosh(r   r"   rL   r   r   r   r   ru   ¹  s    z$CppPrinter._print_OpaqueUnaryFn_coshc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
std::acos(r   r"   rL   r   r   r   r   rv   ½  s    z$CppPrinter._print_OpaqueUnaryFn_acosc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z	std::sin(r   r"   rL   r   r   r   r   rw   Á  s    z#CppPrinter._print_OpaqueUnaryFn_sinc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
std::sinh(r   r"   rL   r   r   r   r   rx   Å  s    z$CppPrinter._print_OpaqueUnaryFn_sinhc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
std::asin(r   r"   rL   r   r   r   r   ry   É  s    z$CppPrinter._print_OpaqueUnaryFn_asinc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z	std::tan(r   r"   rL   r   r   r   r   rz   Í  s    z#CppPrinter._print_OpaqueUnaryFn_tanc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
std::tanh(r   r"   rL   r   r   r   r   r{   Ñ  s    z$CppPrinter._print_OpaqueUnaryFn_tanhc                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   z
std::atan(r   r"   rL   r   r   r   r   r|   Õ  s    z$CppPrinter._print_OpaqueUnaryFn_atanc                 C   s   d|   |jd ¡› dS )Nr¦   r   r"   r(   r   r   r   r   rc   Ù  s    z$CppPrinter._print_OpaqueUnaryFn_sqrtc                 C   s   d|   |jd ¡› dS )Nz
std::log2(r   r"   r(   r   r   r   r   r}   Ü  s    z$CppPrinter._print_OpaqueUnaryFn_log2c                 C   s*   t |jƒdksJ ‚d|  |jd ¡› dS )NrK   zstd::lrint(r   r"   rL   r   r   r   r   rC   ß  s    zCppPrinter._print_RoundToIntc                 C   sh   t |jƒdksJ ‚|j\}}|jr>|dk s.J ‚td|› dƒ‚|  |td ¡}d|› d|› d| › d	S )
Nrm   r   zOFor integer inputs, only non-negative ndigits are currently supported, but got Ú.r0   z%static_cast<double>(std::nearbyint(1ez * z) * 1er"   )rM   r   rš   Ú
ValueErrorrR   r   )r   r	   r€   r   Z
number_strr   r   r   rD   ä  s    

ÿzCppPrinter._print_RoundDecimalc                 C   s   dS )NÚtruer   r   r   r   r   Ú_print_BooleanTrueð  s    zCppPrinter._print_BooleanTruec                 C   s   dS )NÚfalser   r   r   r   r   Ú_print_BooleanFalseó  s    zCppPrinter._print_BooleanFalsec                 C   s   dS )Nz'std::numeric_limits<double>::infinity()r   r   r   r   r   r;   ö  s    zCppPrinter._print_Infinityc                 C   s   d|   |¡› S )Nú-)r;   r   r   r   r   r<   ù  s    z"CppPrinter._print_NegativeInfinityN)+rF   rG   rH   r.   rI   r-   rŽ   r’   r^   r%   rg   rh   rB   rE   r:   r=   r>   r@   rA   r6   rª   rj   rk   rs   rr   rl   rt   ru   rv   rw   rx   ry   rz   r{   r|   rc   r}   rC   rD   r·   r¹   r;   r<   r   r   r   r   r‚     sJ   			r‚   )r†   Útypingr   r.   Zsympy.printing.precedencer   r   Zsympy.printing.strr   r‹   rˆ   r‰   r   rJ   r‚   r   r   r   r   Ú<module>   s   r 