public Matrix transpose ( ) { Matrix A = new Matrix ( N , M ) ; for ( int i = 0 ; i < M ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { A . data [ j ] [ i ] = data [ i ] [ j ] ; } } return A ; }
create and return the transpose of the invoking matrix