vector =: 312     [EMAIL PROTECTED] 0      NB. make a 256 element vector
of random #s
matrix =: 312 256 [EMAIL PROTECTED] 0      NB. make a 256 column by 312
row matrix of random #s

doit =: 3 : 0
for_i. i. y do.
  output =: vector +/ .* matrix
end.
)

echo 'using function'
echo ((6!:2) 'doit 1000')                                   
                     NB. ~0.259691 secs

echo 'not using function'
echo 1000 * ( 1000 (6!:2) 'output =: vector +/ .* matrix')  
 NB. ~0.264517 secs

Doing the same thing is in matlab is ~0.6 secs

NB. Doing the same thing using tvmet (Tiny Vector Matrix
library using Expression Templates for C++) is ~0.36 secs

NB. The reason I am going through this is as follows:

NB.  I have about 60 seconds of data that needs to be 
processed.  Each second has about 5000
NB.  frames data.  

If I do the processing in C++ using tvmet, it will take
about 1 minute 48 seconds.

If I do the processing in J, it will take about 1 minute 19
seconds.

So to process 1 second of data takes more than 1 minute of
processing time.  I have many hours
worth of data to process.

Would moving to a 64 bit quad core processor be a good idea?

Thanks for all the good comments!

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to