The following benchmark gives an idea of the amount of improvement that would come with having special code for f/@:g :
A=: 1e6 [EMAIL PROTECTED] 0 B=: 1e6 [EMAIL PROTECTED] 0 ts '+/A*B' 0.1022 8.38976e6 ts 'A +/ .* B' 0.030484 1280 Factor of 3 in time and O(n) vs. O(m*n) in space for (m,n) matrices. ----- Original Message ----- From: "Roger Hui" <[EMAIL PROTECTED]> To: "Programming forum" <[email protected]> Sent: Wednesday, May 10, 2006 10:35 AM Subject: Re: [Jprogramming] Multiply&sum for two big arrays Pointer? Header? What's that? :-) It's best to avoid implementation concepts like those. Much better to have special code for f/@:g . > --- Anssi Seppälä <[EMAIL PROTECTED]> wrote: > > > I have two big 2-dimensional arrays in mapped files A and B. I need > > to calculate +/ A * B efficiently and without "out of memory". > > > > In the case A was a vector the . (dot) can make it +/ . * , but this > > does not work if A is a matrix. Is there a way to do this without a > > program loop? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
