+
    iH                         ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt  ! R R	]4      t]R
 4       t ! R R]4      tR# )    )Iterable)singledispatch)Expr)Mul)S)sympify)global_parametersc                   P   a  ] tR t^t o RtRtR tR tR t]	R 4       t
R tRtV tR	# )
TensorProductz$
Generic class for tensor products.
Fc                   ^ RI HpHpHp ^ RIHp ^ RIHp ^ RIH	p V U	u. uF  p	\        V	4      NK  	  pp	VP                  R\        P                  4      p
V
'       g   \        P                  ! V .VO5!  pV# . p. p\         P"                  pV Fa  p	\%        V	\&        Ws34      '       d   VP)                  V! V	4      4       K4  \%        W34      '       d   VP)                  V	4       KY  W,          pKc  	  W! V!  ,          p\+        V4      ^ 8X  d   V# V^8w  d   V.V,           pMTp\        P                  ! V .VO5/ VB pV! V4      # u up	i )r   )	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   &*,              v/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/tensor/functions.pyr   TensorProduct.__new__   s   FFA8,(,--::j*;*D*DE,,s*T*CJC#*@AAeCj)C//S!  }f--u:?LA:goGGll333F3s|5 .s   Ec                ,    \        V P                  4      # N)r   shape)selfs   &r(   rankTensorProduct.rank3   s    4::    c                    ^ RI Hp V P                   Uu. uF3  p\        VR4      '       d   VP                  MV! V4      P                  NK5  	  up# u upi )r   )r   r,   )r   r   r   hasattrr,   )r-   r   is   &  r(   _get_args_shapesTensorProduct._get_args_shapes6   s>    ,LPIIVIq71g..E!HNNBIVVVs   9Ac                :    V P                  4       p\        VR4      # )N )r4   sum)r-   
shape_lists   & r(   r,   TensorProduct.shape:   s    **,
:r""r0   c                   a \        S4      o\        P                  ! V3R  l\        V P                  V P                  4       4       4       4      # )c              3      <"   T FH  w  rTP                  \        ;QJ d    . V3R  lV 4       F  NK  	  5M! V3R  lV 4       4      4      x  KJ  	  R# 5i)c              3   :   <"   T F  p\        S4      x  K  	  R # 5ir+   )next).0r3   indexs   & r(   	<genexpr>6TensorProduct.__getitem__.<locals>.<genexpr>.<genexpr>B   s     !;s!$u++ss   N)__getitem__tuple)r?   r!   shpr@   s   &  r(   rA   ,TensorProduct.__getitem__.<locals>.<genexpr>A   s?      
C OOEE!;s!;EE!;s!;;<<Cs   AA)iterr   fromiterzipr   r4   )r-   r@   s   &fr(   rC   TensorProduct.__getitem__?   s>    U|| 
		4+@+@+BC
 
 	
r0   r7   N)__name__
__module____qualname____firstlineno____doc__	is_numberr   r.   r4   propertyr,   rC   __static_attributes____classdictcell__)__classdict__s   @r(   r   r      s@      I DW # #
 
r0   r   c                b    \        V R4      '       d   V P                  # \        RV ,          4      h)a0  
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().)r2   r,   NoShapeError)exprs   &r(   r,   r,   G   s3    z tWzz
KdRT Tr0   c                       ] tR t^tRtRtR# )rV   aB  
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
r7   N)rK   rL   rM   rN   rO   rR   r7   r0   r(   rV   rV      s     	r0   rV   N)collections.abcr   	functoolsr   sympy.core.exprr   sympy.core.mulr   sympy.core.singletonr   sympy.core.sympifyr   sympy.core.parametersr	   r   r,   	ExceptionrV   r7   r0   r(   <module>ra      sJ    $ $    " & 39
D 9
x ?T ?TD	9 	r0   