def dot(self, other):

        from sympy.vector.functions import express
        # Check special cases
        if isinstance(other, Dyadic):
            if isinstance(self, VectorZero):
                return Vector.zero
            outvec = Vector.zero
            for k, v in other.components.items():
                vect_dot = k.args[0].dot(self)
                outvec += vect_dot * v * k.args[1]
            return outvec
        from sympy.vector.deloperator import Del
        if not isinstance(other, Vector) and not isinstance(other, Del):
            raise TypeError(str(other) + " is not a vector, dyadic or " +
                            "del operator")

        # Check if the other is a del operator
        if isinstance(other, Del):
            def directional_derivative(field):
                field = express(field, other.system, variables=True)
                out = self.dot(other._i) * df(field, other._x)
                out += self.dot(other._j) * df(field, other._y)
                out += self.dot(other._k) * df(field, other._z)
                if out == 0 and isinstance(field, Vector):
                    out = Vector.zero
                return out

            return directional_derivative

        if isinstance(self, VectorZero) or isinstance(other, VectorZero):
            return S(0)

        v1 = express(self, other._sys)
        v2 = express(other, other._sys)
        dotproduct = S(0)
        for x in other._sys.base_vectors():
            dotproduct += (v1.components.get(x, 0) *
                           v2.components.get(x, 0))

        return dotproduct
Test DatasetKFold.
dataset/ETHPy150Open sympy/sympy/sympy/vector/vector.py/Vector.dot--crossover with--dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/cross_validation/tests/test_dataset_iterators.py/test_dataset_k_fold