implemented dotProduct