+
    åûjÀ  ã                   óp   € ^RI Ht ^ RIHtHt ^ RIHt ^ RIHtH	t	 ^ RI
Ht ^ RIHtHt  ! R R]4      tR	# )
é   )Ú
MatrixExpr)ÚFunctionClassÚLambda)ÚDummy)Ú_sympifyÚsympify)ÚMatrix)ÚreÚimc                   óh   a a€ ] tR t^	t oRtV 3R lt]R 4       t]R 4       tR t	R t
R tRtVtV ;t# )	ÚFunctionMatrixa*  Represents a matrix using a function (``Lambda``) which gives
outputs according to the coordinates of each matrix entries.

Parameters
==========

rows : nonnegative integer. Can be symbolic.

cols : nonnegative integer. Can be symbolic.

lamda : Function, Lambda or str
    If it is a SymPy ``Function`` or ``Lambda`` instance,
    it should be able to accept two arguments which represents the
    matrix coordinates.

    If it is a pure string containing Python ``lambda`` semantics,
    it is interpreted by the SymPy parser and casted into a SymPy
    ``Lambda`` instance.

Examples
========

Creating a ``FunctionMatrix`` from ``Lambda``:

>>> from sympy import FunctionMatrix, symbols, Lambda, MatPow
>>> i, j, n, m = symbols('i,j,n,m')
>>> FunctionMatrix(n, m, Lambda((i, j), i + j))
FunctionMatrix(n, m, Lambda((i, j), i + j))

Creating a ``FunctionMatrix`` from a SymPy function:

>>> from sympy import KroneckerDelta
>>> X = FunctionMatrix(3, 3, KroneckerDelta)
>>> X.as_explicit()
Matrix([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])

Creating a ``FunctionMatrix`` from a SymPy undefined function:

>>> from sympy import Function
>>> f = Function('f')
>>> X = FunctionMatrix(3, 3, f)
>>> X.as_explicit()
Matrix([
[f(0, 0), f(0, 1), f(0, 2)],
[f(1, 0), f(1, 1), f(1, 2)],
[f(2, 0), f(2, 1), f(2, 2)]])

Creating a ``FunctionMatrix`` from Python ``lambda``:

>>> FunctionMatrix(n, m, 'lambda i, j: i + j')
FunctionMatrix(n, m, Lambda((i, j), i + j))

Example of lazy evaluation of matrix product:

>>> Y = FunctionMatrix(1000, 1000, Lambda((i, j), i + j))
>>> isinstance(Y*Y, MatPow) # this is an expression object
True
>>> (Y**2)[10,10] # So this is evaluated lazily
342923500

Notes
=====

This class provides an alternative way to represent an extremely
dense matrix with entries in some form of a sequence, in a most
sparse way.
c                óæ  <€ \        V4      \        V4      r!V P                  V4       V P                  V4       \        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      \        R4      rT\        WE3V! WE4      4      p\        SV `-  WW#4      # )z4{} should be compatible with SymPy function classes.z({} should be able to accept 2 arguments.ÚiÚj)r   Ú
_check_dimr   Ú
isinstancer   r   Ú
ValueErrorÚformatÚnargsr   ÚsuperÚ__new__)ÚclsÚrowsÚcolsÚlamdar   r   Ú	__class__s   &&&&  €ÚaC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\sympy\matrices\expressions\funcmatrix.pyr   ÚFunctionMatrix.__new__P   sÊ   ø€ Ü˜d“^¤X¨d£^ˆdØ�‰�tÔØ�‰�tÔä˜“ˆÜ˜%¤-´Ð!8×9Ò9ÜØFß‘˜“ó ð  ð �E—K‘KÔÜØ:×AÑAÀ%ÓHóJð Jô ˜%¤×(Ò(Ü˜“:œu S›zˆqÜ˜A˜6¡5¨£;Ó/ˆEä‰w‰˜s¨$Ó6Ð6ó    c                ó(   € V P                   R ,          # ):é    é   N©Úargs©Úselfs   &r   ÚshapeÚFunctionMatrix.shapee   s   € à�y‰y˜�~Ðr   c                ó(   € V P                   ^,          # )r"   r#   r%   s   &r   r   ÚFunctionMatrix.lamdai   s   € à�y‰y˜�|Ðr   c                ó$   € V P                  W4      # ©N)r   )r&   r   r   Úkwargss   &&&,r   Ú_entryÚFunctionMatrix._entrym   s   € Ø�z‰z˜!ÓÐr   c                ód   € ^ RI Hp ^ RIHp V! V 4      P	                  V4      P                  4       # )r!   )ÚTrace)ÚSum)Ú sympy.matrices.expressions.tracer1   Úsympy.concrete.summationsr2   ÚrewriteÚdoit)r&   r1   r2   s   &  r   Ú_eval_traceÚFunctionMatrix._eval_tracep   s&   € Ý:Ý1Ù�T‹{×"Ñ" 3Ó'×,Ñ,Ó.Ð.r   c                óR   € \        \        V 4      4      \        \        V 4      4      3# r,   )r
   r	   r   r%   s   &r   Ú_eval_as_real_imagÚ!FunctionMatrix._eval_as_real_imagu   s   € Ü”6˜$“<Ó ¤"¤V¨D£\Ó"2Ð3Ð3r   © )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úpropertyr'   r   r.   r7   r:   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r   Ú__classdict__s   @@r   r   r   	   sM   ù‡ € ñEõL7ð* ñó ðð ñó ðò ò/÷
4ò 4r   r   N)Úmatexprr   Úsympy.core.functionr   r   Úsympy.core.symbolr   Úsympy.core.sympifyr   r   Úsympy.matricesr	   Ú$sympy.functions.elementary.complexesr
   r   r   r<   r   r   Ú<module>rM      s%   ðÝ ß 5Ý #ß 0Ý !ß 7ôm4�Zö m4r   