home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / graphics / 14202 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  1.9 KB

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