transpose of a matrix code example

Example 1: transpose matrix python

arr = list(list(x) for x in zip(*arr))

Example 2: what is transpose of a matrix

The transpose of a matrix is simply a flipped version of 
the original matrix. We can transpose a matrix by switching 
its rows with its columns. We denote the transpose of matrix 
A by AT. For example, if A=[123456] then the transpose of A is 
AT=[142536].

Example 3: what is the transpose of a matrix

The transpose of a matrix is just a flipped version of 
the original matrix. We can transpose a matrix by switching 
its rows with its columns. The original rows become the new columns
and the original columns become the new rows.
We denote the transpose of matrix A by AT. 

For example:
	1 2 3                      1 4 7
A = 4 5 6       then      AT = 2 5 8
    7 8 9                      3 6 9
    
Similarly if 

B = 1 2 3       then      BT = 1 4
    4 5 6                      2 5 
                               3 6

Example 4: matrix transpose tiling

const int N_r = 56;
  const int N_c = 75;

  const int TILE_DIM = 16;

  const int outer_Dimc = (N_c - 1) / TILE_DIM + 1;
  const int outer_Dimr = (N_r - 1) / TILE_DIM + 1;

  int** dest; 
  int** src;

//
  // (0) Outer loops to iterate over tiles
  //
  for (int by = 0; by < outer_Dimr; ++by) {
    for (int bx = 0; bx < outer_Dimc; ++bx) {
      //
      // (1) Loops to iterate over tile entries
      //
      for (int ty = 0; ty < TILE_DIM; ++ty) {
        for (int tx = 0; tx < TILE_DIM; ++tx) {

          int col = bx * TILE_DIM + tx;  // Matrix column index
          int row = by * TILE_DIM + ty;  // Matrix row index

          // Bounds check
          if (row < N_r && col < N_c) {
            dest[col][row] = src[row][col];
          }
          
        }
      }
      
    }
  }

Example 5: transpose of a matrix in matlab

B = A.'
B = A'
B = transpose(A)