Menu

#1 Matrix multiply multiplies the wrong way

open
nobody
None
5
2012-07-18
2005-04-13
Anonymous
No

Hi --

The fact that no one has noticed this before either
means I'm not using the classes correctly or no one is
using the class. In case the latter is true, here is a
patch (i'm using an older version of the code, but
confirmed that the problem still exists in the latest
cvs version):

--- matrix4.cpp~ 2002-10-17 23:58:24.000000000 -0700
+++ matrix4.cpp 2005-04-03 13:24:16.610600000 -0700
@@ -88,13 +88,13 @@
{
Matrix prod;

  • for (int c=0;c<4;c++)
  • for (int r=0;r<4;r++)
  • for (int r=0;r<4;r++)
  • for (int c=0;c<4;c++)
    prod.set(c,r,
  • get(c,0)*m.get(0,r) +
  • get(c,1)*m.get(1,r) +
  • get(c,2)*m.get(2,r) +
  • get(c,3)*m.get(3,r));
  • get(0,r)*m.get(c,0) +
  • get(1,r)*m.get(c,1) +
  • get(2,r)*m.get(c,2) +
  • get(3,r)*m.get(c,3));

    return prod;
    }

nemccurd at cs dot ucsd dot edu

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB