changes to computedotproduct using reduce