Add a dotProduct method for computing the dot/scalar product.