On 11/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I told my friend about how nice J was.  Am I wrong?
>
> He said, how fast can you multiply a 1000x1000 matrix times
> a 1x1000 vector to get a 1x1000 resultant vector.
>
> his MatLab code ran in about .6 seconds.
>
> His code follows..
>
> matrix = randn(312,256);
> vector = randn(256,1);
>
> tic
> for i = 1:1000
>    output = matrix*vector;
> end
> toc

I do not see a 1000x1000 matrix here, nor a 1x1000 'vector' -- I think
he's making up the data as he goes along.

That said, I think the J version of this would be:
   matrix=: 256+?1000 1000$1+312-256
   vector=: ?1000 1$1+256
   result=: matrix +/ .* vector

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

Reply via email to