ó
¡¼™\c           @  sp   d  d l  m Z m Z d  d l m Z d  d l m Z d  d l m Z d  d l	 m
 Z
 d e
 f d „  ƒ  YZ d S(	   iÿÿÿÿ(   t   print_functiont   division(   t   Basic(   t   _sympify(   t	   transpose(   t
   MatrixExprt
   DotProductc           B  s#   e  Z d  Z d „  Z e d „ Z RS(   sC  
    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  sÄ   t  | | f ƒ \ } } | j s0 t d ƒ ‚ n  | j sH t d ƒ ‚ n  d | j k rf t d ƒ ‚ n  d | j k r„ t d ƒ ‚ n  t | j ƒ t | j ƒ k r± t d ƒ ‚ n  t j |  | | ƒ S(   Ns(   Argument 1 of DotProduct is not a matrixs(   Argument 2 of DotProduct is not a matrixi   s(   Argument 1 of DotProduct is not a vectors(   Argument 2 of DotProduct is not a vectors,   DotProduct arguments are not the same length(   R   t	   is_Matrixt	   TypeErrort   shapet   setR   t   __new__(   t   clst   arg1t   arg2(    (    sD   lib/python2.7/site-packages/sympy/matrices/expressions/dotproduct.pyR      s    		c         C  sÝ   |  j  d j |  j  d j k r| |  j  d j d d k r[ |  j  d t |  j  d ƒ } qÕ t |  j  d ƒ |  j  d } nY |  j  d j d d k r± |  j  d |  j  d } n$ t |  j  d ƒ t |  j  d ƒ } | d S(   Ni    i   (   t   argsR	   R   (   t   selft   expandt   mul(    (    sD   lib/python2.7/site-packages/sympy/matrices/expressions/dotproduct.pyt   doit.   s     !!$(   t   __name__t
   __module__t   __doc__R   t   FalseR   (    (    (    sD   lib/python2.7/site-packages/sympy/matrices/expressions/dotproduct.pyR   	   s   	N(   t
   __future__R    R   t
   sympy.coreR   t   sympy.core.sympifyR   t$   sympy.matrices.expressions.transposeR   t"   sympy.matrices.expressions.matexprR   R   (    (    (    sD   lib/python2.7/site-packages/sympy/matrices/expressions/dotproduct.pyt   <module>   s
   