+
    
þÎj_  ã                   óp   € ^ RI Ht ^ RIHtHtHt ^ RIHt ^ RIH	t	H
t
 ^ RIHt ^ RIHt  ! R R]4      tR	# )
é    )ÚExprBuilder)ÚFunctionÚFunctionClassÚLambda)ÚDummy)ÚsympifyÚ_sympify)Ú
MatrixExpr)Ú
MatrixBasec                   ó~   a € ] tR t^	t o RtR t]R 4       t]R 4       t]R 4       t	R t
R tR tR	 tR
 tR tRtV tR# )ÚElementwiseApplyFunctionaë  
Apply function to a matrix elementwise without evaluating.

Examples
========

It can be created by calling ``.applyfunc(<function>)`` on a matrix
expression:

>>> from sympy import MatrixSymbol
>>> from sympy.matrices.expressions.applyfunc import ElementwiseApplyFunction
>>> from sympy import exp
>>> X = MatrixSymbol("X", 3, 3)
>>> X.applyfunc(exp)
Lambda(_d, exp(_d)).(X)

Otherwise using the class constructor:

>>> from sympy import eye
>>> expr = ElementwiseApplyFunction(exp, eye(3))
>>> expr
Lambda(_d, exp(_d)).(Matrix([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]]))
>>> expr.doit()
Matrix([
[E, 1, 1],
[1, E, 1],
[1, 1, E]])

Notice the difference with the real mathematical functions:

>>> exp(eye(3))
Matrix([
[E, 0, 0],
[0, E, 0],
[0, 0, E]])
c                ó°  € \        V4      pVP                  '       g   \        R P                  V4      4      hVP                  R8X  d!   V! V4      p\        V\        4      '       d   V# \        V\        \        34      '       g   \        R4      p\        WA! V4      4      p\        V4      p\        V\        \        34      '       g   \        RP                  V4      4      h^VP                  9  d   \        RP                  V4      4      h\        V\        4      '       g   \        R4      p\        WA! V4      4      p\        P                  ! WV4      pV# )z{} must be a matrix instance.Údz4{} should be compatible with SymPy function classes.z({} should be able to accept 1 arguments.)é   r   )r	   Ú	is_MatrixÚ
ValueErrorÚformatÚshapeÚ
isinstancer
   r   r   r   r   ÚnargsÚ__new__)ÚclsÚfunctionÚexprÚretr   Úobjs   &&&   ÚZ/opt/data/home/.local/lib/python3.14/site-packages/sympy/matrices/expressions/applyfunc.pyr   Ú ElementwiseApplyFunction.__new__2   s  € Ü˜‹~ˆØ�~�~ˆ~ÜÐ<×CÑCÀDÓIÓJÐJà�:‰:˜Ôñ ˜4“.ˆCÜ˜#œz×*Ò*Ø�
ä˜(¤]´FÐ$;×<Ò<Ü�c“
ˆAÜ˜a ¨!£Ó-ˆHä˜8Ó$ˆÜ˜(¤]´FÐ$;×<Ò<ÜØFß‘˜Ó!ó#ð #ð �H—N‘NÔ"ÜØ:×AÑAÀ(ÓKóMð Mô ˜(¤F×+Ò+Ü�c“
ˆAÜ˜a ¨!£Ó-ˆHä× Ò  °Ó5ˆØˆ
ó    c                ó(   € V P                   ^ ,          # )r   ©Úargs©Úselfs   &r   r   Ú!ElementwiseApplyFunction.functionS   ó   € à�y‰y˜�|Ðr   c                ó(   € V P                   ^,          # )r   r!   r#   s   &r   r   ÚElementwiseApplyFunction.exprW   r&   r   c                ó.   € V P                   P                  # ©N)r   r   r#   s   &r   r   ÚElementwiseApplyFunction.shape[   s   € à�y‰y�‰Ðr   c                óÊ  a a€ VP                  R R4      pS P                  oV'       d   SP                  ! R/ VB oS P                  p\	        V\
        4      '       d   VP                  '       d   S# \	        S\        4      '       d   SP                  S P                  4      # \	        S\        4      '       d,   \        VV 3R lSP                  4      P                  ! R/ VB # S # )ÚdeepTc                 óD   <€ SP                  SP                  V 4      4      # r*   )r   )Úxr   r$   s   &€€r   Ú<lambda>Ú/ElementwiseApplyFunction.doit.<locals>.<lambda>l   s   ø€ ˜$Ÿ-™-¨¯©°aÓ(8Ô9r   © )
Úgetr   Údoitr   r   r   Úis_identityr   Ú	applyfuncr   )r$   Úhintsr-   r   r   s   f,  @r   r4   ÚElementwiseApplyFunction.doit_   s½   ù€ Ø�y‰y˜ Ó&ˆØ�y‰yˆßØ—9’9Ñ%˜uÑ%ˆDØ—=‘=ˆÜ�h¤×'Ò'¨H×,@×,@Ð,@àˆKÜ�dœJ×'Ò'Ø—>‘> $§-¡-Ó0Ð0Ü˜Ô6×7Ò7Ü+Ý9Ø—	‘	ó÷ ‰dðñ ð ñð ð
 ˆKr   c                óZ   € V P                  V P                  P                  ! W3/ VB 4      # r*   )r   r   Ú_entry)r$   ÚiÚjÚkwargss   &&&,r   r:   ÚElementwiseApplyFunction._entryr   s%   € Ø�}‰}˜TŸY™Y×-Ò-¨aÑ=°fÑ=Ó>Ð>r   c                ó¼   € \        R 4      pV P                  V4      pVP                  V4      p\        V\        4      '       d   \        V4      pV# \        W4      pV# )r   )r   r   Údiffr   r   Útyper   )r$   r   r   Úfdiffs   &   r   Ú_get_function_fdiffÚ,ElementwiseApplyFunction._get_function_fdiffu   sU   € Ü�#‹JˆØ—=‘= Ó#ˆØ—‘˜aÓ ˆÜ�eœX×&Ò&Ü˜“KˆEð ˆô ˜1Ó$ˆEØˆr   c                óœ   € ^ RI Hp V P                  P                  V4      pV P	                  4       pV! V\        W@P                  4      4      # )r   )Úhadamard_product)Ú#sympy.matrices.expressions.hadamardrF   r   r@   rC   r   )r$   r/   rF   ÚdexprrB   s   &&   r   Ú_eval_derivativeÚ)ElementwiseApplyFunction._eval_derivative   sA   € ÝHØ—	‘	—‘˜qÓ!ˆØ×(Ñ(Ó*ˆÙØÜ$ U¯I©IÓ6ó
ð 	
r   c                ó‚  € ^ RI Hp ^ RIHp ^ RIHp ^ RIHp V P                  4       pV P                  P                  V4      p\        W`P                  4      p^VP                  9   Ed    V P                  ^,          ^8H  p	V Fá  p
V	'       d'   V
P                  pV! V P                  ^,          4      pM%V! V P                  ^ ,          4      pV
P                  p\        T\        VVVV.4      V	'       d   RMR.VP                  R7      pV.V
n        VP                   ^ ,          P                   V
n        ^V
n        VP                   ^ ,          P                   V
n        ^V
n        Kã  	  V# V FÏ  p
V
P                  pV
P                  pV! VP                  ^,          4      pV! VP                  ^,          4      p\        V\        VW¾WŒV.4      RR	.VP                  R7      pVP                   ^ ,          P                   V
n        ^V
n        VP                   ^ ,          P                   V
n        ^V
n        V.V
n        KÑ  	  V# )
r   )ÚIdentity)ÚArrayContraction)ÚArrayDiagonal)ÚArrayTensorProduct)Ú	validator)r   é   )r   é   )r   rQ   rR   )é   é   é   )Ú"sympy.matrices.expressions.specialrL   Ú0sympy.tensor.array.expressions.array_expressionsrM   rN   rO   rC   r   Ú_eval_derivative_matrix_linesr   r   Úfirst_pointerÚsecond_pointerr   Ú	_validateÚ_linesr"   Ú_first_pointer_parentÚ_first_pointer_indexÚ_second_pointer_parentÚ_second_pointer_index)r$   r/   rL   rM   rN   rO   rB   ÚlrÚewdiffÚiscolumnr;   Úptr1Úptr2ÚsubexprÚnewptr1Únewptr2s   &&              r   rX   Ú6ElementwiseApplyFunction._eval_derivative_matrix_linesˆ   sú  € Ý?ÝUÝRÝWà×(Ñ(Ó*ˆØ�Y‰Y×4Ñ4°QÓ7ˆÜ)¨%·±Ó;ˆØ�—‘�<à—z‘z !•}¨Ñ)ˆHÛ�ßØŸ?™?�DÙ# D§J¡J¨q¥MÓ2‘Dá# D§J¡J¨q¥MÓ2�DØ×+Ñ+�Dä%Ø!ä#Ø.à &Ø $Ø $ðó÷ #+™°ð
ð ,×5Ñ5ô�ð $˜9�”Ø*1¯,©,°q­/×*>Ñ*>�Ô'Ø)*�Ô&Ø+2¯<©<¸­?×+?Ñ+?�Ô(Ø*+�Ö'ñ7 ðh ˆ	ó- �Ø—‘�Ø×'Ñ'�Ù" 4§:¡:¨a¥=Ó1�Ù" 4§:¡:¨a¥=Ó1�Ü%Ø$ä#Ø.Ø!¨F¸'ÐBóð "Ø!ðð /×8Ñ8ô�ð +2¯,©,°q­/×*>Ñ*>�Ô'Ø)*�Ô&Ø+2¯<©<¸­?×+?Ñ+?�Ô(Ø*+�Ô'Ø#˜9�–ñ+ ð, ˆ	r   c                ó‚   € ^ RI Hp V P                  V P                  V! V P                  4      P                  4       4      # )r   )Ú	Transpose)Ú$sympy.matrices.expressions.transposerk   Úfuncr   r   r4   )r$   rk   s   & r   Ú_eval_transposeÚ(ElementwiseApplyFunction._eval_transposeÊ   s,   € ÝBØ�y‰y˜Ÿ™©	°$·)±)Ó(<×(AÑ(AÓ(CÓDÐDr   r2   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úpropertyr   r   r   r4   r:   rC   rI   rX   rn   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r   	   st   ø‡ € ñ&òPðB ñó ðð ñó ðð ñó ðòò&?òò
ò@÷DEð Er   r   N)Úsympy.core.exprr   Úsympy.core.functionr   r   r   Úsympy.core.symbolr   Úsympy.core.sympifyr   r	   Úsympy.matrices.expressionsr
   Úsympy.matrices.matrixbaser   r   r2   r   r   Ú<module>r      s*   ðÝ 'ß AÑ AÝ #ß 0Ý 1Ý 0ôCE˜zö CEr   