roofline.devPublic Beta

Matrix Transpose

0EASYPracticeReport issue

Given matrix AA of shape m×nm \times n stored in row-major order, produce matrix BB of shape n×mn \times m such that

Bij=AjiB_{ij} = A_{ji}

The output is also stored in row-major order.

Input

  • A - input matrix of shape [m][n] stored in row-major order.
  • m - the number of rows in A.
  • n - the number of columns in A.

Output

  • B - transposed matrix of shape [n][m] stored in row-major order.
Open on a desktop browser to write and submit code.

Public submissions

Practice problem · every submission below is public, click to view code

No public submissions yet — be the first to submit.