Transpose of empty matrix simply returns another empty matrix, isn't it? The check seems unnecessary for me.