Fast transpose for IMat and LMat