Implementation of dot product for vectors