
    gw                     J    d dl mZmZ d dlmZ d dlmZ  G d de          ZdS )    )BasicExpr)_sympify)	transposec                        e Zd ZdZd ZddZdS )
DotProductaC  
    Dot product of vector matrices

    The input should be two 1 x n or n x 1 matrices. The output represents the
    scalar dotproduct.

    This is similar to using MatrixElement and MatMul, except DotProduct does
    not require that one vector to be a row vector and the other vector to be
    a column vector.

    >>> from sympy import MatrixSymbol, DotProduct
    >>> A = MatrixSymbol('A', 1, 3)
    >>> B = MatrixSymbol('B', 1, 3)
    >>> DotProduct(A, B)
    DotProduct(A, B)
    >>> DotProduct(A, B).doit()
    A[0, 0]*B[0, 0] + A[0, 1]*B[0, 1] + A[0, 2]*B[0, 2]
    c                    t          ||f          \  }}|j        st          d          |j        st          d          d|j        vrt          d          d|j        vrt          d          t	          |j                  t	          |j                  k    rt          d          t          j        | ||          S )Nz(Argument 1 of DotProduct is not a matrixz(Argument 2 of DotProduct is not a matrix   z(Argument 1 of DotProduct is not a vectorz(Argument 2 of DotProduct is not a vectorz,DotProduct arguments are not the same length)r   	is_Matrix	TypeErrorshapesetr   __new__)clsarg1arg2s      a/var/www/html/ai-engine/env/lib/python3.11/site-packages/sympy/matrices/expressions/dotproduct.pyr   zDotProduct.__new__   s    tTl++
d~ 	HFGGG~ 	HFGGGTZFGGGTZFGGGtz??c$*oo--JKKK}S$---    Fc                    | j         d         j        | j         d         j        k    rn| j         d         j        d         dk    r)| j         d         t          | j         d                   z  }nt          | j         d                   | j         d         z  }nm| j         d         j        d         dk    r| j         d         | j         d         z  }n5t          | j         d                   t          | j         d                   z  }|d         S )Nr   r
   )argsr   r   )selfexpandhintsmuls       r   doitzDotProduct.doit+   s    9Q<1!333y|!!$))il9TYq\#:#::	!--dil:y|!!$))il49Q</	!--i	!.E.EE1vr   N)F)__name__
__module____qualname____doc__r   r    r   r   r   r      sA         &. . ."     r   r   N)
sympy.corer   r   sympy.core.sympifyr   $sympy.matrices.expressions.transposer   r   r    r   r   <module>r$      su    " " " " " " " " ' ' ' ' ' ' : : : : : :1 1 1 1 1 1 1 1 1 1r   