Ë
    7^(hH  ã                   ó”   — d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ  G d„ d	e«      Zed
„ «       Z G d„ de«      Zy)é    )ÚIterable)Úsingledispatch)ÚExpr)ÚMul)ÚS)Úsympify)Úglobal_parametersc                   ó<   — e Zd ZdZdZd„ Zd„ Zd„ Zed„ «       Z	d„ Z
y)	ÚTensorProductz,
    Generic class for tensor products.
    Fc                 óJ  — ddl m}m}m} ddlm} ddlm} ddlm	} |D �	cg c]  }	t        |	«      ‘Œ }}	|j                  dt        j                  «      }
|
st        j                  | g|¢­Ž }|S g }g }t         j"                  }|D ]Q  }	t%        |	t&        ||f«      r|j)                   ||	«      «       Œ.t%        |	|f«      r|j)                  |	«       ŒM||	z  }ŒS | ||Ž z  }t+        |«      dk(  r|S |dk7  r|g|z   }n|}t        j                  | g|¢­i |¤Ž} ||«      S c c}	w )Nr   )Ú	NDimArrayÚtensorproductÚArray)Ú
MatrixExpr)Ú
MatrixBase)ÚflattenÚevaluateé   )Úsympy.tensor.arrayr   r   r   Ú"sympy.matrices.expressions.matexprr   Úsympy.matrices.matrixbaser   Úsympy.strategiesr   r   Úgetr	   r   r   Ú__new__r   ÚOneÚ
isinstancer   ÚappendÚlen)ÚclsÚargsÚkwargsr   r   r   r   r   r   Úargr   ÚobjÚarraysÚotherÚscalarÚcoeffÚnewargss                    úT/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/tensor/functions.pyr   zTensorProduct.__new__   s  € ßFÑFÝAÝ8Ý,à(,Ö- ”˜•Ð-ˆÐ-Ø—:‘:˜jÔ*;×*DÑ*DÓEˆáÜ—,‘,˜sÐ* TÒ*ˆCØˆJàˆØˆÜ—‘ˆØò 	ˆCÜ˜#¤¨*°iÐ@ÔAØ—‘™e C›jÕ)Ü˜C * Ô/Ø—‘˜SÕ!à˜#‘‘ð	ð ‘} fÐ-Ñ-ˆÜˆu‹:˜Š?ØˆLØ�AŠ:Ø�g ‘o‰GàˆGÜ�l‰l˜3Ð3 Ò3¨FÑ3ˆÙ�s‹|Ðùò5 .s   ¡D c                 ó,   — t        | j                  «      S ©N)r   Úshape)Úselfs    r)   ÚrankzTensorProduct.rank3   s   € Ü�4—:‘:‹Ðó    c                 óœ   — ddl m} | j                  D �cg c],  }t        |d«      r|j                  n ||«      j                  ‘Œ. c}S c c}w )Nr   )r   r,   )r   r   r    Úhasattrr,   )r-   r   Úis      r)   Ú_get_args_shapeszTensorProduct._get_args_shapes6   s7   € Ý,ØLPÏIÉIÖVÀqœ7 1 gÔ.�—’±E¸!³H·N±NÑBÒVÐVùÒVs   •1A	c                 ó:   — | j                  «       }t        |d«      S )N© )r3   Úsum)r-   Ú
shape_lists     r)   r,   zTensorProduct.shape:   s   € à×*Ñ*Ó,ˆ
Ü�:˜rÓ"Ð"r/   c                 óš   ‡— t        ‰«      Št        j                  ˆfd„t        | j                  | j                  «       «      D «       «      S )Nc              3   ój   •K  — | ]*  \  }}|j                  t        ˆfd „|D «       «      «      –— Œ, y­w)c              3   ó4   •K  — | ]  }t        ‰«      –— Œ y ­wr+   )Únext)Ú.0r2   Úindexs     €r)   ú	<genexpr>z6TensorProduct.__getitem__.<locals>.<genexpr>.<genexpr>B   s   øè ø€ Ò!;°!¤$ u§+Ñ!;ùs   ƒN)Ú__getitem__Útuple)r<   r"   Úshpr=   s      €r)   r>   z,TensorProduct.__getitem__.<locals>.<genexpr>A   s1   øè ø€ ò 
á��Sð �O‰OœEÓ!;°sÔ!;Ó;×<ñ
ùs   ƒ03)Úiterr   ÚfromiterÚzipr    r3   )r-   r=   s    `r)   r?   zTensorProduct.__getitem__?   s>   ø€ Ü�U“ˆÜ�|‰|ó 
ä §	¡	¨4×+@Ñ+@Ó+BÓCô
ó 
ð 	
r/   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	is_numberr   r.   r3   Úpropertyr,   r?   r5   r/   r)   r   r      s8   „ ñð €Iò òDòWð ñ#ó ð#ó
r/   r   c                 óN   — t        | d«      r| j                  S t        d| z  «      ‚)aà  
    Return the shape of the *expr* as a tuple. *expr* should represent
    suitable object such as matrix or array.

    Parameters
    ==========

    expr : SymPy object having ``MatrixKind`` or ``ArrayKind``.

    Raises
    ======

    NoShapeError : Raised when object with wrong kind is passed.

    Examples
    ========

    This function returns the shape of any object representing matrix or array.

    >>> from sympy import shape, Array, ImmutableDenseMatrix, Integral
    >>> from sympy.abc import x
    >>> A = Array([1, 2])
    >>> shape(A)
    (2,)
    >>> shape(Integral(A, x))
    (2,)
    >>> M = ImmutableDenseMatrix([1, 2])
    >>> shape(M)
    (2, 1)
    >>> shape(Integral(M, x))
    (2, 1)

    You can support new type by dispatching.

    >>> from sympy import Expr
    >>> class NewExpr(Expr):
    ...     pass
    >>> @shape.register(NewExpr)
    ... def _(expr):
    ...     return shape(expr.args[0])
    >>> shape(NewExpr(M))
    (2, 1)

    If unsuitable expression is passed, ``NoShapeError()`` will be raised.

    >>> shape(Integral(x, x))
    Traceback (most recent call last):
      ...
    sympy.tensor.functions.NoShapeError: shape() called on non-array object: Integral(x, x)

    Notes
    =====

    Array-like classes (such as ``Matrix`` or ``NDimArray``) has ``shape``
    property which returns its shape, but it cannot be used for non-array
    classes containing array. This function returns the shape of any
    registered object representing array.

    r,   zA%s does not have shape, or its type is not registered to shape().)r1   r,   ÚNoShapeError)Úexprs    r)   r,   r,   G   s0   € ôz ˆt�WÔØ�z‰zÐÜ
ØKÈdÑRóTð Tr/   c                   ó   — e Zd ZdZy)rL   an  
    Raised when ``shape()`` is called on non-array object.

    This error can be imported from ``sympy.tensor.functions``.

    Examples
    ========

    >>> from sympy import shape
    >>> from sympy.abc import x
    >>> shape(x)
    Traceback (most recent call last):
      ...
    sympy.tensor.functions.NoShapeError: shape() called on non-array object: x
    N)rE   rF   rG   rH   r5   r/   r)   rL   rL   Š   s   „ ñð 	r/   rL   N)Úcollections.abcr   Ú	functoolsr   Úsympy.core.exprr   Úsympy.core.mulr   Úsympy.core.singletonr   Úsympy.core.sympifyr   Úsympy.core.parametersr	   r   r,   Ú	ExceptionrL   r5   r/   r)   ú<module>rW      sJ   ðÝ $Ý $å  Ý Ý "Ý &Ý 3ô9
�Dô 9
ðx ñ?Tó ð?TôD	�9õ 	r/   