compute dot product before thrashing everything out