'Returns the dot product(also called inner product) of this
Dyadic, with another Dyadic or Vector.
If \'other\' is a Dyadic, this returns a Dyadic. Else, it returns
a Vector (unless an error is encountered).
Parameters
other : Dyadic/Vector
The other Dyadic or Vector to take the inner product with
Examples
>>> from sympy.vector import CoordSys3D
>>> N = CoordSys3D(\'N\')
>>> D1 = N.i.outer(N.j)
>>> D2 = N.j.outer(N.j)
>>> D1.dot(D2)
(N.i|N.j)
>>> D1.dot(N.j)
N.i'

def dot(self, other):

    Vector = sympy.vector.Vector
    if isinstance(other, BasisDependentZero):
        return Vector.zero
    elif isinstance(other, Vector):
        outvec = Vector.zero
        for (k, v) in self.components.items():
            vect_dot = k.args[1].dot(other)
            outvec += ((vect_dot * v) * k.args[0])
        return outvec
    elif isinstance(other, Dyadic):
        outdyad = Dyadic.zero
        for (k1, v1) in self.components.items():
            for (k2, v2) in other.components.items():
                vect_dot = k1.args[1].dot(k2.args[0])
                outer_product = k1.args[0].outer(k2.args[1])
                outdyad += (((vect_dot * v1) * v2) * outer_product)
        return outdyad
    else:
        raise TypeError((('Inner    product    is    not    defined    for    ' + str(type(other))) + '    and    Dyadics.'))
