(self, b)
Return the dot product of Matrix self and b relaxing the condition
        of compatible dimensions: if either the number of rows or columns are
        the same as the length of b then the dot product is returned. If self
        is a row or column vector, a scalar is returned. Otherwise, a list
        of results is returned (and in that case the number of columns in self
        must match the length of b).

        Examples
        ========

        >>> from sympy import Matrix
        >>> M = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
        >>> v = [1, 1, 1]
        >>> M.row(0).dot(v)
        6
        >>> M.col(0).dot(v)
        12
        >>> M.dot(v)
        [6, 15, 24]

        See Also
        ========

        cross
        multiply
        multiply_elementwise
Return the dot product of Matrix self and b relaxing the condition
        of compatible dimensions: if either the number of rows or columns are
        the same as the length of b then the dot product is returned. If self
        is a row or column vector, a scalar is returned. Otherwise, a list
        of results is returned (and in that case the number of columns in self
        must match the length of b).
Return the dot product of Matrix self and b relaxing the condition of compatible dimensions : if either the number of rows or columns are the same as the length of b then the dot product is returned . If self is a row or column vector a scalar is returned . Otherwise a list of results is returned ( and in that case the number of columns in self must match the length of b ) .
def dot(self, b):
        """Return the dot product of Matrix self and b relaxing the condition
        of compatible dimensions: if either the number of rows or columns are
        the same as the length of b then the dot product is returned. If self
        is a row or column vector, a scalar is returned. Otherwise, a list
        of results is returned (and in that case the number of columns in self
        must match the length of b).

        Examples
        ========

        >>> from sympy import Matrix
        >>> M = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
        >>> v = [1, 1, 1]
        >>> M.row(0).dot(v)
        6
        >>> M.col(0).dot(v)
        12
        >>> M.dot(v)
        [6, 15, 24]

        See Also
        ========

        cross
        multiply
        multiply_elementwise
        """
        from .dense import Matrix

        if not isinstance(b, MatrixBase):
            if is_sequence(b):
                if len(b) != self.cols and len(b) != self.rows:
                    raise ShapeError("Dimensions incorrect for dot product.")
                return self.dot(Matrix(b))
            else:
                raise TypeError("`b` must be an ordered iterable or Matrix, not %s." %
                type(b))
        if self.cols == b.rows:
            if b.cols != 1:
                self = self.T
                b = b.T
            prod = flatten((self*b).tolist())
            if len(prod) == 1:
                return prod[0]
            return prod
        if self.cols == b.cols:
            return self.dot(b.T)
        elif self.rows == b.rows:
            return self.T.dot(b)
        else:
            raise ShapeError("Dimensions incorrect for dot product.")
def dot ( self , b ) : from . dense import Matrix if not isinstance ( b , MatrixBase ) : if is_sequence ( b ) : if len ( b ) != self . cols and len ( b ) != self . rows : raise ShapeError ( "Dimensions incorrect for dot product." ) return self . dot ( Matrix ( b ) ) else : raise TypeError ( "`b` must be an ordered iterable or Matrix, not %s." % type ( b ) ) if self . cols == b . rows : if b . cols != 1 : self = self . T b = b . T prod = flatten ( ( self * b ) . tolist ( ) ) if len ( prod ) == 1 : return prod [ 0 ] return prod if self . cols == b . cols : return self . dot ( b . T ) elif self . rows == b . rows : return self . T . dot ( b ) else : raise ShapeError ( "Dimensions incorrect for dot product." )