home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.graphics:14202 comp.windows.x.pex:700 comp.graphics.opengl:277
- Newsgroups: comp.graphics,comp.windows.x.pex,comp.graphics.opengl
- Path: sparky!uunet!decwrl!netcomsv!mapsut!iris!jasper
- From: jasper@iris.einstein.com (John Scott Peter XXXIII)
- Subject: Re: Row major or column major matrices?
- Message-ID: <1993Jan26.002210.18638@mapsut.einstein.com>
- Sender: jasper@iris (John Scott Peter XXXIII)
- Date: Tue, 26 Jan 1993 00:22:10 GMT
- References: <1993Jan22.124249.3817@eye.com> <1993Jan23.000930.26869@kpc.com>
- Nntp-Posting-Host: iris
- Organization: Shmuel Einstein & Associates, Inc.
- Lines: 29
-
- Well, I eagerly await your agent of dismemberment....
-
- Actually, I have no clear preference, and I'll explain why. In all my
- education (math and physics, B.S Physics UCLA 1986), only row-major matrices
- were used, so I naturally think of that as the standard. However, I have an
- idea as to why so many people are switching to column-major notation. It's
- so that matrices can be post-multiplied instead of pre-multiplied! Post-
- multiplication notation accords better with the compound operators of C and
- C++. If you're writing a matrix class in C++, and you want to multiply one
- matrix by another, it seems natural to define the operator `*=' as the
- multiplication operator, such that:
-
- A *= B means A = A * B.
-
- I was writing such a class for a simple 3-D graphics program, and I quickly
- realised that the most common multiplication I wanted to do was PRE-
- multiplication. I therefore said `Screw convention', and defined `*=' so
- that
-
- A *= B means A = B * A.
-
- So, my solution was to change the standard C relationship between `*=' and
- `*'. Apparently, others decided it was better to change the very operation
- of matrix multiplication to imply a column-major order, so that `A *= B'
- would still mean `A = A*B'.
-
- --
- John Scott Peter XXXIII // "Instantiating new solutions in the emerging arena
- scotty@einstein.com // of obsoleting de facto industry-standard paradigms."
-