Transpose in place for square matrices
Data allocation more general using matrix's dimensions