U
    Ç-ew  ã                   @   s<   d dl mZmZ d dlmZ d dlmZ G dd„ deƒZdS )é    )ÚBasicÚExpr)Ú_sympify)Ú	transposec                   @   s"   e Zd ZdZdd„ Zd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                 C   sz   t ||fƒ\}}|jstdƒ‚|js,tdƒ‚d|jkr>tdƒ‚d|jkrPtdƒ‚t|jƒt|jƒkrltdƒ‚t | ||¡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   Z	is_MatrixÚ	TypeErrorÚshapeÚsetr   Ú__new__)ÚclsZarg1Zarg2© r   úf/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/sympy/matrices/expressions/dotproduct.pyr      s    

zDotProduct.__new__Fc                 K   s®   | j d j| j d jkr`| j d jd dkrF| j d t| j d ƒ }q¦t| j d ƒ| j d  }nF| j d jd dkrŠ| j d | j d  }nt| j d ƒt| j d ƒ }|d S )Nr   r   )Úargsr	   r   )ÚselfÚexpandÚhintsÚmulr   r   r   Údoit+   s    zDotProduct.doitN)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s   r   N)Z
sympy.corer   r   Zsympy.core.sympifyr   Z$sympy.matrices.expressions.transposer   r   r   r   r   r   Ú<module>   s   