liveBook · Manning

Transposition

As explained in Geometry for Programmers

A matrix transpose is the matrix obtained by exchanging a matrix's rows and columns.

Transposition flips a matrix across its top-left-to-bottom-right diagonal: rows become columns, and columns become rows. This simple rearrangement often explains why matrix code appears to use the wrong multiplication order. section 2.5.2

Use transposition to make matrix conventions explicit:

  • Check whether a library stores vectors as rows or columns before combining its transformation matrices with another library. section 4.2.1
  • Treat repeated transpositions inside one routine as a warning sign: the code may have been adjusted by trial and error rather than designed consistently. section 2.5.2
  • Choose one vector-and-matrix convention wherever possible so transformations remain readable and easier to reason about. section 4.2.1

A concrete transpose

Starting with [[1, 2, 3], [4, 5, 6], [7, 8, 9]], transpose the rows into columns to obtain [[1, 4, 7], [2, 5, 8], [3, 6, 9]]. The operation changes layout, not the underlying entries. section 2.5.2

[ [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9] ]

Inspect the matrix listing used to visualize the entries before exchanging its rows and columns. section 2.5.2

How Geometry for Programmers covers it

How deep it goes
Defines the diagonal flip and discusses implementation consequences, but stops short of deriving a transposition algorithm.
Examples
Uses a three-by-three matrix and contrasts row-vector and column-vector transformation conventions.
What it assumes
Assumes familiarity with matrix rows, columns, and multiplication; does not require knowing matrix inversion.
What you can do after
Diagnose matrix-order mismatches and choose consistent transpose conventions when connecting transformation libraries.
How it connects
Connects transposition with matrix multiplication, row vectors, column vectors, transformation matrices, and linear transformations.

Also explained in

Compare how 6 books explain transposition →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.