
    Xh9R                        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  ej                    D             Z eefi d	d
ddddddddddddZddddddZd e                                D             Zd e                                D             Z G d d ee          ZeD ]Z eed!e e
           eD ]Z eed!e e	           i d"d#d$d$d%d%d&d'd(d)d*d+d,d-d.d.d/d/d0d0d1d1d2d3d4d5d6d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEZdFddGZdH e                                D             ZdI e                                D             Z G dJ dKe          Z eD ]Z ee d!e e
           eD ]Z ee d!e e	           dL e                                D             Z!dM e                                D             Z" G dN dOe          Z#e!D ]Z ee#d!e e
           e"D ]Z ee#d!e e	           dP e                                D             Z$dQ e                                D             Z% G dR dSe          Z&e$D ]Z ee&d!e e
           e%D ]Z ee&d!e e	           dTS )U    )S)Lambda)Pow   )PythonCodePrinter_known_functions_math_print_known_const_print_known_func_unpack_integral_limitsArrayPrinter)CodePrinterz!erf erfc factorial gamma loggammac                 .    g | ]\  }}|t           v||fS  )_not_in_numpy.0kvs      f/var/www/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/sympy/printing/numpy.py
<listcomp>r   	   s*    XXX1-AWAWaVAWAWAW    arccosarccosharcsinarcsinharctanarctan2arctanhexp2sign	logaddexp
logaddexp2isinfisnan)acosacoshasinasinhatanatan2atanhr   r    r!   r"   r#   r$   epieuler_gammananinf)Exp1Pi
EulerGammaNaNInfinityc                      i | ]\  }}|d |z   S znumpy.r   r   s      r   
<dictcomp>r8   "   "    UUUda!X\UUUr   c                      i | ]\  }}|d |z   S r7   r   r   s      r   r8   r8   #   r9   r   c                   l    e Zd ZdZdZeZeZd2 fd	Z	d Z
d Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z fdZd Zd Zd Zd3dZde fdZ!d Z"d Z#d  Z$d! Z%d" Z&d# Z'd$ Z(d% Z)d& Z*d' Z+d( Z,d) Z-d* Z.d+ Z/d, Z0d-Z1d.Z2d/Z3d0Z4d1Z5e6j7        Z8e6j7        Z9e6j7        Z:e6j7        Z; xZ<S )4NumPyPrinterza
    Numpy printer which handles vectorized piecewise functions,
    logical operators, etc.
    numpyNc                     d                     | j                  | _        d                     | j                  | _        i t          j        | j        | _        t                                          |           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__s     r   rG   zNumPyPrinter.__init__/   sl     )//==$++DL998'+8tx8(+++++r   c                 p     d}d                     |                     fd|D                                 S )z+General sequence printer: converts to tuple, z({},)c              3   B   K   | ]}                     |          V  d S N_print)r   itemrI   s     r   	<genexpr>z*NumPyPrinter._print_seq.<locals>.<genexpr>B   s/      ,O,O4T[[->->,O,O,O,O,O,Or   )rA   join)rI   seq	delimiters   `  r   
_print_seqzNumPyPrinter._print_seq=   s=     	~~inn,O,O,O,O3,O,O,OOOPPPr   c                 F    d|                      t          j                  z   S )N-)rP   r   r5   rI   exprs     r   _print_NegativeInfinityz$NumPyPrinter._print_NegativeInfinityD   s    T[[,,,,r   c                     |                                 d         t          j        urj|                                 d         |                                 d         gz   }d                    d                     fd|D                                 S d                    d                     fd|j        D                                 S )zMatrix multiplication printerr   r   ({})z).dot(c              3   B   K   | ]}                     |          V  d S rN   rO   r   irI   s     r   rR   z-NumPyPrinter._print_MatMul.<locals>.<genexpr>K   s-      .Q.Q!t{{1~~.Q.Q.Q.Q.Q.Qr   c              3   B   K   | ]}                     |          V  d S rN   rO   r_   s     r   rR   z-NumPyPrinter._print_MatMul.<locals>.<genexpr>L   s-      *M*Ma4;;q>>*M*M*M*M*M*Mr   )as_coeff_matricesr   OnerA   rS   args)rI   rZ   	expr_lists   `  r   _print_MatMulzNumPyPrinter._print_MatMulG   s    !!##A&ae33..003d6L6L6N6Nq6Q4SSI==.Q.Q.Q.Qy.Q.Q.Q!Q!QRRR}}X]]*M*M*M*M49*M*M*MMMNNNr   c                     d                     |                     | j        dz             |                     |j        d                   |                     |j        d                             S )zMatrix power printerz
{}({}, {})z.linalg.matrix_powerr   r   rA   _module_formatrB   rP   rd   rY   s     r   _print_MatPowzNumPyPrinter._print_MatPowN   s^    ""4#6#6t|F\7\#]#]KK	!%%t{{49Q<'@'@B B 	Br   c                     d                     |                     | j        dz             |                     |j        d                             S )zMatrix inverse printer{}({})z.linalg.invr   rh   rY   s     r   _print_InversezNumPyPrinter._print_InverseS   sD    t224<-3OPPKK	!%%' ' 	'r   c                    |j         \  }}|j        d         dk    r|j        }|j        d         dk    r|j        }|                     | j        dz             d|                     |          d|                     |          dS )Nr   r   z.dot(rL   ))rd   shapeTri   rB   rP   )rI   rZ   arg1arg2s       r   _print_DotProductzNumPyPrinter._print_DotProductX   s     Y
d:a=A6D:a=A6D#224<&3HIIII#{{40000#{{400002 	2r   c                     |                      | j        dz             d|                     |j                  d|                     |j                  dS )Nz.linalg.solvero   rL   rp   )ri   rB   rP   matrixvectorrY   s     r   _print_MatrixSolvezNumPyPrinter._print_MatrixSolvee   sX    #224</3QRRRR#{{4;7777#{{4;77779 	9r   c                     d                     |                     | j        dz             |                     |j                            S )Nrl   z.zerosrA   ri   rB   rP   rq   rY   s     r   _print_ZeroMatrixzNumPyPrinter._print_ZeroMatrixj   s@    t224<(3JKKKK
##% % 	%r   c                     d                     |                     | j        dz             |                     |j                            S )Nrl   z.onesr{   rY   s     r   _print_OneMatrixzNumPyPrinter._print_OneMatrixn   s@    t224<'3IJJKK
##% % 	%r   c                     ddl m}m} |j        }t	          |t
                    st          ||f |||                    }d                                          j        dz             d	                     fd|j
        d         D                                            |j
        d                                        |j                            S )Nr   )r`   jz{}(lambda {}: {}, {})z.fromfunctionrL   c              3   B   K   | ]}                     |          V  d S rN   rO   r   argrI   s     r   rR   z5NumPyPrinter._print_FunctionMatrix.<locals>.<genexpr>x   s/      @@3dkk#&&@@@@@@r   r   )	sympy.abcr`   r   lamda
isinstancer   rA   ri   rB   rS   rd   rP   rq   )rI   rZ   r`   r   r   s   `    r   _print_FunctionMatrixz"NumPyPrinter._print_FunctionMatrixr   s    """"""""
%(( 	0Aq655A;;//E&--d.A.A$,Q`B`.a.aII@@@@%*Q-@@@@@KK
1&&DJ(?(?A A 	Ar   c                 8                           j        dz             d                     fd|j        d d         D                       d                                         |j        d                   dt          |j                  dz
  z            z   S )N	.multiply c              3   j   K   | ]-}d                                          |                    V  .dS z{}({}, NrA   rP   r   r   funcrI   s     r   rR   z6NumPyPrinter._print_HadamardProduct.<locals>.<genexpr>}   S       ' ' !''dkk#.>.>?? ' ' ' ' ' 'r   {}{}rp   r   ri   rB   rS   rd   rA   rP   lenrI   rZ   r   s   ` @r   _print_HadamardProductz#NumPyPrinter._print_HadamardProduct{   s    ""4<+#=>>ww ' ' ' ' 'y"~' ' ' ' ')/t{{49R=7Q7Q3ty>>A%&*( *(( 	(r   c                 8                           j        dz             d                     fd|j        d d         D                       d                                         |j        d                   dt          |j                  dz
  z            z   S )Nz.kronr   c              3   j   K   | ]-}d                                          |                    V  .dS r   r   r   s     r   rR   z7NumPyPrinter._print_KroneckerProduct.<locals>.<genexpr>   r   r   r   r   rp   r   r   r   s   ` @r   _print_KroneckerProductz$NumPyPrinter._print_KroneckerProduct   s    ""4<'#9::ww ' ' ' ' 'y"~' ' ' ' ')/t{{49R=7Q7Q3ty>>A%&*( *(( 	(r   c                     d                     |                     | j        dz             |                     | j        dz             |                     |j        d                             S )Nz
{}({}({}))z
.conjugatez
.transposer   rh   rY   s     r   _print_AdjointzNumPyPrinter._print_Adjoint   s_    ""| ;<<| ;<<KK	!%%' ' 	'r   c                     d                     |                     | j        dz             |                     |j                            }d                     |                     | j        dz             |          S )Nrl   z.diagz{}({}, (-1, 1))z.reshape)rA   ri   rB   rP   r   )rI   rZ   vects      r   _print_DiagonalOfzNumPyPrinter._print_DiagonalOf   su    w 677KK!!# # !''z 9::DB B 	Br   c                     d                     |                     | j        dz             |                     |j        d                             S )Nrl   z	.diagflatr   rh   rY   s     r   _print_DiagMatrixzNumPyPrinter._print_DiagMatrix   sD    t224<+3MNNKK	!%%' ' 	'r   c           
      H   d                     |                     | j        dz             |                     |j                  |                     | j        dz             |                     |j        d                   |                     |j        d                             S )Nz{}({}, {}({}, {}))r   .eyer   r   )rA   ri   rB   rP   r   rq   rY   s     r   _print_DiagonalMatrixz"NumPyPrinter._print_DiagonalMatrix   s    #**4+>+>t|k?Y+Z+ZKK!!4#6#6t|f7L#M#MKK
1&&DJqM(B(BD D 	Dr   c                     ddl mm  fdd                    d                     fd|j        D                                 }d                    d                    fd|j        D                                 }d                                          j        d	z             ||                     t          j
                            S )
zPiecewise function printerr   )ITEsimplify_logicc                     |                                r                     |                     S                     |           S )z$ Problem having an ITE in the cond. )hasrP   )condr   rI   r   s    r   
print_condz1NumPyPrinter._print_Piecewise.<locals>.print_cond   sC    xx}} ){{>>$#7#7888{{4(((r   z[{}],c              3   L   K   | ]}                     |j                  V  d S rN   )rP   rZ   r   s     r   rR   z0NumPyPrinter._print_Piecewise.<locals>.<genexpr>   s1      &R&Rt{{38'<'<&R&R&R&R&R&Rr   c              3   8   K   | ]} |j                   V  d S rN   )r   )r   r   r   s     r   rR   z0NumPyPrinter._print_Piecewise.<locals>.<genexpr>   s/      &Q&Qzz#(';';&Q&Q&Q&Q&Q&Qr   z{}({}, {}, default={})z.select)sympy.logic.boolalgr   r   rA   rS   rd   ri   rB   rP   r   r4   )rI   rZ   exprscondsr   r   r   s   `   @@@r   _print_PiecewisezNumPyPrinter._print_Piecewise   s    ;;;;;;;;	) 	) 	) 	) 	) 	) 	) chh&R&R&R&R	&R&R&RRRSSchh&Q&Q&Q&Qty&Q&Q&QQQRR
 (..y 8995%KK    	 r   c                 T   ddddddd}|j         |v ru|                     |j                  }|                     |j                  }d                    |                     | j        d	z   ||j                  z             ||
          S t                                          |          S )z.Relational printer for Equality and Unequalityequal	not_equalless
less_equalgreatergreater_equal)z==z!=<z<=>z>=z{op}({lhs}, {rhs}).)oplhsrhs)	rel_oprP   r   r   rA   ri   rB   rF   _print_Relational)rI   rZ   r   r   r   rJ   s        r   r   zNumPyPrinter._print_Relational   s     !
 
 ;"++dh''C++dh''C'..$2E2EdlUXFXY[\`\gYhFh2i2i36C / A A Aww((...r   c                      d                                           j        dz             d                     fd|j        D                                 S )Logical And printer{}.reduce(({}))z.logical_andr   c              3   B   K   | ]}                     |          V  d S rN   rO   r_   s     r   rR   z*NumPyPrinter._print_And.<locals>.<genexpr>   sT        eH  eHxyeiepepqreses  eH  eH  eH  eH  eH  eHr   rA   ri   rB   rS   rd   rY   s   ` r   
_print_AndzNumPyPrinter._print_And   s    
 !''(;(;DL><Y(Z(Z\_\d\d  eH  eH  eH  eH  ~B  ~G  eH  eH  eH  ]H  ]H  I  I  	Ir   c                      d                                           j        dz             d                     fd|j        D                                 S )Logical Or printerr   z.logical_orr   c              3   B   K   | ]}                     |          V  d S rN   rO   r_   s     r   rR   z)NumPyPrinter._print_Or.<locals>.<genexpr>   sT        dG  dGwxdhdodopqdrdr  dG  dG  dG  dG  dG  dGr   r   rY   s   ` r   	_print_OrzNumPyPrinter._print_Or   s    
 !''(;(;DL=<X(Y(Y[^[c[c  dG  dG  dG  dG  }A  }F  dG  dG  dG  \G  \G  H  H  	Hr   c                      d                                           j        dz             d                     fd|j        D                                 S )zLogical Not printerrl   z.logical_notr   c              3   B   K   | ]}                     |          V  d S rN   rO   r_   s     r   rR   z*NumPyPrinter._print_Not.<locals>.<genexpr>   s4      [~[~op\`\g\ghi\j\j[~[~[~[~[~[~r   r   rY   s   ` r   
_print_NotzNumPyPrinter._print_Not   sV    
 t224<.3PQQSVS[S[[~[~[~[~txt}[~[~[~S~S~r   Fc                     |j         j        r:|j         j        r.t          |j        |j                                         d          }|                     ||| j        dz             S )NF)evaluatez.sqrt)rationalsqrt)exp
is_integeris_negativer   baseevalf_hprint_PowrB   )rI   rZ   r   s      r   
_print_PowzNumPyPrinter._print_Pow   sa    8 	D48#7 	Dty$(.."2"2UCCCDxdlW>TUUUr   r   c                 ,    t          |          dk    rt          d|           t          |          dk    r                     |d                   S                      d          } fd|D             }| d| dd                    |           d	S )
Nr   zNeed at least one argument for r   zfunctools.reducec                 :    g | ]}                     |          S r   rO   r   s     r   r   z8NumPyPrinter._helper_minimum_maximum.<locals>.<listcomp>   s%    333s$++c""333r   ro   z, [rL   z]))r   NotImplementedErrorrP   ri   rS   )rI   r   rd   _reduces_argss   `    r   _helper_minimum_maximumz$NumPyPrinter._helper_minimum_maximum   s    t99>>%&L&L&LMMMYY!^^;;tAw'''%%&8993333d33388B88499V#4#48888r   c                 ,    |                      |          S rN   )_print_minimumrY   s     r   
_print_MinzNumPyPrinter._print_Min       ""4(((r   c                     d                     |                     | j        dz             |                     |j                  |                     |j                            S )N{}({}, axis={})z.aminrA   ri   rB   rP   arrayaxisrY   s     r   _print_aminzNumPyPrinter._print_amin   j     ''(;(;DL7<R(S(SUYU`U`aeakUlUlnrnynyz~  {D  oE  oE  F  F  	Fr   c                 b    |                      | j        dz             } | j        |g|j        R  S )Nz.minimumri   rB   r   rd   rI   rZ   r   s      r   r   zNumPyPrinter._print_minimum   9      
!:;;+t+B;;;;;r   c                 ,    |                      |          S rN   )_print_maximumrY   s     r   
_print_MaxzNumPyPrinter._print_Max   r   r   c                     d                     |                     | j        dz             |                     |j                  |                     |j                            S )Nr   z.amaxr   rY   s     r   _print_amaxzNumPyPrinter._print_amax   r   r   c                 b    |                      | j        dz             } | j        |g|j        R  S )Nz.maximumr   r   s      r   r   zNumPyPrinter._print_maximum   r   r   c                     |                      | j        dz             d|                     |j        d                   dS )Nz.anglero   r   rp   ri   rB   rP   rd   rY   s     r   
_print_argzNumPyPrinter._print_arg   sD    ..t|h/FGGGGUYU^_`UaIbIbIbIbccr   c                     |                      | j        dz             d|                     |j        d                   dS )Nz.imagro   r   rp   r   rY   s     r   	_print_imzNumPyPrinter._print_im   D    ..t|g/EFFFFTXT]^_T`HaHaHaHabbr   c                                             j        dz             dd                     fd|j        D                       dS )Nz.modro   rL   c              3   B   K   | ]}                     |          V  d S rN   rO   r   s     r   rR   z*NumPyPrinter._print_Mod.<locals>.<genexpr>  s/      33#T[[333333r   rp   )ri   rB   rS   rd   rY   s   ` r   
_print_ModzNumPyPrinter._print_Mod   sb    ..t|f/DEEEEtyy3333333H5 H5 H5 H5 6 	6r   c                     |                      | j        dz             d|                     |j        d                   dS )Nz.realro   r   rp   r   rY   s     r   	_print_rezNumPyPrinter._print_re  r   r   c                     |                      | j        dz             d|                     |j        d         t          j        z            dS )Nz.sincro   r   rp   )ri   rB   rP   rd   r   r2   rY   s     r   _print_sinczNumPyPrinter._print_sinc  sM    ..t|g/EFFFFTXT]^_T`abaeTeHfHfHfHfggr   c                 ~   d|j         v rD|                     | j         d| j                   }| d|                     |j                    dS | j                            |j        j        d           }||                     | j         d          }|d|                     |	                                          dS )Nr   r   ro   rp   .array)
rq   ri   rB   _zerosrP   known_functionsgetrJ   __name__tolistr   s      r   _print_MatrixBasezNumPyPrinter._print_MatrixBase	  s    
??&&$,'F'F'F'FGGD77T[[447777#''(?FF<&&$,'>'>'>??D44T[[]]!;!;!;!;<<r   c                     |j         }t          d |D                       rA|                     | j        dz             d|                     |j         d                   dS t          d          )Nc              3   $   K   | ]}|j         V  d S rN   )
is_Integer)r   dims     r   rR   z/NumPyPrinter._print_Identity.<locals>.<genexpr>  s$      //#s~//////r   r   ro   r   rp   zFSymbolic matrix dimensions are not yet supported for identity matrices)rq   allri   rB   rP   r   )rI   rZ   rq   s      r   _print_IdentityzNumPyPrinter._print_Identity  sz    
/////// 	p#224<&3HIIII4;;W[WabcWdKeKeKeKeff%&nooor   c                     d                     |                     | j        dz             |                     |j        d                                                             S )Nrl   z.blockr   )rA   ri   rB   rP   rd   r  rY   s     r   _print_BlockMatrixzNumPyPrinter._print_BlockMatrix  sS    t224<(3JKK!%TYq\-@-@-B-B!C!CE E 	Er   c                    |                                 dk    r>|                     | j         d          }| d|                     |d                    dS d|j        v rD|                     | j         d| j                   }| d|                     |j                   dS |                     | j         d          }| d|                     |                                           dS )Nr   r  ro   r   rp   r   )rankri   rB   rP   rq   r  r  r   s      r   _print_NDimArrayzNumPyPrinter._print_NDimArray  s    99;;!&&$,'>'>'>??D55T[[b225555
??&&$,'F'F'F'FGGD77T[[447777""dl#:#:#:;;66T[[]]336666r   addeinsum	transposeoneszerosrN   )F)=r  
__module____qualname____doc__rB   _numpy_known_functionsrE   _numpy_known_constants_kcrG   rV   r[   rf   rj   rm   ru   ry   r|   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   strr   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  _add_einsum
_transpose_onesr  r   _print_not_supported_print_lowergamma_print_uppergamma_print_fresnelc_print_fresnels__classcell__rJ   s   @r   r<   r<   %   s        
 G
 C
 C, , , , , ,Q Q Q- - -O O OB B B
' ' '
2 2 29 9 9
% % %% % %A A A( ( (( ( (' ' 'B B B' ' 'D D D
     &/ / / / /"I I IH H H@ @ @V V V V9# 9 9 9 9) ) )F F F< < <) ) )F F F< < <d d dc c c6 6 6c c ch h h= = =p p pE E E7 7 7 DGJEF#8#8!6O!6OOOOOr   r<   _print_Eiexpierferfcbesseljjvbesselyyvbesseliivbesselkkvcosm1powm1	factorialgammaloggammagammalndigammapsi	polygammaRisingFactorialpochjacobieval_jacobi
gegenbauereval_gegenbauereval_chebyteval_chebyueval_legendreeval_hermiteeval_laguerreeval_genlaguerrebetalambertw)
chebyshevt
chebyshevulegendrehermitelaguerreassoc_laguerrerM  LambertWgolden_ratio)GoldenRatior2   c                      i | ]\  }}|d |z   S )zscipy.special.r   r   s      r   r8   r8   Y  s$    ffftq!!.2fffr   c                      i | ]\  }}|d |z   S )zscipy.constants.r   r   s      r   r8   r8   Z  s$    jjjA!014jjjr   c                        e Zd Zi ej        eZi ej        eZd fd	Zd Z	e	Z
d Zd Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )SciPyPrinterNc                 Z    t                                          |           d| _        d S )Nr?   zPython with SciPy and NumPy)rF   rG   rC   rH   s     r   rG   zSciPyPrinter.__init__a  s)    (+++5r   c                 N   g g g }}}|                                                                 D ]G\  \  }}}|                    |           |                    |           |                    |           Hd                    |                     d          ||||j                  S )Nz+{name}(({data}, ({i}, {j})), shape={shape})zscipy.sparse.coo_matrix)namedatar`   r   rq   )todokitemsappendrA   ri   rq   )rI   rZ   r`   r   r_  rcr   s           r   _print_SparseRepMatrixz#SciPyPrinter._print_SparseRepMatrixe  s    Rd1++-- 	 	IFQAHHQKKKHHQKKKKKNNNN<CC$$%>??atz D 
 
 	
r   c           	         d                     |                     d          |                     |j        d                   |                     |j        d                   |                     |j        d                             S )Nz{0}({2}, {1}, {3})zscipy.special.lpmvr   r      rA   ri   rP   rd   rY   s     r   _print_assoc_legendrez"SciPyPrinter._print_assoc_legendret  sk    #** 455KK	!%%KK	!%%KK	!%%	' ' 	'r   c           	          d                     |                     d          |                     d          |                     |j        d                   |                     |j        d                             S )N{0}({2})*{1}({2}, {3})scipy.special.gammazscipy.special.gammaincr   r   rh  rY   s     r   r%  zSciPyPrinter._print_lowergamma{  sh    '.. 566 899KK	!%%KK	!%%	' ' 	'r   c           	          d                     |                     d          |                     d          |                     |j        d                   |                     |j        d                             S )Nrk  rl  zscipy.special.gammainccr   r   rh  rY   s     r   r&  zSciPyPrinter._print_uppergamma  sh    '.. 566 9::KK	!%%KK	!%%	' ' 	'r   c                 &                          d          }                      d          } f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                 :    g | ]}                     |          S r   rO   r   s     r   r   z/SciPyPrinter._print_betainc.<locals>.<listcomp>  s%    666SC  666r   ro   r   rL   r      z) - rg  z))             * rp   )ri   rd   )rI   rZ   betaincrM  rd   s   `    r   _print_betainczSciPyPrinter._print_betainc  s   %%&=>>""#7886666DI666,7 , ,T!W , ,Q , ,47 , , , ,$q' , ,UYZ[U\ , ,`def`g , ,, ,1g, ,!%a, , , 	,r   c           
      J   d                     |                     d          |                     |j        d                   |                     |j        d                   |                     |j        d                   |                     |j        d                             S )Nz'{0}({1}, {2}, {4}) - {0}({1}, {2}, {3})ro  r   r   rg  rq  rh  rY   s     r   _print_betainc_regularizedz'SciPyPrinter._print_betainc_regularized  s    8?? 788KK	!%%KK	!%%KK	!%%KK	!%%' ' 	'r   c                     d                     |                     d          |                     |j        d                             S )N	{}({})[0]scipy.special.fresnelr   rh  rY   s     r   r(  zSciPyPrinter._print_fresnels  A    !!##$;<<DIaL))+ + 	+r   c                     d                     |                     d          |                     |j        d                             S )N	{}({})[1]rx  r   rh  rY   s     r   r'  zSciPyPrinter._print_fresnelc  ry  r   c                     d                     |                     d          |                     |j        d                             S )Nrw  scipy.special.airyr   rh  rY   s     r   _print_airyaizSciPyPrinter._print_airyai  A    !!##$899DIaL))+ + 	+r   c                     d                     |                     d          |                     |j        d                             S )Nr{  r}  r   rh  rY   s     r   _print_airyaiprimezSciPyPrinter._print_airyaiprime  r  r   c                     d                     |                     d          |                     |j        d                             S )Nz	{}({})[2]r}  r   rh  rY   s     r   _print_airybizSciPyPrinter._print_airybi  r  r   c                     d                     |                     d          |                     |j        d                             S )Nz	{}({})[3]r}  r   rh  rY   s     r   _print_airybiprimezSciPyPrinter._print_airybiprime  r  r   c                 F    |                       |j        |j                   S rN   rP   _eval_rewrite_as_zetard   rY   s     r   _print_bernoullizSciPyPrinter._print_bernoulli  s!    {{545tyABBBr   c                 F    |                       |j        |j                   S rN   r  rY   s     r   _print_harmoniczSciPyPrinter._print_harmonic  s!    {{545tyABBBr   c           	          t          |          \  }}t          |          dk    rA                     d          }dt          t	           j        |d                             z  }nI                     d          }d                    d                     fd|D                                 }d	                    |d                    t	           j        |                                         |j        d                   |          S )
Nr   zscipy.integrate.quadz%s, %sr   zscipy.integrate.nquadr]   rL   c              3   b   K   | ])}d t          t          j        |                    z  V  *dS )z(%s, %s)N)tuplemaprP   )r   lrI   s     r   rR   z/SciPyPrinter._print_Integral.<locals>.<genexpr>  sU       0I 0I<=
U3t{A#6#67770I 0I 0I 0I 0I 0Ir   z{}(lambda {}: {}, {})[0])	r   r   ri   r  r  rP   rA   rS   rd   )rI   r,   integration_varslimits
module_str	limit_strs   `     r   _print_IntegralzSciPyPrinter._print_Integral  s   #:1#=#= &v;;!,,-CDDJ 5T[&))D)D#E#EEII,,-DEEJdii 0I 0I 0I 0IAG0I 0I 0I 'I 'I J JI *00		#dk+;<<==AF1I&&	  	r   c                     d                     |                     d          |                     |j        d                             S )Nrw  scipy.special.sicir   rh  rY   s     r   	_print_SizSciPyPrinter._print_Si  r  r   c                     d                     |                     d          |                     |j        d                             S )Nr{  r  r   rh  rY   s     r   	_print_CizSciPyPrinter._print_Ci  r  r   rN   )r  r  r  r<   rE   _scipy_known_functionsr  _scipy_known_constantsrG   re  _print_ImmutableSparseMatrixri  r%  r&  rs  ru  r(  r'  r~  r  r  r  r  r  r  r  r  r)  r*  s   @r   r[  r[  \  sp       
8\
8!7
8C
8\
8!7
8C6 6 6 6 6 6

 

 

 $: ' ' '' ' '' ' ', , ,' ' '+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
C C CC C C  $+ + +
+ + + + + + +r   r[  c                      i | ]\  }}|d |z   S zcupy.r   r   s      r   r8   r8     "    TTTTQWq[TTTr   c                      i | ]\  }}|d |z   S r  r   r   s      r   r8   r8     r  r   c                   0     e Zd ZdZdZeZeZd fd	Z	 xZ
S )CuPyPrinterz`
    CuPy printer which handles vectorized piecewise functions,
    logical operators, etc.
    cupyNc                 L    t                                          |           d S )Nr?   )rF   rG   rH   s     r   rG   zCuPyPrinter.__init__  s$    (+++++r   rN   )r  r  r  r  rB   _cupy_known_functionsrE   _cupy_known_constantsr  rG   r)  r*  s   @r   r  r    sX         
 G
C
C, , , , , , , , , ,r   r  c                      i | ]\  }}|d |z   S z
jax.numpy.r   r   s      r   r8   r8     #    WWW1<!+WWWr   c                      i | ]\  }}|d |z   S r  r   r   s      r   r8   r8     r  r   c                   <     e Zd ZdZdZeZeZd fd	Z	d Z
d Z xZS )
JaxPrinterz_
    JAX printer which handles vectorized piecewise functions,
    logical operators, etc.
    z	jax.numpyNc                 Z    t                                          |           d| _        d S )Nr?   _jaxcode)rF   rG   rD   rH   s     r   rG   zJaxPrinter.__init__  s,    (+++%r   c                      d                                           j        dz                                   j                  d                     fd|j        D                                 S )r   {}({}.asarray([{}]), axis=0)z.allr   c              3   B   K   | ]}                     |          V  d S rN   rO   r_   s     r   rR   z(JaxPrinter._print_And.<locals>.<genexpr>  -      77T[[^^777777r   r   rY   s   ` r   r   zJaxPrinter._print_And	  l    -44v 566--HH7777TY77777
 
 	
r   c                      d                                           j        dz                                   j                  d                     fd|j        D                                 S )r   r  z.anyr   c              3   B   K   | ]}                     |          V  d S rN   rO   r_   s     r   rR   z'JaxPrinter._print_Or.<locals>.<genexpr>  r  r   r   rY   s   ` r   r   zJaxPrinter._print_Or  r  r   rN   )r  r  r  r  rB   _jax_known_functionsrE   _jax_known_constantsr  rG   r   r   r)  r*  s   @r   r  r    sv          G
C
C& & & & & &

 
 

 
 
 
 
 
 
r   r  N)'
sympy.corer   sympy.core.functionr   sympy.core.powerr   pycoder   r   r	   r
   r   r   codeprinterr   splitr   ra  	_in_numpydict_known_functions_numpy_known_constants_numpyr  r  r<   r   setattrconst_known_functions_scipy_special _known_constants_scipy_constantsr  r  r[  r  r  r  r  r  r  r   r   r   <module>r     s         & & & & & &             K  K  K  K  K  K  K  K  K  K  K  K  K  K  K  K $ $ $ $ $ $ 499;;XX ; 5 ; = =XXX	i  , ,   " 
   VU6L6R6R6T6TUUU UU6L6R6R6T6TUUU K7 K7 K7 K7 K7<!2 K7 K7 K7Z # ? ?DGL*D**,=>>>># A AEGL+E++-?@@@@"&"	5" F" t	"
 t" t" t" W" W" " W" 	" u" " v"  m!"" ##"$  (3" " " : "
$ $   gf?]?c?c?e?efff jjAaAgAgAiAijjj {+ {+ {+ {+ {+< {+ {+ {+z # ? ?DGL*D**,=>>>># A AEGL+E++-?@@@@ UT5K5Q5Q5S5STTT TT5K5Q5Q5S5STTT , , , , ,, , , , " > >DGK)4))+<====" @ @EGK*5**,>???? XW8N8T8T8V8VWWW WW8N8T8T8V8VWWW 
 
 
 
 
 
 
 
> ! = =DGJ($((*;<<<<! ? ?EGJ)%))+=>>>>? ?r   