U
    ZÊ¹jN  ã                   @   s¤  d dl mZ d dlmZ d dlmZ ddlmZmZm	Z	m
Z
mZmZ ddlmZ d ¡ Zdd	„ e ¡ D ƒZeefd
ddddddddddddœŽZddddddœZdd„ e ¡ D ƒZdd„ e ¡ D ƒZG d d!„ d!eeƒZeD ]Zeed"e› �e
ƒ qÚeD ]Zeed"e› �e	ƒ qöd#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<œZd=dd>œZd?d„ e ¡ D ƒZd@d„ e ¡ D ƒZG dAdB„ dBeƒZ eD ]Zee d"e› �e
ƒ �qˆeD ]Zee d"e› �e	ƒ �q¦dCd„ e ¡ D ƒZ!dDd„ e ¡ D ƒZ"G dEdF„ dFeƒZ#e!D ]Zee#d"e› �e
ƒ �qøe"D ]Zee#d"e› �e	ƒ �qdGd„ e ¡ D ƒZ$dHd„ e ¡ D ƒZ%G dIdJ„ dJeƒZ&e$D ]Zee&d"e› �e
ƒ �qhe%D ]Zee&d"e› �e	ƒ �q†dKS )Lé    )ÚS)ÚLambda)ÚPowé   )ÚPythonCodePrinterÚ_known_functions_mathÚ_print_known_constÚ_print_known_funcÚ_unpack_integral_limitsÚArrayPrinter)ÚCodePrinterz!erf erfc factorial gamma loggammac                 C   s    g | ]\}}|t kr||f‘qS © )Ú_not_in_numpy©Ú.0ÚkÚvr   r   úS/var/www/html/bwave/python/venv/lib/python3.8/site-packages/sympy/printing/numpy.pyÚ
<listcomp>	   s      r   ZarccosZarccoshZarcsinZarcsinhZarctanZarctan2ZarctanhÚexp2ÚsignÚ	logaddexpÚ
logaddexp2Úisnan)ÚacosÚacoshÚasinÚasinhÚatanÚatan2Úatanhr   r   r   r   r   ÚeÚpiZeuler_gammaÚnanÚinf)ZExp1ÚPiZ
EulerGammaÚNaNÚInfinityc                 C   s   i | ]\}}|d | “qS ©znumpy.r   r   r   r   r   Ú
<dictcomp>    s      r)   c                 C   s   i | ]\}}|d | “qS r(   r   r   r   r   r   r)   !   s      c                       sl  e Zd ZdZdZeZeZdN‡ fdd„	Z	dd„ Z
dd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Z‡ fd(d)„Zd*d+„ Zd,d-„ Zd.d/„ ZdOd1d2„Zd3d4„ Z d5d6„ Z!d7d8„ Z"d9d:„ Z#d;d<„ Z$d=d>„ Z%d?d@„ Z&dAdB„ Z'dCdD„ Z(dEdF„ Z)‡ fdGdH„Z*dIZ+dJZ,dKZ-dLZ.dMZ/e0j1Z2e0j1Z3e0j1Z4e0j1Z5‡  Z6S )PÚNumPyPrinterza
    Numpy printer which handles vectorized piecewise functions,
    logical operators, etc.
    ÚnumpyNc                    s<   d  | j¡| _d  | j¡| _tj| j–| _tƒ j|d� dS )z 
        `settings` is passed to CodePrinter.__init__()
        `module` specifies the array module to use, currently 'NumPy', 'CuPy'
        or 'JAX'.
        zPython with {}z_{}code©ÚsettingsN)ÚformatÚ_moduleÚlanguageÚprintmethodr   Ú_kfÚsuperÚ__init__©Úselfr-   ©Ú	__class__r   r   r4   -   s    zNumPyPrinter.__init__c                    s"   d}d  | ‡ fdd„|D ƒ¡¡S )z+General sequence printer: converts to tupleú, z({},)c                 3   s   | ]}ˆ   |¡V  qd S ©N©Ú_print)r   Úitem©r6   r   r   Ú	<genexpr>@   s     z*NumPyPrinter._print_seq.<locals>.<genexpr>)r.   Újoin)r6   ÚseqÚ	delimiterr   r>   r   Ú
_print_seq;   s    zNumPyPrinter._print_seqc                 C   s   d|   tj¡ S )Nú-)r<   r   r'   ©r6   Úexprr   r   r   Ú_print_NegativeInfinityB   s    z$NumPyPrinter._print_NegativeInfinityc                    sj   |  ¡ d tjk	rJ|  ¡ d |  ¡ d g }d d ‡ fdd„|D ƒ¡¡S d d ‡ fdd„|jD ƒ¡¡S )zMatrix multiplication printerr   r   ú({})z).dot(c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   ©r   Úir>   r   r   r?   I   s     z-NumPyPrinter._print_MatMul.<locals>.<genexpr>c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   rI   r>   r   r   r?   J   s     )Zas_coeff_matricesr   ZOner.   r@   Úargs)r6   rF   Z	expr_listr   r>   r   Ú_print_MatMulE   s    zNumPyPrinter._print_MatMulc                 C   s2   d  |  | jd ¡|  |jd ¡|  |jd ¡¡S )zMatrix power printerz
{}({}, {})z.linalg.matrix_powerr   r   ©r.   Ú_module_formatr/   r<   rK   rE   r   r   r   Ú_print_MatPowL   s     ÿzNumPyPrinter._print_MatPowc                 C   s$   d  |  | jd ¡|  |jd ¡¡S )zMatrix inverse printerú{}({})z.linalg.invr   rM   rE   r   r   r   Ú_print_InverseQ   s    ÿzNumPyPrinter._print_Inversec                 C   sX   |j \}}|jd dkr|j}|jd dkr2|j}d|  | jd ¡|  |¡|  |¡f S )Nr   r   ú
%s(%s, %s)z.dot)rK   ÚshapeÚTrN   r/   r<   )r6   rF   Zarg1Zarg2r   r   r   Ú_print_DotProductV   s    
þzNumPyPrinter._print_DotProductc                 C   s*   d|   | jd ¡|  |j¡|  |j¡f S )NrR   z.linalg.solve)rN   r/   r<   ÚmatrixZvectorrE   r   r   r   Ú_print_MatrixSolvec   s    

þzNumPyPrinter._print_MatrixSolvec                 C   s    d  |  | jd ¡|  |j¡¡S )NrP   z.zeros©r.   rN   r/   r<   rS   rE   r   r   r   Ú_print_ZeroMatrixh   s    
ÿzNumPyPrinter._print_ZeroMatrixc                 C   s    d  |  | jd ¡|  |j¡¡S )NrP   z.onesrX   rE   r   r   r   Ú_print_OneMatrixl   s    
ÿzNumPyPrinter._print_OneMatrixc                    s~   ddl m}m} |j}t|tƒs4t||f|||ƒƒ}d ˆ  ˆ jd ¡d 	‡ fdd„|j
d D ƒ¡ˆ  |j
d ¡ˆ  |j¡¡S )	Nr   )rJ   Újz{}(lambda {}: {}, {})z.fromfunctionr9   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   ©r   Úargr>   r   r   r?   v   s     z5NumPyPrinter._print_FunctionMatrix.<locals>.<genexpr>r   )Z	sympy.abcrJ   r[   ÚlamdaÚ
isinstancer   r.   rN   r/   r@   rK   r<   rS   )r6   rF   rJ   r[   r^   r   r>   r   Ú_print_FunctionMatrixp   s    
 
þz"NumPyPrinter._print_FunctionMatrixc                    sZ   ˆ  ˆjd ¡‰ d ‡ ‡fdd„|jd d… D ƒ¡d ˆ |jd ¡dt|jƒd  ¡ S )	Nú	.multiplyÚ c                 3   s    | ]}d   ˆ ˆ |¡¡V  qdS ©z{}({}, N©r.   r<   r\   ©Úfuncr6   r   r   r?   {   s   ÿz6NumPyPrinter._print_HadamardProduct.<locals>.<genexpr>éÿÿÿÿú{}{}ú)r   ©rN   r/   r@   rK   r.   r<   ÚlenrE   r   re   r   Ú_print_HadamardProducty   s    ÿÿÿz#NumPyPrinter._print_HadamardProductc                    sZ   ˆ  ˆjd ¡‰ d ‡ ‡fdd„|jd d… D ƒ¡d ˆ |jd ¡dt|jƒd  ¡ S )	Nz.kronrb   c                 3   s    | ]}d   ˆ ˆ |¡¡V  qdS rc   rd   r\   re   r   r   r?   �   s   ÿz7NumPyPrinter._print_KroneckerProduct.<locals>.<genexpr>rg   rh   ri   r   rj   rE   r   re   r   Ú_print_KroneckerProduct   s    ÿÿÿz$NumPyPrinter._print_KroneckerProductc                 C   s2   d  |  | jd ¡|  | jd ¡|  |jd ¡¡S )Nz
{}({}({}))z
.conjugatez
.transposer   rM   rE   r   r   r   Ú_print_Adjoint…   s
    ýzNumPyPrinter._print_Adjointc                 C   s8   d  |  | jd ¡|  |j¡¡}d  |  | jd ¡|¡S )NrP   z.diagz{}({}, (-1, 1))z.reshape)r.   rN   r/   r<   r]   )r6   rF   Zvectr   r   r   Ú_print_DiagonalOf‹   s    
þ ÿzNumPyPrinter._print_DiagonalOfc                 C   s$   d  |  | jd ¡|  |jd ¡¡S )NrP   z	.diagflatr   rM   rE   r   r   r   Ú_print_DiagMatrix’   s    ÿzNumPyPrinter._print_DiagMatrixc              
   C   sJ   d  |  | jd ¡|  |j¡|  | jd ¡|  |jd ¡|  |jd ¡¡S )Nz{}({}, {}({}, {}))ra   ú.eyer   r   )r.   rN   r/   r<   r]   rS   rE   r   r   r   Ú_print_DiagonalMatrix–   s    
  þz"NumPyPrinter._print_DiagonalMatrixc                    s„   ddl m‰ m‰ ‡ ‡‡fdd„‰d d ‡fdd„|jD ƒ¡¡}d d ‡fd	d„|jD ƒ¡¡}d
 ˆ ˆjd ¡||ˆ t	j
¡¡S )zPiecewise function printerr   )ÚITEÚsimplify_logicc                    s&   |   ˆ ¡rˆ ˆ| ƒ¡S ˆ | ¡S dS )z$ Problem having an ITE in the cond. N)Úhasr<   ©Zcond)rs   r6   rt   r   r   Ú
print_condž   s    
z1NumPyPrinter._print_Piecewise.<locals>.print_condz[{}]ú,c                 3   s   | ]}ˆ   |j¡V  qd S r:   )r<   rF   r\   r>   r   r   r?   ¤   s     z0NumPyPrinter._print_Piecewise.<locals>.<genexpr>c                 3   s   | ]}ˆ |j ƒV  qd S r:   rv   r\   )rw   r   r   r?   ¥   s     z{}({}, {}, default={})z.select)Zsympy.logic.boolalgrs   rt   r.   r@   rK   rN   r/   r<   r   r&   )r6   rF   ZexprsZcondsr   )rs   rw   r6   rt   r   Ú_print_Piecewise›   s        
þzNumPyPrinter._print_Piecewisec                    sf   dddddddœ}|j |krZ|  |j¡}|  |j¡}dj|  | jd	 ||j   ¡||d
�S tƒ  |¡S )z.Relational printer for Equality and UnequalityÚequalÚ	not_equalÚlessZ
less_equalZgreaterZgreater_equal)z==z!=ú<z<=ú>z>=z{op}({lhs}, {rhs})Ú.)ÚopÚlhsÚrhs)	Zrel_opr<   r�   r‚   r.   rN   r/   r3   Ú_print_Relational)r6   rF   r€   r�   r‚   r7   r   r   rƒ   ®   s    ú
 ÿzNumPyPrinter._print_Relationalc                    s.   d  ˆ  ˆ jd ¡d ‡ fdd„|jD ƒ¡¡S )úLogical And printerú{}.reduce(({}))z.logical_andrx   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   rI   r>   r   r   r?   Ä   s     z*NumPyPrinter._print_And.<locals>.<genexpr>©r.   rN   r/   r@   rK   rE   r   r>   r   Ú
_print_And¿   s    zNumPyPrinter._print_Andc                    s.   d  ˆ  ˆ jd ¡d ‡ fdd„|jD ƒ¡¡S )úLogical Or printerr…   z.logical_orrx   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   rI   r>   r   r   r?   Ë   s     z)NumPyPrinter._print_Or.<locals>.<genexpr>r†   rE   r   r>   r   Ú	_print_OrÆ   s    zNumPyPrinter._print_Orc                    s.   d  ˆ  ˆ jd ¡d ‡ fdd„|jD ƒ¡¡S )zLogical Not printerrP   z.logical_notrx   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   rI   r>   r   r   r?   Ò   s     z*NumPyPrinter._print_Not.<locals>.<genexpr>r†   rE   r   r>   r   Ú
_print_NotÍ   s    zNumPyPrinter._print_NotFc                 C   s<   |j jr&|j jr&t|j|j  ¡ dd�}| j||| jd d�S )NF)Úevaluatez.sqrt)ÚrationalÚsqrt)ÚexpÚ
is_integerZis_negativer   ÚbaseZevalfZ_hprint_Powr/   )r6   rF   rŒ   r   r   r   Ú
_print_PowÔ   s    zNumPyPrinter._print_Powc              	      s8   d  ˆ  ˆ jd ¡ˆ  ˆ j¡d ‡ fdd„|jD ƒ¡¡S )Nú{}({}.asarray([{}]), axis=0)z.aminrx   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   rI   r>   r   r   r?   Û   s     z*NumPyPrinter._print_Min.<locals>.<genexpr>r†   rE   r   r>   r   Ú
_print_MinÚ   s    zNumPyPrinter._print_Minc              	      s8   d  ˆ  ˆ jd ¡ˆ  ˆ j¡d ‡ fdd„|jD ƒ¡¡S )Nr’   z.amaxrx   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   rI   r>   r   r   r?   Þ   s     z*NumPyPrinter._print_Max.<locals>.<genexpr>r†   rE   r   r>   r   Ú
_print_MaxÝ   s    zNumPyPrinter._print_Maxc                 C   s$   d|   | jd ¡|  |jd ¡f S )Nú%s(%s)z.angler   ©rN   r/   r<   rK   rE   r   r   r   Ú
_print_argß   s    zNumPyPrinter._print_argc                 C   s$   d|   | jd ¡|  |jd ¡f S )Nr•   z.imagr   r–   rE   r   r   r   Ú	_print_imâ   s    zNumPyPrinter._print_imc                    s.   dˆ   ˆ jd ¡d ‡ fdd„|jD ƒ¡f S )Nr•   z.modr9   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   r\   r>   r   r   r?   ç   s     z*NumPyPrinter._print_Mod.<locals>.<genexpr>)rN   r/   r@   rK   rE   r   r>   r   Ú
_print_Modå   s    ÿzNumPyPrinter._print_Modc                 C   s$   d|   | jd ¡|  |jd ¡f S )Nr•   z.realr   r–   rE   r   r   r   Ú	_print_reé   s    zNumPyPrinter._print_rec                 C   s*   d|   | jd ¡|  |jd tj ¡f S )Nr•   z.sincr   )rN   r/   r<   rK   r   r%   rE   r   r   r   Ú_print_sincì   s    zNumPyPrinter._print_sincc                 C   s@   | j  |jjd ¡}|d kr*|  | jd ¡}d||  | ¡ ¡f S )Nz.arrayr•   )Zknown_functionsÚgetr8   Ú__name__rN   r/   r<   Útolist)r6   rF   rf   r   r   r   Ú_print_MatrixBaseï   s    zNumPyPrinter._print_MatrixBasec                 C   sH   |j }tdd„ |D ƒƒr<d|  | jd ¡|  |j d ¡f S tdƒ‚d S )Nc                 s   s   | ]}|j V  qd S r:   )Z
is_Integer)r   Údimr   r   r   r?   ÷   s     z/NumPyPrinter._print_Identity.<locals>.<genexpr>r•   rq   r   zFSymbolic matrix dimensions are not yet supported for identity matrices)rS   ÚallrN   r/   r<   ÚNotImplementedError)r6   rF   rS   r   r   r   Ú_print_Identityõ   s    $zNumPyPrinter._print_Identityc                 C   s(   d  |  | jd ¡|  |jd  ¡ ¡¡S )NrP   z.blockr   )r.   rN   r/   r<   rK   rž   rE   r   r   r   Ú_print_BlockMatrixü   s    ÿzNumPyPrinter._print_BlockMatrixc                    sV   t |jƒdkr,| jd |  |jd ¡ d S t |jƒdkrH|  | ¡ ¡S tƒ  | |¡S )Nr   z.array(r   ri   é   )rk   rS   r/   r<   rK   Ztomatrixr3   Ú_print_not_supportedrE   r7   r   r   Ú_print_NDimArray   s
    zNumPyPrinter._print_NDimArrayÚaddZeinsumZ	transposeZonesZzeros)N)F)7r�   Ú
__module__Ú__qualname__Ú__doc__r/   Ú_numpy_known_functionsr2   Ú_numpy_known_constantsÚ_kcr4   rC   rG   rL   rO   rQ   rU   rW   rY   rZ   r`   rl   rm   rn   ro   rp   rr   ry   rƒ   r‡   r‰   rŠ   r‘   r“   r”   r—   r˜   r™   rš   r›   rŸ   r£   r¤   r§   Ú_addZ_einsumZ
_transposeZ_onesZ_zerosr   r¦   Ú_print_lowergammaÚ_print_uppergammaÚ_print_fresnelcÚ_print_fresnelsÚ__classcell__r   r   r7   r   r*   #   s^   	
r*   Z_print_ZexpiÚerfÚerfcZjvZyvZivÚkvÚcosm1Úpowm1Ú	factorialÚgammaZgammalnÚpsiÚ	polygammaZpochZeval_jacobiZeval_gegenbauerZeval_chebytZeval_chebyuZeval_legendreZeval_hermiteZeval_laguerreZeval_genlaguerreÚbetaZlambertw)ZEirµ   r¶   ZbesseljZbesselyZbesseliZbesselkr¸   r¹   rº   r»   ZloggammaZdigammar½   ZRisingFactorialZjacobiZ
gegenbauerZ
chebyshevtZ
chebyshevuZlegendreZhermiteZlaguerreZassoc_laguerrer¾   ZLambertWZgolden_ratio)ZGoldenRatior%   c                 C   s   i | ]\}}|d | “qS )zscipy.special.r   r   r   r   r   r)   :  s      c                 C   s   i | ]\}}|d | “qS )zscipy.constants.r   r   r   r   r   r)   ;  s      c                       s¾   e Zd Zeje–Zeje–Zd&‡ fdd„	Zdd„ Z	e	Z
dd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Z‡  ZS )'ÚSciPyPrinterNc                    s   t ƒ j|d� d| _d S )Nr,   zPython with SciPy and NumPy)r3   r4   r0   r5   r7   r   r   r4   B  s    zSciPyPrinter.__init__c                 C   sd   g g g   }}}|  ¡  ¡ D ]*\\}}}| |¡ | |¡ | |¡ qdj|  d¡||||jd�S )Nz+{name}(({data}, ({i}, {j})), shape={shape})zscipy.sparse.coo_matrix)ÚnameÚdatarJ   r[   rS   )ZtodokÚitemsÚappendr.   rN   rS   )r6   rF   rJ   r[   rÁ   ÚrÚcr   r   r   r   Ú_print_SparseRepMatrixF  s    

   þz#SciPyPrinter._print_SparseRepMatrixc              	   C   s:   d  |  d¡|  |jd ¡|  |jd ¡|  |jd ¡¡S )Nz{0}({2}, {1}, {3})zscipy.special.lpmvr   r   r¥   ©r.   rN   r<   rK   rE   r   r   r   Ú_print_assoc_legendreU  s    üz"SciPyPrinter._print_assoc_legendrec              	   C   s4   d  |  d¡|  d¡|  |jd ¡|  |jd ¡¡S )Nú{0}({2})*{1}({2}, {3})úscipy.special.gammazscipy.special.gammaincr   r   rÇ   rE   r   r   r   r°   \  s    üzSciPyPrinter._print_lowergammac              	   C   s4   d  |  d¡|  d¡|  |jd ¡|  |jd ¡¡S )NrÉ   rÊ   zscipy.special.gammainccr   r   rÇ   rE   r   r   r   r±   c  s    üzSciPyPrinter._print_uppergammac                    s�   ˆ   d¡}ˆ   d¡}‡ fdd„|jD ƒ}d|› d|d › d|d › d|d	 › d
|› d|d › d|d › d|d › d|› d|d › d|d › d�S )Núscipy.special.betainczscipy.special.betac                    s   g | ]}ˆ   |¡‘qS r   r;   r\   r>   r   r   r   m  s     z/SciPyPrinter._print_betainc.<locals>.<listcomp>ú(r   r9   r   é   z) - r¥   z))             * ri   )rN   rK   )r6   rF   Zbetaincr¾   rK   r   r>   r   Ú_print_betaincj  s    

JÿzSciPyPrinter._print_betaincc              
   C   sH   d  |  d¡|  |jd ¡|  |jd ¡|  |jd ¡|  |jd ¡¡S )Nz'{0}({1}, {2}, {4}) - {0}({1}, {2}, {3})rË   r   r   r¥   rÍ   rÇ   rE   r   r   r   Ú_print_betainc_regularizedq  s    ûz'SciPyPrinter._print_betainc_regularizedc                 C   s   d  |  d¡|  |jd ¡¡S )Nú	{}({})[0]úscipy.special.fresnelr   rÇ   rE   r   r   r   r³   y  s    þzSciPyPrinter._print_fresnelsc                 C   s   d  |  d¡|  |jd ¡¡S )Nú	{}({})[1]rÑ   r   rÇ   rE   r   r   r   r²   ~  s    þzSciPyPrinter._print_fresnelcc                 C   s   d  |  d¡|  |jd ¡¡S )NrÐ   úscipy.special.airyr   rÇ   rE   r   r   r   Ú_print_airyaiƒ  s    þzSciPyPrinter._print_airyaic                 C   s   d  |  d¡|  |jd ¡¡S )NrÒ   rÓ   r   rÇ   rE   r   r   r   Ú_print_airyaiprimeˆ  s    þzSciPyPrinter._print_airyaiprimec                 C   s   d  |  d¡|  |jd ¡¡S )Nz	{}({})[2]rÓ   r   rÇ   rE   r   r   r   Ú_print_airybi�  s    þzSciPyPrinter._print_airybic                 C   s   d  |  d¡|  |jd ¡¡S )Nz	{}({})[3]rÓ   r   rÇ   rE   r   r   r   Ú_print_airybiprime’  s    þzSciPyPrinter._print_airybiprimec                 C   s   |   |j|jŽ ¡S r:   ©r<   Z_eval_rewrite_as_zetarK   rE   r   r   r   Ú_print_bernoulli—  s    zSciPyPrinter._print_bernoullic                 C   s   |   |j|jŽ ¡S r:   rØ   rE   r   r   r   Ú_print_harmonic›  s    zSciPyPrinter._print_harmonicc                    sŽ   t |ƒ\}}t|ƒdkr<ˆ  d¡}dttˆ j|d ƒƒ }n(ˆ  d¡}d d ‡ fdd	„|D ƒ¡¡}d
 |d tˆ j|ƒ¡ˆ  |jd ¡|¡S )Nr   zscipy.integrate.quadz%s, %sr   zscipy.integrate.nquadrH   r9   c                 3   s"   | ]}d t tˆ j|ƒƒ V  qdS )z(%s, %s)N)ÚtupleÚmapr<   )r   Úlr>   r   r   r?   §  s    z/SciPyPrinter._print_Integral.<locals>.<genexpr>z{}(lambda {}: {}, {})[0])	r
   rk   rN   rÛ   rÜ   r<   r.   r@   rK   )r6   r!   Zintegration_varsZlimitsZ
module_strZ	limit_strr   r>   r   Ú_print_Integralž  s    

ÿ
üzSciPyPrinter._print_Integralc                 C   s   d  |  d¡|  |jd ¡¡S )NrÐ   úscipy.special.sicir   rÇ   rE   r   r   r   Ú	_print_Si°  s    þzSciPyPrinter._print_Sic                 C   s   d  |  d¡|  |jd ¡¡S )NrÒ   rß   r   rÇ   rE   r   r   r   Ú	_print_Ciµ  s    þzSciPyPrinter._print_Ci)N)r�   r©   rª   r*   r2   Ú_scipy_known_functionsr®   Ú_scipy_known_constantsr4   rÆ   Z_print_ImmutableSparseMatrixrÈ   r°   r±   rÎ   rÏ   r³   r²   rÔ   rÕ   rÖ   r×   rÙ   rÚ   rÞ   rà   rá   r´   r   r   r7   r   r¿   =  s*   

r¿   c                 C   s   i | ]\}}|d | “qS ©zcupy.r   r   r   r   r   r)   Á  s      c                 C   s   i | ]\}}|d | “qS rä   r   r   r   r   r   r)   Â  s      c                       s.   e Zd ZdZdZeZeZd‡ fdd„	Z	‡  Z
S )ÚCuPyPrinterz`
    CuPy printer which handles vectorized piecewise functions,
    logical operators, etc.
    ZcupyNc                    s   t ƒ j|d� d S )Nr,   )r3   r4   r5   r7   r   r   r4   Î  s    zCuPyPrinter.__init__)N)r�   r©   rª   r«   r/   Ú_cupy_known_functionsr2   Ú_cupy_known_constantsr®   r4   r´   r   r   r7   r   rå   Ä  s
   rå   c                 C   s   i | ]\}}|d | “qS ©z
jax.numpy.r   r   r   r   r   r)   Ø  s      c                 C   s   i | ]\}}|d | “qS rè   r   r   r   r   r   r)   Ù  s      c                       s>   e Zd ZdZdZeZeZd
‡ fdd„	Z	dd„ Z
dd	„ Z‡  ZS )Ú
JaxPrinterz_
    JAX printer which handles vectorized piecewise functions,
    logical operators, etc.
    z	jax.numpyNc                    s   t ƒ j|d� d| _d S )Nr,   Z_jaxcode)r3   r4   r1   r5   r7   r   r   r4   å  s    zJaxPrinter.__init__c              	      s8   d  ˆ  ˆ jd ¡ˆ  ˆ j¡d ‡ fdd„|jD ƒ¡¡S )r„   r’   z.allrx   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   rI   r>   r   r   r?   ï  s     z(JaxPrinter._print_And.<locals>.<genexpr>r†   rE   r   r>   r   r‡   ê  s
    
ýzJaxPrinter._print_Andc              	      s8   d  ˆ  ˆ jd ¡ˆ  ˆ j¡d ‡ fdd„|jD ƒ¡¡S )rˆ   r’   z.anyrx   c                 3   s   | ]}ˆ   |¡V  qd S r:   r;   rI   r>   r   r   r?   ÷  s     z'JaxPrinter._print_Or.<locals>.<genexpr>r†   rE   r   r>   r   r‰   ò  s
    
ýzJaxPrinter._print_Or)N)r�   r©   rª   r«   r/   Ú_jax_known_functionsr2   Ú_jax_known_constantsr®   r4   r‡   r‰   r´   r   r   r7   r   ré   Û  s   ré   N)'Z
sympy.corer   Zsympy.core.functionr   Zsympy.core.powerr   Zpycoder   r   r   r	   r
   r   Zcodeprinterr   Úsplitr   rÂ   Z	_in_numpyÚdictZ_known_functions_numpyZ_known_constants_numpyr¬   r­   r*   rf   ÚsetattrÚconstZ_known_functions_scipy_specialZ _known_constants_scipy_constantsrâ   rã   r¿   ræ   rç   rå   rê   rë   ré   r   r   r   r   Ú<module>   s¨    ôû qçþ}