Refactor vectorized mag and dot prod calculations.