# Transpose Matrix

Published on 13 May 2022 (Updated: 18 February 2024)

Welcome to the Transpose Matrix page! Here, you'll find a description of the project as well as a list of sample programs written in various languages.

• Jeremy Grifski
• rzuckerm

## Description

In linear algebra, the transpose of a matrix is an operator which flips a matrix over its diagonal; that is, it switches the row and column indices of the matrix A by producing another matrix, often denoted by AT. For example, the following matrix could be the matrix A:

column 1 column 2 column 3
row 1 1 2 3
row 2 4 5 6
row 3 7 8 9

Once transposed, A becomes the following matrix, AT:

column 1 column 2 column 3
row 1 1 4 7
row 2 2 5 8
row 3 3 6 9

The transpose of a matrix was introduced in 1858 by the British mathematician Arthur Cayley.

## Requirements

For the purposes of this project, we'll ask that you create a program which accepts a matrix as a list of integers and the dimensions of that matrix in the following format:

``````transpose-matrix.lang 3 3 "1, 2, 3, 4, 5, 6, 7, 8, 9"
``````

Here, the first two input numbers indicate the column and row size of the matrix, respectively, and the next input is the list of numbers to be included in the matrix.

## Testing

Every project in the Sample Programs repo should be tested. In this section, we specify the set of tests specific to Transpose Matrix. In order to keep things simple, we split up the testing as follows:

• Transpose Matrix Valid Tests
• Transpose Matrix Invalid Tests

### Transpose Matrix Valid Tests

Description Cols Rows Matrix Output
Sample Input: Routine "3" "2" "1, 2, 3, 4, 5, 6" "1, 4, 2, 5, 3, 6"

### Transpose Matrix Invalid Tests

Description Cols Rows Matrix
No Input
Missing Input: No Columns Or Rows "" "" "1, 2, 3, 4, 5, 6"
Missing Input: No Matrix "3" "3" ""

All of these tests should output the following:

``````Usage: please enter the dimension of the matrix and the serialized matrix
``````