Implement dot product for vectors.