Transpose a matrix, minimize cache misses