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

  1. Xref: sparky comp.graphics:14325 comp.windows.x.pex:709 comp.graphics.opengl:283
  2. Path: sparky!uunet!usna!dfr
  3. From: dfr@usna.navy.mil (PROF D. Rogers (EAS FAC))
  4. Newsgroups: comp.graphics,comp.windows.x.pex,comp.graphics.opengl
  5. Subject: Re: Row major or column major matrices?
  6. Message-ID: <2697@usna.NAVY.MIL>
  7. Date: 27 Jan 93 18:36:02 GMT
  8. References: <1993Jan22.124249.3817@eye.com> <1993Jan23.000930.26869@kpc.com> <1993Jan26.002210.18638@mapsut.einstein.com>
  9. Sender: news@usna.NAVY.MIL
  10. Followup-To: comp.graphics
  11. Organization: U. S. Naval Academy
  12. Lines: 34
  13.  
  14. In article <1993Jan26.002210.18638@mapsut.einstein.com> jasper@iris.einstein.com (John Scott Peter XXXIII) writes:
  15. !Well, I eagerly await your agent of dismemberment....
  16. !
  17. !Actually, I have no clear preference, and I'll explain why.  In all my
  18. !education (math and physics, B.S Physics UCLA 1986), only row-major matrices
  19. !were used, so I naturally think of that as the standard.  However, I have an
  20. !idea as to why so many people are switching to column-major notation.  It's
  21. !so that matrices can be post-multiplied instead of pre-multiplied!  Post-
  22. !multiplication notation accords better with the compound operators of C and
  23. !C++.  If you're writing a matrix class in C++, and you want to multiply one
  24. !matrix by another, it seems natural to define the operator `*=' as the
  25. !multiplication operator, such that:
  26. !
  27. !    A *= B means A = A * B.
  28. !
  29. !I was writing such a class for a simple 3-D graphics program, and I quickly
  30. !realised that the most common multiplication I wanted to do was PRE-
  31. !multiplication.  I therefore said `Screw convention', and defined `*=' so
  32. !that
  33. !
  34. !    A *= B means A = B * A.
  35. !
  36. !So, my solution was to change the standard C relationship between `*=' and
  37. !`*'.  Apparently, others decided it was better to change the very operation
  38. !of matrix multiplication to imply a column-major order, so that `A *= B'
  39. !would still mean `A = A*B'.
  40.  
  41. To heck with C and C+ and Fortran etc. You'll should really look
  42. at how ANSI BASIC (yes that nasty word) handles matrices. How about
  43. like a mathematician would? Yup that's the way they do it AND
  44. it is all built into the language! Amazing. When are these modern
  45. langauage designers going to get with it.
  46.  
  47. Dave Rogers
  48.