![]() ![]() ![]() That’s a somewhat unfortunate legacy, since C defaults to row-major storage, so you would normally expect a C library to use that too. Historically, IRIS GL used the row-vector convention, then OpenGL (which was based on IRIS GL) switched to column vectors in its specification (to make it match up better with standard mathematical practice) but at the same time switched storage layout from row-major to column-major to make sure that existing IRIS GL code didn’t break. This matches “reading order” (take v, transform by M, transform by N) but now you need to reverse the order when you look at the associated linear maps this is generally more trouble than it’s worth. The “row-major” convention defaults to row vectors, which means you end up with reverse order. This is why most Maths and Physics texts generally treat vectors as column vectors (unless specified otherwise). Transforming a vector by M then N is written as, which I thought was backwards and confusing when I first saw it, but it has the big advantage of being consistent with the way we usually write function evaluation and composition: (treating a matrix and its associated linear map given the standard basis as the same thing here). ![]() the result of transforming a vector v by a matrix M is written. If you treat them as column vectors, you typically multiply a vector with a matrix from the left, i.e. Row-major is the default layout in C, Pascal and most other programming languages column-major is the default in FORTRAN and some numeric math-centric languages (mainly Matlab and R) – presumably because they started out as a kind of frontend for FORTRAN code.Ĭonfusingly, the same terminology is also used by some people to denote whether you’re treating vectors as column vectors or row vectors by default. There’s two major (no pun intended) ways to store 2D arrays: Row-major and Column-major. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |