Fabian Giesen on Column vs Row Major Confusion

  • According to this blog post there are two distinct terms that get confused
  • Column or Row -Major and Column or Row Vector
  • Column or Row -Major
    • This refers to how a matrix is stored in memory
  • Column or Row -Vector
    • This is a convention for how we think about vectors e.g. is a vec3 a [1x3] matrix or a [3x1] matrix
    • This matters because when you multiply a matrix the need to have the same inner dimension. e.g. [AxN] * [NxB] is OK.
    • If you consider a vector to be a column matrix [3x1] then it needs to go on the right when multiplying by a [3x3] matrix e.g. [3x3] * [3x1]
    • If you consider a vector to be a row matrix [1x3] then it needs to go to the left of the matrix e.g. [1x3] * [3x3]

Re-reading the Scratch Pixel article after this, it appears there is some mixed terminology

Q: What does row or column major order mean for vectors?

Vector represented as row-major [1x3] matrix: V = { x y z }

Vector represented as column-major [3x1] matrix: V = { x }
                                                     { y }
                                                     { z }

Q: What does row or column major mean for matrices?

Q: Can you have different row vs column order in Vectors and Matrices?

Q: How does row vs column major affect order of multiplication?

References