I\'ve been reading a lot about this, the more I read the more confused I get.
My understanding: In row-major rows are stored contiguously in memory, in column-major colu
Let's look at algebra first; algebra doesn't even have a notion of "memory layout" and stuff.
From an algebraic pov, a MxN real matrix can act on a |R^N vector on its right side and yield a |R^M vector.
Thus, if you were sitting in an exam and given a MxN Matrix and a |R^N vector, you could with trivial operations multiply them and get a result - whether that result is right or wrong will not depend on whether the software your professor uses to check your results internally uses column-major or a row-major layout; it will only depend on if you calculated the contraction of each row of the matrix with the (single) column of the vector properly.
To produce a correct output, the software will - by whatever means - essentially have to contract each row of the Matrix with the column vector, just like you did in the exam.
Thus, the difference between software that aligns column-major and software that uses row-major-layout is not what it calculates, but just how.
To put it more pecisely, the difference between those layouts with regard to the topcial single row's contraction with the column vector is just the means to determine
Where is the next element of the current row?
And thats it.
To show you how that column/row magic is summoned in practice:
You haven't tagged your question with "c++", but because you mentioned 'glm', I assume that you can get along with C++.
In C++'s standard library there's an infamous beast called valarray, which, besides other tricky features, has overloads of operator[], one of them can take a std::slice ( which is essentially a very boring thing, consisting of just three integer-type numbers).
This little slice thing however, has everything one would need to access a row-major-storage column-wise or a column-major-storage row-wise - it has a start, a length, and a stride - the latter represents the "distance to next bucket" I mentioned.