Interesting. Then Pike is erranous:
| > object A=Math.Matrix(({1,2,3,4})/2); | > object B=Math.Matrix(({5,6,7,8})/2); | > A*B; | (9) Result: Math.Matrix( ({ ({ 23, 34}), | ({ 31, 46}) }) )
(It should be: | |(9) Result: Math.Matrix( ({ ({ 19, 22}), | ({ 43, 50}) }) ) )
Any suggestion for how to fix? Will any code break if I just fix it straight off?
/ Mirar
Previous text:
12548097 2004-11-08 21:56 /1 lines/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) Recipients: Matematik och logik Comment to 12548086 Subject: matriser
Det senare. "i:te raden * j:te kolonnen".
(12548097) /Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)/-------------
Me neither. Should I just fix it then, or does anyone who has older Pike's checked out want to fix it in those as well?
Appearently no one is using that function, so I think it's enough if you fix it in the newest Pike.
Now fixed. Here's the incredibly long patch if someone feels like patching 7.6 (and older). (Please do.)
cvs server: Diffing . Index: matrix_code.h =================================================================== RCS file: /pike/data/cvsroot/Pike/7.7/src/modules/Math/matrix_code.h,v retrieving revision 1.8 diff -u -r1.8 matrix_code.h --- matrix_code.h 9 Jul 2003 01:09:12 -0000 1.8 +++ matrix_code.h 9 Nov 2004 15:44:00 -0000 @@ -647,10 +647,10 @@ n=THIS->ysize; /* == mx->xsize */ p=mx->ysize;
- dmx=matrixX(_push_new_)(m,p); + dmx=matrixX(_push_new_)(p,m);
- s1=THIS->m; - s2=mx->m; + s1=mx->m; + s2=THIS->m; d=dmx->m; for (k=0; k<p; k++) for (i=0; i<m; i++)
Did you test it with a non-square matrix? I can see the dimensions of the allocated matrix changed, but I don't see any change in the bounds for the loops generating the matrix...
Heh, this just bit me. The result was that my code which was supposed to do an IDCT instead did a DCT. The result was rather amusing to watch. :-) Well, simple enough to work around in the Pike program...
It's just a prototype implementation which is going to be rewitten in C anyway. 0.25fps isn't really good enough for production. :-)
pike-devel@lists.lysator.liu.se